-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat(cert): Create a Certificate signing request using tedge cert create-csr
#2783
feat(cert): Create a Certificate signing request using tedge cert create-csr
#2783
Conversation
Robot Results
|
tedge cert create-csr
tedge cert create-csr
tedge cert create-csr
tedge cert create-csr
bfc81b5
to
2da805b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
@didier-wenzek Do you think it would make sense if there was also an option to override where to write the csr file to? Reasoning is that the CSR is generally something that has to be triggered by another system (e.g. service which is doing the request to a PKI API and the service needs to know how to access the resulting csr file...and having to do a For example: tedge cert csr --output-file ./mycsr Or even writing the csr to stdout? tedge cert csr > ./mycsr |
2da805b
to
09da45c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this will be used by users, can you please add a system test?
Example test cases:
- Generate CSR using the device-id from an existing certificate
- Generate CSR without an existing certificate (requiring the user to specify the --device-id option)
You can validate the CSR by using openssl to makes sure it is valid and that it is generated from the expected private key.
Why not. That said, to interact with a CA what we provide now might not be enough to get a device certificate and is definitely not enough to get certificates for local entities. Indeed, we will have to provide not only a CN, but also critical infos (Subject, Subject Alternative Name, Key Usage, Extended Key Usage). So we will also need to provide a CSR template on the command line as well as template examples for each kind of entity (the main device, the MQTT broker, tedge_agent, tedge_mapper, child devices ...). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working fine as described. However, can you share the on-disk writing logic between the commands to create a self-signed certificate and a CSR. Indeed, this logic contains several security-critical steps that is would be better keep in one place.
9741869
to
1325858
Compare
1838407
to
228a934
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Thank you.
73a803d
to
ead7c12
Compare
tests/RobotFramework/tests/tedge/certificate_signing_request.robot
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a few minor points to address (mostly usability things)
a49ecaa
to
281fe69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Nice addition
Signed-off-by: Krzysztof Piotrowski <[email protected]>
…quest Signed-off-by: Krzysztof Piotrowski <[email protected]>
Signed-off-by: Krzysztof Piotrowski <[email protected]>
Signed-off-by: Krzysztof Piotrowski <[email protected]>
Signed-off-by: Krzysztof Piotrowski <[email protected]>
Signed-off-by: Krzysztof Piotrowski <[email protected]>
281fe69
to
1395167
Compare
Proposed changes
This PR is introducing new
tedge cert
command:create-csr
along with new config optiondevice.csr_path
. This allow to create a certificate signing request which later can be used to create device certificate using CA. The Syntax for the command is following:Command will reuse existing public certificate to use its
CommonName
.Moreover, the command will reuse private key if it already exists. Same goes for
tedge cert create
.Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments