环境:Mac OS X 10.6.3 安装/导入 MacOS X 10.5.8 Open Directory 主服务器。升级后,LDAP+TLS 在我们的 MacOS X 10.5、10.6、CentOS、Debian 和 FreeBSD 客户端(Apache2 和 PAM)上失败。
使用 ldapsearch 进行测试:
ldapsearch -ZZ -H ldap://gnome.darkhorse.com -v -x -b "dc=darkhorse,dc=com" '(uid=donaldr)' uid
...失败:
ldap_start_tls: Protocol error (2)
测试添加“-d 9”失败:
res_errno: 2, res_error: <unsupported extended operation>, res_matched: <>
无需 STARTTLS 或使用 LDAPS 进行测试:
ldapsearch -H ldap://gnome.darkhorse.com -v -x -b "dc=darkhorse,dc=com" '(uid=donaldr)' uid
ldapsearch -H ldaps://gnome.darkhorse.com -v -x -b "dc=darkhorse,dc=com" '(uid=donaldr)' uid
...成功:
# donaldr, users, darkhorse.com
dn: uid=donaldr,cn=users,dc=darkhorse,dc=com
uid: donaldr
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
result: 0 Success
(我们在 /etc/openldap/ldap.conf 中指定“TLS_REQCERT never”)
使用 openssl 进行测试:
openssl s_client -connect gnome.darkhorse.com:636 -showcerts -state
...成功:
CONNECTED(00000003)
SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL_connect:SSLv3 read server hello A
depth=1 /C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=Dark Horse Network/CN=DHC MIS Department
verify error:num=19:self signed certificate in certificate chain
verify return:0
SSL_connect:SSLv3 read server certificate A
SSL_connect:SSLv3 read server done A
SSL_connect:SSLv3 write client key exchange A
SSL_connect:SSLv3 write change cipher spec A
SSL_connect:SSLv3 write finished A
SSL_connect:SSLv3 flush data
SSL_connect:SSLv3 read finished A
---
Certificate chain
0 s:/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=MIS/CN=gnome.darkhorse.com
i:/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=Dark Horse Network/CN=DHC MIS Department
1 s:/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=Dark Horse Network/CN=DHC MIS Department
i:/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=Dark Horse Network/CN=DHC MIS Department
---
Server certificate
-----BEGIN CERTIFICATE-----
<deleted for brevity>
-----END CERTIFICATE-----
subject=/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=MIS/CN=gnome.darkhorse.com
issuer=/C=US/ST=Oregon/L=Milwaukie/O=Dark Horse Comics, Inc./OU=Dark Horse Network/CN=DHC MIS Department
---
No client certificate CA names sent
---
SSL handshake has read 2640 bytes and written 325 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : AES256-SHA
Session-ID: D3F9536D3C64BAAB9424193F81F09D5C53B7D8E7CB5A9000C58E43285D983851
Session-ID-ctx:
Master-Key: E224CC065924DDA6FABB89DBCC3E6BF89BEF6C0BD6E5D0B3C79E7DE927D6E97BF12219053BA2BB5B96EA2F6A44E934D3
Key-Arg : None
Start Time: 1271202435
Timeout : 300 (sec)
Verify return code: 0 (ok)
所以我们认为 slapd 守护进程正在读取我们的证书并将其写入 LDAP 客户端。
Apple 服务器管理员将 ProgramArguments ("-h ldaps:///") 添加到 /System/Library/LaunchDaemons/org.openldap.slapd.plist 和 TLSCertificateFile、TLSCertificateKeyFile、TLSCACertificateFile 和 TLSCertificatePassphraseTool 到 /etc/openldap/slapd_macosxserver.conf 时在 Open Directory 服务的 LDAP 部分启用 SSL。虽然这对于 LDAPS 来说已经足够了,但对于 TLS 来说似乎还不够。比较我们的 10.6 和 10.5 slapd.conf 和 slapd_macosxserver.conf 配置文件没有任何线索。用 Apple 服务器管理员生成的自签名证书替换我们的证书(使用自签名 ca 生成)不会导致 ldapsearch 结果发生变化。
在 /System/Library/LaunchDaemons/org.openldap.slapd.plist 日志中将 -d 设置为 256:
4/13/10 5:23:35 PM org.openldap.slapd[82162] conn=384 op=0 EXT oid=1.3.6.1.4.1.1466.20037
4/13/10 5:23:35 PM org.openldap.slapd[82162] conn=384 op=0 do_extended: unsupported operation "1.3.6.1.4.1.1466.20037"
4/13/10 5:23:35 PM org.openldap.slapd[82162] conn=384 op=0 RESULT tag=120 err=2 text=unsupported extended operation
非常感谢任何调试建议。
——汤姆·基舍尔
附言
来自 Apple 的电子邮件确认他们可以重现这一点(LDAP+STARTLS 失败,但 LDAPS 在 10.6 上成功,但两者都在 10.5 上工作)并打开了内部错误报告。
0 个回答