It was discovered that ipa-kra-install puts the CA agent certificate and private key to a world readable file, /etc/httpd/alias/kra-agent.pem. This allows users on an IPA server where ipa-kra-install was run to issue arbitrary certificates with the IPA CA.
The ipa-kra-install script configures the KRA subsystem of Dogtag, which is used for the Password Vault feature of IPA. During the configuration process, a KRA agent user account is created in Dogtag, which is used by IPA to authenticate to the KRA. Currently the KRA agent uses the same certificate and private key as the CA agent, which IPA uses to authenticate to the CA.
The kra-agent.pem file is necessary because the Dogtag client Python library does not support using a certificate and private key from a NSS database for authentication, so it is not possible to use the CA agent certificate and private key directly from their primary location, which is the NSS database at /etc/httpd/alias.
This issue did not affect the versions of ipa as shipped with Red Hat Enterprise Linux 6 and 7 as they did not include the affected KRA subsystem.
This issue was discovered by Jan Cholasta of Red Hat.
Created attachment 1075455 [details]
See attachment for a patch fixing the issue.
Created attachment 1075511 [details]
Found a copy & paste issue in the patch, updated patch attached.
The updated patch works for me, ACK.
Patch looks good to me.
Just to explicitly confirm, do the upgrade.py part of the patch take care of automatically fixing existing installations that already have the file with bad permissions? I see ipa-server's %posttrans runs ipa-server-upgrade. Is no manual action required after that?
Yes, upgrade will fix permissions on file, no manual action is needed.
Affected functionality was introduced in IPA 4.2. Therefore, this issue did not affect IPA versions as shipped with Red Hat Enterprise Linux 6 and 7. The new IPA 4.2 is part of Red Hat Enterprise Linux 7.2 Beta and it is planned to be addressed before the final release of Red Hat Enterprise Linux 7.2.
Actually, the certificate is not revoked during the upgrade, so anyone with a copy of kra-agent.pem can still authenticate with it after the upgrade. To prevent this, the private key and certificate must be manually replaced after the upgrade.
No released Red Hat Enterprise Linux or Fedora version was affected by this flaw.
Fixed upstream in version 4.2.2: