Bug 643134
Summary: | nss trusts CAs it shouldn't | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Elio Maldonado Batiz <emaldona> |
Component: | nss | Assignee: | Elio Maldonado Batiz <emaldona> |
Status: | CLOSED ERRATA | QA Contact: | Aleš Mareček <amarecek> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.1 | CC: | amarecek, dwmw2, emaldona, kdudka, kengert, rob.townley, rrelyea, security-response-team, thoger |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | nss-3.12.9-3.el6 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | 633043 | Environment: | |
Last Closed: | 2011-05-19 14:03:42 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 633043 | ||
Bug Blocks: | |||
Attachments: |
Description
Elio Maldonado Batiz
2010-10-14 18:15:28 UTC
Deleted trust entries may not necessarily be deleted. If the certificate lives in a readonly database, it will *added* to a r/w database and marked untrusted. For the non-root user sql:/etc/pki/nssdb is read only. It looks like both problems are really problems of trust order. My guess is /etc/pki/nssdb has the same or greater trust order than ~/.pki/nssdb, which is clearly wrong, at least for the normal default system out of the box. This patch may fix the issue.... Index: nsssysinit.c =================================================================== RCS file: /cvsroot/mozilla/security/nss/lib/sysinit/nsssysinit.c,v retrieving revision 1.2 diff -u -r1.2 nsssysinit.c --- nsssysinit.c 6 Feb 2010 04:56:37 -0000 1.2 +++ nsssysinit.c 15 Oct 2010 16:58:36 -0000 @@ -221,7 +221,7 @@ * 2 for the key slot, and * 3 for the crypto operations slot fips */ -#define ORDER_FLAGS "trustOrder=75 cipherOrder=100" +#define ORDER_FLAGS "cipherOrder=100" #define SLOT_FLAGS \ "[slotFlags=RSA,RC4,RC2,DES,DH,SHA1,MD5,MD2,SSL,TLS,AES,RANDOM" \ " askpw=any timeout=30 ]" @@ -270,7 +270,7 @@ "library= " "module=\"NSS User database\" " "parameters=\"configdir='sql:%s' %s tokenDescription='NSS user database'\" " - "NSS=\"%sflags=internal%s\"", + "NSS=\"trustOrder=75 %sflags=internal%s\"", userdb, stripped_parameters, nssflags, isFIPS ? ",FIPS" : ""); @@ -315,7 +315,7 @@ "library= " "module=\"NSS system database\" " "parameters=\"configdir='sql:%s' tokenDescription='NSS system database' %s\" " - "NSS=\"%sflags=internal,critical\"",sysdb, readonly, nssflags); + "NSS=\"trustOrder=80 %sflags=internal,critical\"",sysdb, readonly, nssflags); } /* that was the last module */ How are these flags supposed to interact with the corresponding flags from /etc/pki/nssdb/pkcs11.txt ? So far the patch isn't working for me, I can still connect as user even after setting the ca trust to ",," on the user's db. I have tried it as is where I had to disable David's nss-syinit-userdb-first pathc and also keeping both. I'll let Bob answer Kamil's question. (In reply to comment #4) > How are these flags supposed to interact with the corresponding flags from > /etc/pki/nssdb/pkcs11.txt ? This flags will override what's in /etc/pki/nssdb/pkcs11.txt. After the patch the are the same as far as trust goes since the system config has tustOrder=75 already. The user one will get trustOrder=80. (In reply to comment #5) It takes a while to get the steps correctly but it's working for me now. I'm using Bob's patch and keeping David's patch as well. You can try the scratch build at http://koji.fedoraproject.org/koji/taskinfo?taskID=2537298 I saved therm -f srpm is at http://fedorapeople.org/~emaldonado/SRPMS/ Created attachment 456771 [details]
script to reproduce the bug / verify fix
Created attachment 458213 [details]
script to reproduce/verify fix corrected
I'm able to reproduce the bug with this script. Fix verification failed with a build where the suggested patch had been applied.
Created attachment 458215 [details]
get the ca certificate here
PEM and DER formatted versions available, the script assumes you are using the DER one.
Hi Elio, I got "tstclnt: read from socket failed: Peer's Certificate has expired." as I told you on IRC. Did you try the reproducer again? Please use bombadil.infradead.org not twosheds.infradead.org. That's actually a public-facing server, not on my ADSL line. I tend to be a little better at keeping its certificates up to date... Created attachment 492165 [details] Patch for bz64134 as applied in RHEL 6.1 Comment on attachment 492165 [details] Patch for bz64134 as applied in RHEL 6.1 Somewhere else in the code trustOrder=100 is a default and notice the trustOrder changes > "module=\"NSS User database\" " > "parameters=\"configdir='sql:%s' %s tokenDescription='NSS user database'\" " >- "NSS=\"%sflags=internal%s\"", >+ "NSS=\"trustOrder=75 %sflags=internal%s\"", NSS User database gets trustOrder=75 > > "module=\"NSS system database\" " > "parameters=\"configdir='sql:%s' tokenDescription='NSS system database' %s\" " >- "NSS=\"%sflags=internal,critical\"",sysdb, readonly, nssflags); >+ "NSS=\"trustOrder=80 %sflags=internal,critical\"",sysdb, readonly, nssflags); and NSS system database get trustOrder=80 The lower value is preferred over the higher one and thus the user db trust order flags are preferred over the inherited trust flags from the system db as they should. Created attachment 492209 [details] Bug 60301 reproducer of relevance to this bug Comment on attachment 492209 [details] Bug 60301 reproducer of relevance to this bug Without attachment 492165 [details], what we applied for this one, bug 60301 fix verification fails. (In reply to comment #19) I meant to type bug 603101 I retested the fixes bug 603011 with this patch removed. The scratch build https://brewweb.devel.redhat.com/taskinfo?taskID=3257172 has the patches for this bug removed. I tested with it. Without the patch: [emaldona@rhel61tests ~]$ rpm -q nss nss-3.12.9-8.1.el6.nopatch11.2.x86_64 [emaldona@rhel61tests ~]$ pk12util -d sql:/home/emaldona/.pki/nssdb -i ~/startcomcert.p12 Enter password for PKCS12 file: pk12util: PKCS12 IMPORT SUCCESSFUL [emaldona@rhel61tests ~]$ pk12util -d sql:/etc/pki/nssdb -i ~/startcomcert.p12 Enter password for PKCS12 file: pk12util: PKCS12 decode import bags failed: Unable to import. Error attempting to import private key. After 'sudo yum distribution-synchronization' With the patch: [emaldona@rhel61tests ~]$ rpm -q nss nss-3.12.9-8.el6.x86_64 [emaldona@rhel61tests ~]$ pk12util -d sql:/etc/pki/nssdb -i ~/startcomcert.p12 Enter password for PKCS12 file: pk12util: PKCS12 IMPORT SUCCESSFUL An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0692.html |