Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LDAPS ( TLS ) in System.DirectoryServices.Protocols ON Linux #103243

Closed
carlosromanbarrado opened this issue Jun 10, 2024 Discussed in #103242 · 2 comments
Closed

Support LDAPS ( TLS ) in System.DirectoryServices.Protocols ON Linux #103243

carlosromanbarrado opened this issue Jun 10, 2024 Discussed in #103242 · 2 comments
Labels
area-System.DirectoryServices needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration

Comments

@carlosromanbarrado
Copy link

carlosromanbarrado commented Jun 10, 2024

Discussed in #103242

Originally posted by carlosromanbarrado June 10, 2024
Hello,

I have spent several days trying to connect using LdapConnection in Linux VMs again LDAP Servers protected by LDAPS.
I could not, but i can on Windows.

I can connect LDAP on boths, Linux & Windows.

I´m not sure if i´m doing something wrong or the reason is that LDAPs is not supported on Linux on NET 8.

I´m allways get an Exception: "LDAP Server is unavailable"

My Code is very simple:

NET 8.0
System.DirectoryServices.Protocols 8.0.0


string ldapServer = "MYSERVER";  // Real Data in my tests
string ldapPort = "636";
string userConn = "userDN"; // Real Data in my tests
string password = "passwords"; // Real Data in my tests


ldapsettings = new LdapDirectoryIdentifier(ldapServer,Int32.Parse(ldapPort),false,false);
ldapConn = new LdapConnection(ldapsettings);
ldapConn.Credential = new NetworkCredential(userConn, password);
ldapConn.AuthType = AuthType.Basic;
LdapSessionOptions options = ldapConn.SessionOptions;
options.SecureSocketLayer = true;
options.ProtocolVersion = 3;

ldapConn.Bind();

Let me for any question.

Many Thanks,
Carlos Román

@buyaa-n
Copy link
Contributor

buyaa-n commented Jun 19, 2024

I´m not sure if i´m doing something wrong or the reason is that LDAPs is not supported on Linux on NET 8.

Not sure for sure, you might be using a LdapOption that is not supported on Linux, check:

LDAP_OPT_SERVER_ERROR = 0x33, // Not Supported in Linux
LDAP_OPT_SERVER_EXT_ERROR = 0x34, // Not Supported in Linux
LDAP_OPT_HOST_REACHABLE = 0x3E, // Not Supported in Linux
LDAP_OPT_PING_KEEP_ALIVE = 0x36, // Not Supported in Linux
LDAP_OPT_PING_WAIT_TIME = 0x37, // Not Supported in Linux
LDAP_OPT_PING_LIMIT = 0x38, // Not Supported in Linux
LDAP_OPT_DNSDOMAIN_NAME = 0x3B, // Not Supported in Linux
LDAP_OPT_GETDSNAME_FLAGS = 0x3D, // Not Supported in Linux
LDAP_OPT_PROMPT_CREDENTIALS = 0x3F, // Not Supported in Linux
LDAP_OPT_TCP_KEEPALIVE = 0x40, // Not Supported in Linux
LDAP_OPT_FAST_CONCURRENT_BIND = 0x41, // Not Supported in Linux
LDAP_OPT_SEND_TIMEOUT = 0x42, // Not Supported in Linux
LDAP_OPT_REFERRAL_CALLBACK = 0x70, // Not Supported in Linux
LDAP_OPT_CLIENT_CERTIFICATE = 0x80, // Not Supported in Linux
LDAP_OPT_SERVER_CERTIFICATE = 0x81, // Not Supported in Linux
LDAP_OPT_AUTO_RECONNECT = 0x91, // Not Supported in Linux

For example you might be using LdapSessionOptions.VerifyServerCertificate callback that is not supported on Linus

@buyaa-n buyaa-n added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 19, 2024
@carlosromanbarrado
Copy link
Author

Hello,

You can close the issue.

As you indicate, "LdapSessionOptions.VerifyServerCertificate" is not work in Linux and failed.

I dont use this, but i can work correctly my code as LDAP Subsystem in Linux control the Certificate Validations Behaviour, plus timeout and so. ( pe: LDAPTLS_CERT )

Many Thanks,

@dotnet-policy-service dotnet-policy-service bot added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity labels Jul 5, 2024
@buyaa-n buyaa-n closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.DirectoryServices needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
None yet
Development

No branches or pull requests

2 participants