-
Notifications
You must be signed in to change notification settings - Fork 67
feat: tedge cert create-key
command
#3709
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
7d44718
to
c2e2aa1
Compare
c2e2aa1
to
993fd82
Compare
993fd82
to
64f3a6b
Compare
64f3a6b
to
525651b
Compare
3025528
to
c638b40
Compare
Robot Results
|
c638b40
to
c3959cd
Compare
c3959cd
to
e099533
Compare
e099533
to
fef773e
Compare
25fe73f
to
629ccbe
Compare
5371ba9
to
048f3f3
Compare
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
048f3f3
to
799e0c1
Compare
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
799e0c1
to
1e2357f
Compare
c8y | ||
az | ||
aws |
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.
I don't understand the purpose of this sub-command. To create a key, one only needs to interact with the HSM not the cloud. Am I missing something?
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.
Analogous to tedge cert create c8y/az/aws
which changes the path of the certificate (if default settings are changed), these subcommands just read device.key_uri
from under [c8y]
/[az]
/[aws]
tables. Will add help text to make it more clear.
docs/src/references/hsm-support.md
Outdated
|
||
The command also creates a CSR at `device.csr_path`, which should be used when requesting a new certificate. | ||
|
||
4. Change the `device.key_uri` setting to point to the new private key. This is most easily done by |
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.
Do we really have to set device.key_uri
twice? First before creating a key and then once created?
This sounds as two independent settings conflated into one.
docs/src/references/hsm-support.md
Outdated
Options: | ||
--config-dir <CONFIG_DIR> [env: TEDGE_CONFIG_DIR, default: /etc/tedge] | ||
--label <LABEL> |
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.
What is this?
docs/src/references/hsm-support.md
Outdated
Example: | ||
|
||
```title="Previous URI" | ||
pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=83f9cf49039c051a;token=c8y%20token;id=%02;object=azure%20keypair;type=private | ||
``` | ||
|
||
```title="New URI" | ||
pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=83f9cf49039c051a;token=c8y%20token;object=my-key | ||
``` |
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.
I don't understand what I have to do here.
Execute Command systemctl stop tedge-p11-server tedge-p11-server.socket | ||
Command Should Fail With | ||
... tedge cert renew c8y | ||
... error=Failed to connect to tedge-p11-server UNIX socket at '/run/tedge-p11-server/tedge-p11-server.sock' | ||
|
||
Execute Command systemctl start tedge-p11-server.socket | ||
|
||
Execute Command cmd=tedge config set c8y.device.key_uri pkcs11:object=nonexistent_key | ||
Command Should Fail With | ||
... tedge cert renew c8y | ||
... error=PKCS #11 service failed: Failed to find a key | ||
Execute Command cmd=tedge config unset c8y.device.key_uri |
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.
Why have these checks been removed? They sound as still meaningful.
eprintln!("Insert this as a new value of device.key_uri:"); | ||
eprintln!("{}", key.uri); |
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.
Is there a reason not to set device.key_uri
on behalf of the user?
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
TODO
figure out whyadded to module documentationp11tool
sometimes doesn't print curve ids of EC keystedge cert download
Follow-up
Proposed changes
Implements a
tedge cert create-key
command that can be used to create a private key on a PKCS11 token without additional tools.tedge cert create-key
generates the new keypair on the PKCS11 token and prints the URI of the newly created keypair. The user then needs to put this URI as theirdevice.key_uri
setting to use the key:Types of changes
Paste Link to the issue
#3665
Checklist
just prepare-dev
once)just format
as mentioned in CODING_GUIDELINESjust check
as mentioned in CODING_GUIDELINESFurther comments