smallstep / certificates

🛡️ A private certificate authority (X.509 & SSH) & ACME server for secure automated certificate management, so you can use TLS everywhere & SSO for SSH.
https://smallstep.com/certificates
Apache License 2.0
6.58k stars 429 forks source link

Detailed Steps to implements CRL logic ? #1423

Open sc-sityad opened 1 year ago

sc-sityad commented 1 year ago

Discussed in https://github.com/smallstep/certificates/discussions/1422

Originally posted by **sc-sityad** June 7, 2023 - How to get CRL http URL to store the ca.url. I followed all the steps mentioned in ENABLE ACTIVE REVOCATION ON YOUR INTERMEDIATE CA. - I have enable the crl in ca.json `"crl": { "enabled": true, "generateOnRevoke": true }` - I create a certificate using root_ca.crt using following command `step ca certificate emqx emqx.crt emqx.key --kty RSA`. - Now I want to revoke it using comand. `step ca revoke --cert emqx.crt --key emqx.key`. - The certificate is revoked but how the CRLs is updated in this case, I am not able to understand. - What is the use of index.txt, Do I have to manually add the revoked data in that file? - How the whole CRL support works in this case?
maraino commented 1 year ago

We need to add docs for this. I can give you some points, but where are the steps you mention?

sc-sityad commented 1 year ago

hi @maraino

hslatman commented 1 year ago

@sc-sityad yes, that's the usual configuration. Using that, the issued leaf certificate will contain the IDP url in the template, so that a system looking to verify the CRL can look it up where it's hosted by the CA. It's configurable, because there's also ways to host the CRL in a different location, not hosted by the CA itself.

I noticed you also asked about the CRL being available on HTTP instead of HTTPS, but removed that part of the question. I assume you found the "insecureAddress" setting, which will make it become available on HTTP?

sc-sityad commented 1 year ago

Yes, I got that.

hslatman commented 1 year ago

Yes, I got that.

* If I want to use the CRL hosted by the CA. It is safe and secure right.

It's OK to let the CA host it.

* If I want to host the CRL in different location like `http://localhost:80/crl`. So I need to change the only IDP url right? or I have to some change more in ca.json or template.leaf etc other than IDP.

If you want to change the IDP URL, you'll need to ensure that its address resolves to the host the CA is running on, as well as for the path to match the endpoint the CA (or another system) hosts the CRL. You'll need to ensure the value matches what ends up in the leaf certificate, as mentioned before.

* When I run this `step crl inspect --insecure http://localhost:80/crl` I got 404 error because there is nothing on this path. How do I initialise the crl file in der format so that I put the crl.der file in path and get started.

Did you already revoke a certificate? If not, the file does not exist.

* After changing the IDP url I still ge the revoked status in `https://localhost:8081/1.0/crl` hosted by the CA. I want the status in new url.

The IDP URL ends up being recorded in the CRL. It doensn't change where the CRL is hosted. If you let the CA host it, it has to match the existing CRL endpoint /1.0/crl and has to resolve to the CA host.

sc-sityad commented 1 year ago

Ok thanks I will use the CRL hosted by the CA.

sc-sityad commented 1 year ago

Hi, @hslatman If I want to clear the CRL revoked certificate list how can I do that. The CRL url is https://localhost:8081/1.0/crl ?

maraino commented 1 year ago

The revoked certificates will automatically disappear when they expire, and the crl is regenerated. Removing it from the database without destroying it is possible but it is "hard", you might need to make a program for it.

sc-sityad commented 1 year ago

@maraino

hslatman commented 1 year ago

@sc-sityad did you run step ca bootstrap (--install) on the server you're running that command? It sounds like the root isn't trusted on the system you're checking the CRL from.

You can also configure the CA to serve the CRL on an HTTP endpoint through the insecureAddress. That way you won't have issues with HTTPS when requesting the CRL.

sc-sityad commented 1 year ago

Yes, now its working But I want to know one thing I have installed step-ca, step on dev server, the link is https://{dev-ip}:8585/1.0/crl and I want to use the CRL link in uat server while running mqtt broker. I am not able to access this crl link from UAT server.

hslatman commented 1 year ago

@sc-sityad you'll need to install step on your UAT server too, and do step ca bootstrap (--install) there too for the CA root to be trusted. With --install, the root gets trusted by other tools on the system that use the system roots as their trust bundle.

Besides that, you'll need to ensure that the CA can be reached from the other machine(s) too. That means the port must be open, the UAT server must have a route to the network, etc.

If you need a strict separation of "trust domains" for your dev vs. UAT environment, then you may want to run another CA for your UAT environment (assuming you're referring to UAT as user acceptance testing).

rk-c commented 7 months ago

I'm not sure that I fully understand. The Documentation says: "step-ca does not currently support active revocation mechanisms like a Certificate Revocation List (CRL)" Do I understand correctly that the active revocation is supported?

Bartosz-lab commented 2 months ago

Hi, I see that the endpoint https://<ca-url>/1.0/crl uses the HTTPS protocol, but as far as I know, the recommended practice is to use HTTP for CRL lists.

Edit: I found the insecureAddress config option in config/ca.json, which serves that endpoint over HTTP.

hslatman commented 2 months ago

I'm not sure that I fully understand. The Documentation says: "step-ca does not currently support active revocation mechanisms like a Certificate Revocation List (CRL)" Do I understand correctly that the active revocation is supported?

Yes, it's supported and contributed by the community.