pki-bot / pki-issues-final

0 stars 0 forks source link

agent cert not from local CA, LDAP error 32, but can issue cert while revoke fails PKIException: Record not found and HTTP 500 error #2650

Open pki-bot opened 4 years ago

pki-bot commented 4 years ago

This issue was migrated from Pagure Issue #3101. Originally filed by msauton (@msauton) on 2019-05-14 16:34:20:


This is a "corner case", was not designed for this use case, but there is a need for more validity check on agent's LDAP certificate record during authorization for various operations, example with inconsistent issuance and revocation:

Scenario:

note the LDAP error 32 / no such object during authorization, on the entry cn=1026,ou=certificateRepository,ou=ca,o=rootca1-CA and the continuing issuance process.

details, see attachment "test1"

the error message "PKIException: Record not found" is confusing because it does not apply to the certificate I tried to revoke, it seem to apply to the agent cert LDAP record, cn=1026,ou=certificateRepository,ou=ca,o=rootca1-CA , that do not exist on "rootca1" in this scenario,

pki -U https://ca1.example.test:7443/ca -d ${nssdir} -C ${nssdir}/pwdfile.txt -n subca1useragent1 ca-cert-hold 0xc Placing certificate on-hold: Serial Number: 0xc Subject DN: UID=rootca1user1 Issuer DN: CN=CA Signing Certificate,OU=rootca1,O=Root CA Example Corp 7 Status: VALID Not Valid Before: Sun Apr 28 18:39:26 UTC 2019 Not Valid After: Fri Oct 25 18:39:26 UTC 2019 Are you sure (Y/N)? y PKIException: Record not found

==> /var/log/pki/rootca1/localhost_access_log.2019-04-28.txt <== 192.168.122.66 - subca1agentuser1 [28/Apr/2019:18:52:41 +0000] "GET /ca/rest/account/login HTTP/1.1" 200 203 192.168.122.66 - subca1agentuser1 [28/Apr/2019:18:52:41 +0000] "GET /ca/rest/agent/certs/12 HTTP/1.1" 200 9450 192.168.122.66 - subca1agentuser1 [28/Apr/2019:18:52:45 +0000] "POST /ca/rest/agent/certs/12/revoke HTTP/1.1" 500 209

details, see attachment "test2"

pki-bot commented 4 years ago

Comment from msauton (@msauton) at 2019-05-14 16:36:33

test1 on rootca1 - agent subca1agentuser1 successfully issue a user certificate

pki-bot commented 4 years ago

Comment from msauton (@msauton) at 2019-05-14 16:36:33

Metadata Update from @msauton:

pki-bot commented 4 years ago

Comment from msauton (@msauton) at 2019-05-14 16:38:48

test2 on rootca1 - the same agent subca1agentuser1 fails to revoke the user certificate that was just issued

pki-bot commented 4 years ago

Comment from msauton (@msauton) at 2019-05-14 17:00:54

bz 1710094 - agent cert not from local CA, LDAP error 32, but can issue cert while revoke fails PKIException: Record not found and HTTP 500 error https://bugzilla.redhat.com/show_bug.cgi?id=1710094

pki-bot commented 4 years ago

Comment from cfu (@cfu) at 2020-03-13 19:29:23

Question. does this behavior only happen with pki cli commands, or do you observe the same behavior if they (the agent cert issuance approval as well as revocation) were done from the UI?