繁体   English   中英

通过SSL连接到AD服务器时出现问题?

[英]issues in connecting to AD server over SSL?

我必须在Active Directory服务器上启用SSL,为此,我遵循此处提到的每个步骤: http : //www.linuxmail.info/enable-ldap-ssl-active-directory/

现在我不确定SSL是否真的启用了吗?

在服务器本身上,如果我运行ldp,我想我可以在636端口上连接。 但是,在我的系统上,我在ldp客户端上看不到SSL选项吗?

我还有另外两个LDAP客户端(Softerra LDAP Browser和Apache Directory Studio),但是我无法使用ldaps(在636端口上)进行连接。 我想我需要导入AD服务器中使用的证书,以便这些工具可以信任我在AD服务器上使用的自签名证书。

使用Java代码,我已经将证书添加到cacerts中(使用此处提到的步骤获取证书: http : //www.linuxmail.info/export-ssl-certificate-windows-2003/ ),但是我仍然无法连接到AD使用SSL。

我尝试了SSL以及TSL:

TLS:

// got LdapContext using ldap (not with ldaps)
StartTlsResponse tls = (StartTlsResponse)ctx.extendedOperation(new StartTlsRequest());

它给出以下异常:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

SSL:

String ldapURL = "ldaps://<domain-name>:636";
String keystore = "C:/Oracle/Middleware/jdk160_24/jre/lib/security/cacerts";
System.setProperty("javax.net.ssl.trustStore",keystore);
env.put(Context.SECURITY_PROTOCOL,"ssl");
// other properties are set in env
LdapContext ctx = new InitialLdapContext(env, null);

它给出以下异常:

javax.naming.CommunicationException: <domain-name>:636 [Root exception is java.net.ConnectException: Connection timed out: connect]

谁能建议我错了吗?

谢谢。

这个是固定的。

我使用了错误的(而不是不完整的)命令来导入证书。

我正在使用:

keytool -import -alias mycert -keystore cacerts -file d:\mycert.cer

当我使用以下方法时:

keytool -import -noprompt -trustcacerts -alias mycert -file c:/mycert.cer -keystore C:/Oracle/Middleware/jdk160_24/jre/lib/security/cacerts -storepass changeit

它开始工作。

如果无法使TLS正常工作,则SSL不太可能正常工作。 您确定获得正确的证书并正确配置了密钥库吗? 尝试使用TLS时,基于SSLHandshakeException,似乎未正确设置。

查看此SO答案,以获取有关如何验证密钥库是否正确设置的一些提示: https : //stackoverflow.com/a/9619478/1792088

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM