Bug 1138803

Summary: Do not store host certificate in shared NSS database /etc/pki/nssdb
Product: Red Hat Enterprise Linux 7 Reporter: Martin Kosek <mkosek>
Component: ipaAssignee: Martin Kosek <mkosek>
Status: CLOSED ERRATA QA Contact: Namita Soman <nsoman>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.0CC: jpazdziora, mkosek, pvoborni, rcritten, spoore
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-4.1.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 10:13:48 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:

Description Martin Kosek 2014-09-05 16:15:59 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/4449

When investigating https://bugzilla.redhat.com/show_bug.cgi?id=1031055, I realized that this is not true and FreeIPA client installer generates host
machine identity certificate&key in a world readable directory (/etc/pki/nssdb).

This means, that any user authenticated on that machine can read both the
certificate and it's key.

While it is widely known ([https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/che-nsslib.html doc]) that this NSS database is shared and FreeIPA never encouraged using the host certificates for any authentication purposes, it still has a potential to become a security problem.

We should change host certificate database to some other, root owned database (e.g. /etc/ipa/nssdb/). We may even stop generating host certificates automatically given we do not use them (and only generate them when option is passed).

Question is what should we do with '''existing clients''' with these unusable host certificates. Backport of the fix for FreeIPA client for all supported 3.3.x and 4.0.x + revoking& re-keying the certificate during upgrade may be in place.

Comment 1 Martin Kosek 2014-09-05 16:17:28 UTC
Fixed upstream, cert is no longer generated.

ipa-4-0:
2dd2fd7e1aa470ea8fa3fd09ebecacec7ee8bc77 No longer generate a machine certificate on client installs

master:
c1bf5203937827369c7ce023d03c75d2da6d83ee No longer generate a machine certificate on client installs

ipa-4-1:
058c1f453c4e2df38eec57ba605cd5dc492eb978 No longer generate a machine certificate on client installs

Comment 2 Martin Kosek 2014-09-23 14:55:53 UTC
We would like to also have a switch to generate the certificate conditionally (in other, safer, location):

https://fedorahosted.org/freeipa/ticket/4550

Comment 5 Scott Poore 2015-01-13 02:29:12 UTC
Martin,

How can I test this?

Install IPA client and just confirm that there is no machine cert generated?  

Do I check that in /etc/pki/nssdb as the subject indicates or can I confirm with an ipa command?

Thanks,
Scott

Comment 6 Scott Poore 2015-01-13 17:39:56 UTC
I found it.

Reproducing with Certificate still being created on RHEL7.0 IPA client:

[root@rhel7-4 ~]# certutil -d /etc/pki/nssdb/ -L

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

IPA CA                                                       CT,C,C
IPA Machine Certificate - rhel7-4.example.com                u,u,u

[root@rhel7-4 ~]# ipa host-show $(hostname)
  Host name: rhel7-4.example.com
  Certificate: MIIEETCCAvmgAwIBAgIBCzANBgkqhkiG9w0BAQsFADA2MRQwEgYDVQQKEwtFWEFNUExFLkNPTTEeMBwGA1UEAxMVQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTE1MDExMzE3MzMzMFoXDTE3MDExMzE3MzMzMFowNDEUMBIGA1UEChMLRVhBTVBMRS5DT00xHDAaBgNVBAMTE3JoZWw3LTQuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYi8LmPvnPmkO724eQpblkuRg/qypUunMPjmxf2GHqG7oOuGaevhSoJgp74viHpJqkkzSTfJOVX6AE7CbxXorjFl4QjvwKsiIRWNYiu6zYJdyGJ9QtgXcRn8EuM5QpInOibqh3osnjmTCe4w9a8w8RnP0KjWQuETFbvozuGITv3z4F9h4XOrbNob470HzjznJpx4+YEyMM7MEpVF1fvUrDCdkGy7x956O+2LZ35Iz4aMXrvuStqyI1hzLlpEpbSSofavU+LeD3GOEziCyzS+KDJuE5NRrQZrr2b9qB0tS591QqXgKfXriHCU9emF1wxlmTqSzFf1wJKhTPKoj9Dp4dAgMBAAGjggEqMIIBJjAfBgNVHSMEGDAWgBQ5+iMVHZXoZXXTRPMgutsh2YWKjTA9BggrBgEFBQcBAQQxMC8wLQYIKwYBBQUHMAGGIWh0dHA6Ly9pcGEtY2EuZXhhbXBsZS5jb20vY2Evb2NzcDAOBgNVHQ8BAf8EBAMCBPAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMHYGA1UdHwRvMG0wa6AzoDGGL2h0dHA6Ly9pcGEtY2EuZXhhbXBsZS5jb20vaXBhL2NybC9NYXN0ZXJDUkwuYmluojSkMjAwMQ4wDAYDVQQKEwVpcGFjYTEeMBwGA1UEAxMVQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB0GA1UdDgQWBBT11s7kN/2EcGicXQZidgGagMcxvDANBgkqhkiG9w0BAQsFAAOCAQEAUN2w4eEXl3RdbALAOfvuNU2LHqlASkyblc/cvX28raCVHO8O0hSmzWEt9IGZGuGjD4ZewA548Ah80Dy6wVFt19umVOeghaAevITDwWIidx15p5rcIvQ595yWbRQnnlZZpMXx8aVo9lmI7AzEdjQYfJSlkpDUW8igqdwsw/pwl25zHxBlqvPC93P31ZBpIjo+qfxWh2UIhnu4D8Tc1ZkUKdaf3iV0LGQcoA9NCl1Xm3Q3beObIk60KyJA9IrnAYvy0tL9YG4rKgGz0maN4HgbX4yizLNdLq0kCqqEzntv7OU1Ukof4iJ22pj1X5LHZigS9oZAI0JBvTbQcK92+7ivQg==
  Principal name: host/rhel7-4.example.com
  Password: False
  Keytab: True
  Managed by: rhel7-4.example.com
  Subject: CN=rhel7-4.example.com,O=EXAMPLE.COM
  Serial Number: 11
  Serial Number (hex): 0xB
  Issuer: CN=Certificate Authority,O=EXAMPLE.COM
  Not Before: Tue Jan 13 17:33:30 2015 UTC
  Not After: Fri Jan 13 17:33:30 2017 UTC
  Fingerprint (MD5): 42:f1:7f:4b:ad:a3:18:6e:77:bd:df:70:cb:98:20:54
  Fingerprint (SHA1): f6:47:9b:8d:ea:dc:db:f2:0d:e3:1d:4e:0a:db:d4:8a:76:44:0a:92
  SSH public key fingerprint: 09:08:0E:9C:B1:31:B4:9C:BA:9A:CB:A4:C7:59:38:C0 (ecdsa-sha2-nistp256),
                              3B:1D:A4:75:73:86:11:35:51:0D:2A:B6:18:17:0B:C8 (ssh-rsa)

So, I'll use that to verify.

Comment 7 Scott Poore 2015-01-13 17:41:39 UTC
Verified.

Version ::

ipa-client-4.1.0-13.el7.x86_64

Results ::

[root@rhel7-2 ~]# certutil -d /etc/pki/nssdb/ -L|grep -i "Machine Certificate"
[root@rhel7-2 ~]# ipa host-show $(hostname)|grep Certificate
[root@rhel7-2 ~]# 

To show more details if needed later:

[root@rhel7-2 ~]# certutil -d /etc/pki/nssdb/ -L

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

EXAMPLE.COM IPA CA                                           CT,C,C
[root@rhel7-2 ~]# ipa host-show $(hostname)
  Host name: rhel7-2.example.com
  Principal name: host/rhel7-2.example.com
  Password: False
  Keytab: True
  Managed by: rhel7-2.example.com
  SSH public key fingerprint: 0E:C1:22:91:A9:FA:FE:3D:30:08:E2:D9:1E:7B:4E:03 (ecdsa-sha2-nistp256),
                              DA:8E:6E:A3:9C:28:65:51:A2:CF:3C:E3:59:F0:24:9E (ssh-rsa),
                              B6:BC:17:52:E8:FD:43:5D:A8:32:D0:BC:F7:7E:54:C0 (ssh-ed25519)

So, no machine certificate is shown for new clients.

Comment 9 errata-xmlrpc 2015-03-05 10:13:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0442.html