openLDAP ssl/tls Centos 6.3
Katerina Bubenickova
katerina.bubenickova na plbohnice.cz
Pondělí Březen 17 13:50:50 CET 2014
On Fri, 2014-03-14 at 16:09 +0100, Pavel Kankovsky wrote:
> Je otázka, zda by nestálo za pokus nejdřív aktualizovat a vyzkoušet,
zda
> to nezačne fungovat.
Aktualizovala jsem, než jsem začala úpravy - hned po naklonování
serveru. Teď už se mi aktualizovalo jenom asi 8 balíků - nic co by
vypadalo jako openldap, takže to bylo aktuální. Číslo verze se asi
ukazuje po restartu, nerestartovala jsem.
> -12285 je SSL_ERROR_NO_CERTIFICATE
>
> "Unable to find the certificate or key necessary for authentication."
>
> This error has many potential causes; for example:
> - Certificate or key not found in database.
> - Certificate not marked trusted in database and Certificate's issuer
not
> marked trusted in database.
> - Wrong password for key database.
> - Missing database.
>
Ne, že bych to byla někdy schopna zopakovat sama, ale čistě ze
zvědavosti - kde se tenhle popis chyb najde?
> Zdá se, že problém je opravdu v inicializaci, kdy se z nějakého důvodu
> nepodaří načíst klíče a certifikáty z databáze, ačkoli podle
provedeného
> pokusu s programem selfserv by db měla být použitelná...
>
> Teď mne ale napadá, že vlastně ten selfserv fungovat neměl, protože
> privátní klíč měl být zašifrovaný heslem v pwdfile.txt, o kterém
> selfservu nikdo neřekl. Jestli nebude chyba v tom, že tam ho heslo
> není, ale slapd ho zkouší a tak mu to nefunguje? Můžete ten selfserv
> zkusit spustit ještě jednou a přidat k parametrům
> "-f /etc/openldap/certs/pwdfile.txt"?
spustila jsem
/usr/lib64/nss/unsupported-tools/selfserv -d /etc/openldap/certs -n
Server-Cert -p 12345 -f /etc/openldap/certs/tmp/pwdfile
> openssl s_client -connect localhost:12345
> CONNECTED(00000003)
> depth=1 DC = cz, DC = plbohnice, CN = PNB CA cert
> verify error:num=19:self signed certificate in certificate chain
> verify return:0
> ---
> Certificate chain
> 0 s:/CN=test-LDAP.bohnice.cz
> i:/DC=cz/DC=plbohnice/CN=PNB CA cert
> 1 s:/DC=cz/DC=plbohnice/CN=PNB CA cert
> i:/DC=cz/DC=plbohnice/CN=PNB CA cert
> ---
> Server certificate
> -----BEGIN CERTIFICATE-----
> MIIB2TCCAUKgAwIBAgICA+kwDQYJKoZIhvcNAQEFBQAwRTESMBAGCgmSJomT8ixk
> ARkWAmN6MRkwFwYKCZImiZPyLGQBGRYJcGxib2huaWNlMRQwEgYDVQQDEwtQTkIg
> Q0EgY2VydDAeFw0xNDAzMTExMzE3NTFaFw0yNDAzMTExMzE3NTFaMB8xHTAbBgNV
> BAMTFHRlc3QtTERBUC5ib2huaWNlLmN6MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
> iQKBgQCjOlL2ISwBtM598LVgkjfRNga38lD0HixfHoEZZrfjq5DyPdulPKEbrfFF
> LgoTrlMtZVHtE9EXYUK7aow+cF757hAgZuxE9udutlH6kv2QyADf/2HPE1HH9A/A
> QU30w0aXD0p6Vq20euScQSI9rODU/T/3Ohtf8Mgfw1osZzqgfQIDAQABMA0GCSqG
> SIb3DQEBBQUAA4GBAMecLhOWCeivBfTLZGk52fZO3Ftn0iVe/WYBKO70ZxDE7gE5
> TMyz7RYbKy5dJFt2HNvXQip7bjhxZ9S/1rMGQR2NR81VLU0EOTfTdWNCCx4tfb88
> P442tysDjywWrutHNcbHH3/deiC4QEIBYRdARr75KvT42fzVNbklmV1YKSrd
> -----END CERTIFICATE-----
> subject=/CN=test-LDAP.bohnice.cz
> issuer=/DC=cz/DC=plbohnice/CN=PNB CA cert
> ---
> No client certificate CA names sent
> ---
> SSL handshake has read 1164 bytes and written 453 bytes
> ---
> New, TLSv1/SSLv3, Cipher is AES128-GCM-SHA256
> Server public key is 1024 bit
> Secure Renegotiation IS supported
> Compression: NONE
> Expansion: NONE
> SSL-Session:
> Protocol : TLSv1.2
> Cipher : AES128-GCM-SHA256
> Session-ID:
4986B79249877DA342F2193FCE3E6B31AADA6EDEC6937B9406A6364C5FBBE8C1
> Session-ID-ctx:
> Master-Key:
42BAC08909ED2E6E9AA87544F35180C68CD6557ED68F3B1B2C198A9653C1ED722D82A7885C3F9E49078FFDD8FBA6184A
> Key-Arg : None
> Krb5 Principal: None
> PSK identity: None
> PSK identity hint: None
> Start Time: 1395048009
> Timeout : 300 (sec)
> Verify return code: 19 (self signed certificate in certificate
chain)
> ---
>
>
> HTTP/1.0 200 OK
> Server: Generic Web Server
> Date: Tue, 26 Aug 1997 22:10:05 GMT
> Content-type: text/plain
>
>
>
> EOF
>
>
Je zajímavé, že stejný výstup měl příkaz openssl s_client ... i bez
parametru -f, i když jsem tam napsala špatnou cestu k pwdfile, i když už
to bylo správně...
>
> > při opakovaném ldapsearch pak
> > PR_GetError() = -5925
>
> Tato hodnota je PR_CALL_ONCE_ERROR.
>
> "The one-time function was previously called and failed. Its error
code is
> no longer available"
>
> Evidentně se při prvním spojení pokusí něco inicializovat, to selže a
dál
> už to nezkouší.
>
> Možná by se dalo zkusit se podívat do tlsm_deferred_ctx_init
(jmenuje-li
> se to ve Vaší verzi stejně), kde by se měla provádět uvedená
inicializace.
> Aspoň by z toho mohlo jít poznat, který krok přesně selže.
>
Při krokování jsem se dostala na následující chybové kódy"
PR_GetError() = 0
PR_GetError() = -8038
PR_GetError() = -8191
PR_GetError() = -8015
PR_GetError() = -12285
kromě problému,
Missing separate debuginfos, use: debuginfo-install
sqlite-3.6.20-1.el6.x86_64
vidím také
/usr/include/bits/string3.h: No such file or directory - to tam opravdu
není. Je to potřeba?
Krokování tlsm_deferred_ctx_ini:
> PR_GetCurrentThread () at ../../../nspr/pr/src/pthreads/ptthread.c:635
> 635 if (NULL == thred) thred = pt_AttachThread();
> (gdb)
> 638 } /* PR_GetCurrentThread */
> (gdb)
> PR_SetError (code=-8038, osErr=0) at
../../../nspr/pr/src/misc/prerror.c:26
> 26 thread->errorCode = code;
> (gdb) print PR_GetError()
> $5 = 0
> (gdb) step
> 27 thread->osErrorCode = osErr;
> (gdb)
> 28 thread->errorStringLength = 0;
> (gdb)
> 29 }
> (gdb)
> SECMOD_RestartModules (force=0) at pk11util.c:1520
> 1520 return SECFailure;
> (gdb) print PR_GetError()
> $6 = -8038
...
> (gdb) print PR_GetError()
> $14 = -8038
> (gdb) step
> 85 /usr/include/bits/string3.h: No such file or directory.
> in /usr/include/bits/string3.h
> (gdb) print PR_GetError()
> $15 = -8038
....
> PR_GetCurrentThread () at ../../../nspr/pr/src/pthreads/ptthread.c:635
> 635 if (NULL == thred) thred = pt_AttachThread();
> (gdb) print PR_GetError()
> $113 = -8038
> (gdb) step
> 638 } /* PR_GetCurrentThread */
> (gdb)
> PR_SetError (code=-8191, osErr=0) at
../../../nspr/pr/src/misc/prerror.c:26
> 26 thread->errorCode = code;
> (gdb)
> 27 thread->osErrorCode = osErr;
> (gdb)
> 28 thread->errorStringLength = 0;
> (gdb)
> 29 }
> (gdb)
> OCSP_InitGlobal () at ocsp.c:944
> 944 PR_ExitMonitor(OCSP_Global.monitor);
> (gdb)
> 942 if (OCSP_Global.cache.entries)
> (gdb) print PR_GetError()
> $114 = -8191
....
773 if (!once->initialized) {
(gdb)
788 if (PR_SUCCESS != once->status) {
(gdb) print once->status
$170 = PR_SUCCESS
(gdb) step
793 }
(gdb)
NSS_InitializePRErrorTable () at errstrs.c:39
39 }
(gdb)
37 return (PR_SUCCESS == PR_CallOnce(&once,
nss_InitializePRErrorTableOnce))
(gdb)
NSS_InitializePRErrorTable () at errstrs.c:39
39 }
(gdb)
nss_Init (configdir=0x7fbc48002700 "/etc/openldap/certs",
certPrefix=0x7fbc705a9aee "", keyPrefix=0x7fbc705a9aee "",
secmodName=0x7fbc705dced3 "secmod.db", updateDir=0x7fbc6ef4d083 "",
updCertPrefix=0x7fbc6ef4d083 "", updKeyPrefix=0x7fbc6ef4d083 "",
updateID=0x7fbc6ef4d083 "", updateName=0x7fbc6ef4d083 "",
initContextPtr=0x7fbc5640e708, initParams=0x7fbc5640e760, readOnly=1,
noCertDB=1,
noModDB=0, forceOpen=0, noRootInit=1, optimizeSpace=0,
noSingleThreadedModules=0, allowAlreadyInitializedModules=0,
dontFinalizeModules=0)
at nssinit.c:639
639 rv = nss_InitModules(configdir, certPrefix, keyPrefix,
secmodName,
(gdb) print rv
$171 = SECFailure
(gdb) print PR_GetError()
$172 = -8191
...
(gdb)
nss_makeFlags (configdir=0x7fbc48002700 "/etc/openldap/certs",
certPrefix=0x7fbc705a9aee "", keyPrefix=0x7fbc705a9aee "",
secmodName=0x7fbc705dced3 "secmod.db", updateDir=0x7fbc6ef4d083 "",
updCertPrefix=0x7fbc6ef4d083 "", updKeyPrefix=0x7fbc6ef4d083 "",
updateID=0x7fbc6ef4d083 "", updateName=0x7fbc6ef4d083 "",
initContextPtr=0x7fbc5640e708, initParams=0x7fbc5640e760, readOnly=1,
noCertDB=1,
noModDB=0, forceOpen=0, noRootInit=1, optimizeSpace=0,
noSingleThreadedModules=0, allowAlreadyInitializedModules=0,
dontFinalizeModules=0)
at nssinit.c:70
70 if (noCertDB) {
(gdb)
71 if (!first) PORT_Strcat(flags,",");
(gdb) print noCertDB
$182 = 1
....
Missing separate debuginfos, use: debuginfo-install
sqlite-3.6.20-1.el6.x86_64
.....
> (gdb)
> nss_Init (configdir=0x7fbc48002700 "/etc/openldap/certs",
certPrefix=<value optimized out>, keyPrefix=<value optimized out>,
> secmodName=0x7fbc705dced3 "secmod.db", updateDir=<value optimized
out>, updCertPrefix=0x7fbc48003190 "\320B",
> updKeyPrefix=0x7fbc6ef4d083 "", updateID=0x7fbc6ef4d083 "",
updateName=0x7fbc6ef4d083 "", initContextPtr=0x7fbc5640e708,
> initParams=0x7fbc5640e760, readOnly=1, noCertDB=1, noModDB=0,
forceOpen=0, noRootInit=1, optimizeSpace=0, noSingleThreadedModules=0,
> allowAlreadyInitializedModules=0, dontFinalizeModules=0) at
nssinit.c:639
> 639 rv = nss_InitModules(configdir, certPrefix, keyPrefix,
secmodName,
> (gdb)
> 652 if (!isReallyInitted) {
> (gdb) print PR_GetError()
> $205 = -8015
....
> (gdb)
> 722 if (initContextPtr && configStrings) {
> (gdb)
> 723 PR_smprintf_free(configStrings);
> (gdb)
> 742 }
> (gdb)
> NSS_InitContext (configdir=<value optimized out>, certPrefix=<value
optimized out>, keyPrefix=<value optimized out>,
> secmodName=<value optimized out>, initParams=<value optimized
out>, flags=<value optimized out>) at nssinit.c:844
> 844 return (rv == SECSuccess) ? context : NULL;
> (gdb) print rv
> $214 = SECSuccess
> (gdb) next
> 845 }
> (gdb)
> tlsm_deferred_init (arg=0x7fbc48002600) at tls_m.c:1804
> 1804 if (initctx != NULL) {
> (gdb)
> 1799 initctx = NSS_InitContext( realcertdir,
prefix, prefix, SECMOD_DB,
> (gdb)
> 1804 if (initctx != NULL) {
> (gdb)
> 1805 certdb_slot =
tlsm_init_open_certdb(ctx, realcertdir, prefix);
> (gdb)
> 1806 if (certdb_slot) {
> (gdb)
> 1808 ctx->tc_initctx =
initctx;
> (gdb) print PR_GetError()
> $215 = -12285
------
Děkuju,
KB
Další informace o konferenci Linux