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

Use private_key parameter when creating certificate #186

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

vasilevalex
Copy link
Contributor

Pull Request (PR) description

Use private key created before, not the default value.

This Pull Request (PR) fixes the following issues

Fixes #185

Copy link
Member

@kenyon kenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we need more test coverage too, since this was broken and no tests failed.

@zilchms
Copy link
Contributor

zilchms commented May 3, 2024

I am still not sure if we want to allow direct private key passing into the certificate. CSRs exist for exactly this reason. The regression for no longer allowing directly passing keys into certs and using CSRs instead was made specifically for this reason.

To be clear: I am not against allowing passing the private key directly, I just would like to get a good reason to do so

I may also be completely wrong here, been a while since I made those changes

@vasilevalex
Copy link
Contributor Author

In the simplest case without CA we need some private key to sign the certificate. So openssl is invokeg with -signkey:

options << ['-signkey', resource[:private_key]]

with the private key as parameter. And if we don't pass the private key generated earlier, default value would be used.

@fmichea
Copy link

fmichea commented Jun 16, 2024

From @zilchms : I am still not sure if we want to allow direct private key passing into the certificate. CSRs exist for exactly this reason. The regression for no longer allowing directly passing keys into certs and using CSRs instead was made specifically for this reason.

Just hit this issue as well, I'm a bit of two minds on this. On one hand this bug currently prevents using the key/csr/cert parameters in order to control their naming convention. Plus if these parameters are not used, then the key is indeed passed to the certificate for signing anyway, with the correct name this time so no failure happens. So in the current state of things it doesn't appear to me that this fix should necessarily be blocked short term.

On the other hand I take your point about CSR, and for those that use a CA to then sign the certificates, maybe the right solution would be to allow creating the CNF + KEY + CSR without the certificate, and let that be generated by the CA?

At least in my setup I am working on, I get the certificate because its generated by default, but I dont use it and instead create signed versions from the CSR and my CA to then be uploaded. I could totally use an option to turn of cert generation off since those files are not necessary to me.

Any thoughts?

@ashish1099
Copy link

any update on how we go ahead, I just hit the same issue

@yakatz
Copy link

yakatz commented Jul 17, 2024

It looks like the PR needs a rebase. Running through the comments very quickly, I don't see any objections, so once it can be cleanly merged, we should be able to do so.

@yakatz
Copy link

yakatz commented Jul 17, 2024

Actually, @zilchms might be opposed. Can you clarify?

@zilchms
Copy link
Contributor

zilchms commented Jul 18, 2024

No further objections, feel free to merge after rebasing and passing CI :) At some point I will write some tests and refactor a bit of this module, so bugs/regressions like this dont sneak in unnoticed/without discussion beforehand

@vasilevalex vasilevalex force-pushed the key_fix branch 2 times, most recently from 5736075 to d16ded6 Compare July 18, 2024 09:57
@vasilevalex
Copy link
Contributor Author

Rebased and passed CI

@ekohl
Copy link
Member

ekohl commented Jul 18, 2024

@vasilevalex sorry, but we've been working on this module today and that introduced another merge conflict. Good news is that we should have acceptance tests now so it should be easier to add an acceptance test to it.

@ekohl ekohl added the bug Something isn't working label Jul 18, 2024
@ekohl
Copy link
Member

ekohl commented Jul 18, 2024

I took the liberty to rebase your PR.

@bastelfreak bastelfreak merged commit 6075567 into voxpupuli:master Jul 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] TLS certificate can't be created if the directory for private key is specified
8 participants