Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step ca init using csr #717

Open
LecrisUT opened this issue Aug 9, 2022 · 5 comments
Open

step ca init using csr #717

LecrisUT opened this issue Aug 9, 2022 · 5 comments
Assignees
Milestone

Comments

@LecrisUT
Copy link
Contributor

LecrisUT commented Aug 9, 2022

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Similar to the current method of using --root and --key flags, it would be useful to have another option of --csr instead so that the certificate can be signed offline later. To make this work seamlessly, we would also need a step ca renew-ca (hopefully a better name) that simply copies/rekeys/request a new csr according to the current --ca-config if simple tests pass like if the certificate is valid, if it is signed by the root, etc.

Why is this needed?

As far I understand this would be equivalent with the current RA options, but more geared towards an offline root CA structure.

The latter part is useful regardless of the first part, but overall this can be useful for automated deployments like ansible where it would be best not to put all your eggs in a single basket, or if you want to manage multiple CAs, e.g. root CA belongs to a school and intermediates are managed by individual labs.

@LecrisUT LecrisUT added enhancement needs triage Waiting for discussion / prioritization by team labels Aug 9, 2022
@dopey dopey added this to the Backlog milestone Aug 10, 2022
@maraino
Copy link
Collaborator

maraino commented Aug 10, 2022

As I responded here, I prefer to add a --template flag to step ca init instead of signing the CSR as it is.

Regarding step ca renew-ca with a better name, I don't see that coming to the step ca command at any point soon because the CA would need the root key, and it is something that it does not have. At the same time some users, especially the ones using HSM do "ceremonies" for signing root or intermediate keys.

@LecrisUT
Copy link
Contributor Author

For this part, the first half of the problem is getting the necessary csr from step ca init. It is more intuitive to add it there, so that the user does not need to know 2 ways that they can start their own step-ca server. Plus this one also configures ca.json. How the signing is done to be an appropriate intermediate it's up to the user.

Creating the csr would be useful if the user does not have direct access to the root certificate keys and the root might not use the same engine. Like in my school/lab example, no lab has access to the school's root, but they can send csr to it to be signed at some point.

CA would need the root key

I am confused. Why does the CA need the root key? The current usage of --root --key only copies the root crt, but not the the key as far as I can see. step ca renew-ca would basically fill that missing step when the root key is not present, i.e. either make a csr request or copy a signed certificate bundle into production. Freeipa for example does exactly those steps for using an external ca

@maraino
Copy link
Collaborator

maraino commented Aug 11, 2022

Like in my school/lab example, no lab has access to the school's root, but they can send csr to it to be signed at some point.

For your school/lab example, a way to pass to step ca init a specific intermediate and key would be more useful. Right now, you can do that by replacing files.

I am confused. Why does the CA need the root key?

I understand that you wanted a command that will do an HTTP request to the CA to renew the intermediate. We can consider creating an endpoint that creates a CSR for the intermediate, but in that case, it won't renew the key, it gets way more complicated if you want to do that.

Pushing the signed intermediate might be more complicated, as it will require overwriting files, where permissions might be a problem, and that is without considering the authentication or a change in a configmap in k8s. I think for this, it makes more sense to use some mechanism to replace the file/configmap itself and HUP the server to reload the configuration.

@maraino maraino added the needs triage Waiting for discussion / prioritization by team label Aug 11, 2022
@LecrisUT
Copy link
Contributor Author

I understand that you wanted a command that will do an HTTP request to the CA to renew the intermediate.

There's a misunderstanding here. The flag would be in step ca init which runs offline. The idea is to use the same flags and prompts to generate the ca certificate, but have a csr generated to be later signed. And copied in.

Indeed we can simply copy the intermediate certificate, but it would be nice to have pre-checks, like is the intermediate signed by the root we want, is the time valid, etc.

I think for this, it makes more sense to use some mechanism to replace the file/configmap itself and HUP the server to reload the configuration.

👍 Just for clarity that would mean creating intermediate2.crt and changing the json to point to that right?

@maraino
Copy link
Collaborator

maraino commented Aug 15, 2022

There's a misunderstanding here. The flag would be in step ca init which runs offline. The idea is to use the same flags and prompts to generate the ca certificate, but have a csr generated to be later signed. And copied in.

Yes, there was a misunderstanding. And now the --csr flag makes more sense to me, so instead of creating a fully valid environment, it creates the same or a very similar ca.json, but writing a CSR on disk instead of a certificate. You take that CSR, you sign it somehow, and write it in the path present in the ca.json, or by your suggestion, that I misunderstood, using a command that edits the ca.json and verifies the signed intermediate is a valid one.

👍 Just for clarity that would mean creating intermediate2.crt and changing the json to point to that right?

Yes, but I meant to use some script outside of the scope of step-ca.

@maraino maraino modified the milestones: Backlog, v0.23.0 Aug 24, 2022
@maraino maraino modified the milestones: v0.23.0, v0.24.0 Nov 10, 2022
@maraino maraino modified the milestones: v0.24.0, v0.24.1 Apr 12, 2023
@maraino maraino modified the milestones: v0.24.4, v0.24.5 Jul 18, 2023
@maraino maraino modified the milestones: v0.25.0, v0.25.1 Sep 27, 2023
@hslatman hslatman modified the milestones: v0.25.1, v0.25.2 Nov 29, 2023
@hslatman hslatman modified the milestones: v0.25.2, v0.25.3 Feb 20, 2024
@hslatman hslatman modified the milestones: v0.26.0, v0.26.1 Mar 29, 2024
@hslatman hslatman modified the milestones: v0.26.1, v0.26.2 Apr 25, 2024
@hslatman hslatman removed this from the v0.26.2 milestone Jun 17, 2024
@hslatman hslatman added this to the v0.26.3 milestone Jun 17, 2024
@hslatman hslatman modified the milestones: v0.27.0, v0.27.2 Jul 15, 2024
@hslatman hslatman modified the milestones: v0.27.2, v0.27.3 Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants