On Fedora 34 and any earlier version with systemd-wide certificate store, when uninstalling IPA server, /etc/ipa/ca.crt is still left intact. It is also left intact in the system-wide store.
/etc/ipa/ca.crt
This makes reinstalling on the same machine impossible because directory server configuration will fail:
.... [24/28]: importing IPA certificate profiles [25/28]: adding default CA ACL [26/28]: adding 'ipa' CA entry [27/28]: configuring certmonger renewal for lightweight CAs [28/28]: deploying ACME service Done configuring certificate server (pki-tomcatd). Configuring directory server (dirsrv) [1/3]: configuring TLS for DS instance [error] CalledProcessError: CalledProcessError(Command ['/usr/bin/certutil', '-d', 'sql:/etc/dirsrv/slapd-IPA2-TEST/', '-A', '-n', 'IPA2.TEST IPA CA', '-t', 'CT,C,C', '-a', '-f', '/etc/dirsrv/slapd-IPA2-TEST/pwdfile.txt'] returned non-zero exit status 255: 'certutil: could not decode certificate: SEC_ERROR_REUSED_ISSUER_AND_SERIAL: You are attempting to import a cert with the same issuer/serial as an existing cert, but that is not the same cert.\n') CalledProcessError(Command ['/usr/bin/certutil', '-d', 'sql:/etc/dirsrv/slapd-IPA2-TEST/', '-A', '-n', 'IPA2.TEST IPA CA', '-t', 'CT,C,C', '-a', '-f', '/etc/dirsrv/slapd-IPA2-TEST/pwdfile.txt'] returned non-zero exit status 255: 'certutil: could not decode certificate: SEC_ERROR_REUSED_ISSUER_AND_SERIAL: You are attempting to import a cert with the same issuer/serial as an existing cert, but that is not the same cert.\n') The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
The reason for that is the fact that NSS database automatically imports system-wide store which still has old IPA CA certificate in it. Removing /etc/ipa/ca.crt and re-running update-ca-trust is enough to get rid of it.
update-ca-trust
I think we should add this step for uninstaller on the platforms where update-ca-trust does exist.
Hi, I've tried to reproduce this in Fedora 33 and 34 and the uninstaller seems to remove the cert just fine. Could you please add more info on how to reproduce the bug? This task: https://github.com/freeipa/freeipa/blob/master/ipaplatform/redhat/tasks.py#L289 seems to run during the uninstall process.
Try to install/reinstall several times. I can see that we call tasks.platform_remove_ca_certs in the client uninstall code unconditionally but it looks like there are situations when this code is not really updating the system-wide CA store because I got this reproduced in F33/34 and RHEL 8. Not on every reinstall but often enough.
tasks.platform_remove_ca_certs
master:
ipa-4-9:
ipa-4-8:
Metadata Update from @rcritten: - Issue assigned to antorres - Issue priority set to: normal
I see the PRs have merged, can we close this?
Not sure we can close this. The commits added tests to check that the server creates/deletes cert on install/uninstall, but I wasn't able to reproduce the bug itself.
The CA cert is removed as one of the very last things in the client uninstaller. If the client has no remaining state but that file exists then it won't be removed no matter how many times you re-run --uninstall. A couple of random ideas, all of which could be terrible: