我有一个Ubuntu 12.04服务器,我试图设置Apache使用LDAPS进行身份validation。 我遇到了一些问题 – 看到我以前的问题 ,我的结论是在LDAP服务器上的证书已过期。
所以我的老板从DigiCert获得了“真正”的证书,并将其安装在myldap.xyz.edu 。 然后我去了myserver.xyz.edu并尝试了openssl s_client -connect myldap.xyz.edu:636 -showcerts 。 以下是它给我的:
CONNECTED(00000003) 140075639178912:error:1408F092:SSL routines:SSL3_GET_RECORD:data length too long:s3_pkt.c:504: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 16731 bytes and written 7 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE SSL-Session: Protocol : TLSv1 Cipher : 0000 Session-ID: Session-ID-ctx: Master-Key: Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None Start Time: 1340655299 Timeout : 300 (sec) Verify return code: 0 (ok) ---
…它让我回到命令提示符。
我在网上查了这个“数据长度太长”的错误,但是对我的解释大都是希腊文。 这是客户端还是服务器的问题? 这是否与证书或别的什么有关? 我能做些什么呢? 谢谢!
编辑:做了一些更多的戳动,发现这个微软教程启用Active Directory中的SSL通过SSL(我应该提到,我们的LDAP服务器是Windows Server 2003 W / SP2运行AD)。 它给了我以下步骤来testing是否启用LDAPS:
- 启动Active Directorypipe理工具(Ldp.exe)。
- 在连接菜单上,单击连接。
- 键入要连接的域控制器的名称。
- 键入636作为端口号。
- 点击OK。
RootDSE信息应打印在右侧窗格中,指示连接成功。
我远程桌面到myldap.xyz.edu并尝试它。 这是我在右窗格中的输出:
ld = ldap_open("myldap.xyz.edu", 636); Established connection to myldap.xyz.edu. Retrieving base DSA information... Result <0>: (null) Matched DNs: Getting 1 entries: >> Dn: 1> currentTime: 06/25/2012 16:57:13 Central Standard Time Central Daylight Time; 1> subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,DC=xyz,DC=edu; 1> dsServiceName: CN=NTDS Settings,CN=MYLDAP,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=xyz,DC=edu; 5> namingContexts: DC=xyz,DC=edu; CN=Configuration,DC=xyz,DC=edu; CN=Schema,CN=Configuration,DC=xyz,DC=edu; DC=DomainDnsZones,DC=xyz,DC=edu; DC=ForestDnsZones,DC=xyz,DC=edu; 1> defaultNamingContext: DC=xyz,DC=edu; 1> schemaNamingContext: CN=Schema,CN=Configuration,DC=xyz,DC=edu; 1> configurationNamingContext: CN=Configuration,DC=xyz,DC=edu; 1> rootDomainNamingContext: DC=xyz,DC=edu; 23> supportedControl: 1.2.840.113556.1.4.319; 1.2.840.113556.1.4.801; 1.2.840.113556.1.4.473; 1.2.840.113556.1.4.528; 1.2.840.113556.1.4.417; 1.2.840.113556.1.4.619; 1.2.840.113556.1.4.841; 1.2.840.113556.1.4.529; 1.2.840.113556.1.4.805; 1.2.840.113556.1.4.521; 1.2.840.113556.1.4.970; 1.2.840.113556.1.4.1338; 1.2.840.113556.1.4.474; 1.2.840.113556.1.4.1339; 1.2.840.113556.1.4.1340; 1.2.840.113556.1.4.1413; 2.16.840.1.113730.3.4.9; 2.16.840.1.113730.3.4.10; 1.2.840.113556.1.4.1504; 1.2.840.113556.1.4.1852; 1.2.840.113556.1.4.802; 1.2.840.113556.1.4.1907; 1.2.840.113556.1.4.1948; 2> supportedLDAPVersion: 3; 2; 12> supportedLDAPPolicies: MaxPoolThreads; MaxDatagramRecv; MaxReceiveBuffer; InitRecvTimeout; MaxConnections; MaxConnIdleTime; MaxPageSize; MaxQueryDuration; MaxTempTableSize; MaxResultSetSize; MaxNotificationPerConn; MaxValRange; 1> highestCommittedUSN: 13287969; 4> supportedSASLMechanisms: GSSAPI; GSS-SPNEGO; EXTERNAL; DIGEST-MD5; 1> dnsHostName: MYLDAP.xyz.edu; 1> ldapServiceName: xyz.edu:[email protected]; 1> serverName: CN=MYLDAP,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=xyz,DC=edu; 3> supportedCapabilities: 1.2.840.113556.1.4.800; 1.2.840.113556.1.4.1670; 1.2.840.113556.1.4.1791; 1> isSynchronized: TRUE; 1> isGlobalCatalogReady: TRUE; 1> domainFunctionality: 2 = ( DS_BEHAVIOR_WIN2003 ); 1> forestFunctionality: 2 = ( DS_BEHAVIOR_WIN2003 ); 1> domainControllerFunctionality: 2 = ( DS_BEHAVIOR_WIN2003 ); -----------
看起来像它的工作,所以我猜测Active Directory是LDAPS就绪。
编辑2: Per @ SilverbackNet的build议,我用-debug选项尝试了openssl s_client命令。 这是(redacted)输出:
CONNECTED(00000003) write to 0x24f3470 [0x24f34f0] (226 bytes => 226 (0xE2)) 0000 - 16 03 01 00 dd 01 00 00-d9 03 02 4f f3 5a 5b 38 ...........OZ[8 [...] 00e0 - 01 01 .. read from 0x24f3470 [0x24f8a50] (7 bytes => 7 (0x7)) 0000 - 16 03 01 40 b9 02 ...@.. 0007 - <SPACES/NULS> read from 0x24f3470 [0x24f8a5a] (16567 bytes => 2889 (0xB49)) 0000 - 00 4d 03 01 4f f3 5a 5b-46 43 f0 02 76 34 1c d5 .M..OZ[FC..v4.. [...] 0b40 - 70 3a 2f 2f 63 72 6c 33-2e p://crl3. read from 0x24f3470 [0x24f95a3] (13678 bytes => 13678 (0x356E)) 0000 - 64 69 67 69 63 65 72 74-2e 63 6f 6d 2f 44 69 67 digicert.com/Dig [...] 3560 - 65 72 20 52 6f 6f 74 20-43 41 0e er Root CA. 356e - <SPACES/NULS> write to 0x24f3470 [0x25027e0] (7 bytes => 7 (0x7)) 0000 - 15 03 01 00 02 02 16 ....... --- no peer certificate available [...]
从那里跟上面一样 如果有帮助的话,我也可以发布右栏的全部输出。
编辑3:我们已经决定暂时放弃这一点,暂时使用旧的过期证书LDAPVerifyServerCert off Apache选项LDAPVerifyServerCert off 。 :^(FWIW,我的老板现在想着要得到一个特殊的,短的(1024字节,我认为他说)证书来做LDAP服务器validation,他比我知道的更详细,但这是有道理的我是因为错误信息太大,如果/当我们解决问题的时候,我会尽量发表答案。
通常这意味着您正在与非SSL服务器通话。 检查LDAP服务器上的configuration工作; 新的证书似乎还没有工作。