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

Implement device-attestations for yubikeys #741

Merged
merged 19 commits into from
Sep 13, 2022
Merged

Conversation

maraino
Copy link
Collaborator

@maraino maraino commented Aug 30, 2022

Description

Currently the yubikey KMS implements the attestation interface, this experimental commit uses that interface to request a certificate using ACME with the device-attest-01 challenge.

Currently the kms yubikey implements the attestation interface,
this experimental commit uses that interface to request a certificate
using ACME with the device-attest-01 challenge.
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Aug 30, 2022
@maraino maraino marked this pull request as ready for review September 9, 2022 01:10
Base automatically changed from acme-challenge to master September 9, 2022 01:28
Copy link
Member

@hslatman hslatman left a comment

Choose a reason for hiding this comment

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

Changes and refactoring look good. I'll have another look at it when integrating with my work.

@@ -16,6 +16,11 @@ import (
"go.step.sm/crypto/pemutil"
)

type Attestor interface {
crypto.Signer
Copy link
Member

Choose a reason for hiding this comment

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

Embedding this interface could be an issue for a TPM EK, but I'll have to check out its usage.

@@ -193,6 +203,7 @@ func serveAndValidateHTTPChallenge(ctx *cli.Context, ac *ca.ACMEClient, ch *acme
}

func authorizeOrder(ctx *cli.Context, ac *ca.ACMEClient, o *acme.Order) error {
attest := (ctx.String("attest") != "")
Copy link
Member

Choose a reason for hiding this comment

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

This can probably be done with ctx.IsSet("attest") instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What I don't like about that is that they are not equivalent. You get IsSet set to true if you do --attest ""

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call this variable isAttest or something to indicate that it's a boolean? Normally I wouldn't mind, but the flag input is a string and we're not consistent about how we use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed with 377194e

@@ -33,6 +38,12 @@ func CreateSigner(kms, name string, opts ...pemutil.Options) (crypto.Signer, err
return newKMSSigner(kms, name)
}

// CreateAttestor creates an attestor that will use `step-kms-plugin` with the
// given kms and uri.
Copy link
Member

Choose a reason for hiding this comment

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

It says given kms and uri, but it takes a kms and name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed with 6ad024e

if err != nil {
return errors.WithStack(err)
}
ui.PrintSelected("Private Key", keyFile)
Copy link
Member

Choose a reason for hiding this comment

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

It may be an option to indicate that the private key is created and stored in the KMS for the attestation flow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed with 9a45100

@maraino maraino requested a review from dopey September 13, 2022 00:28
@@ -398,6 +398,11 @@ flag exists so it can be configured in $STEPPATH/config/defaults.json.`,
Name: "kms",
Usage: "The <uri> to configure a Cloud KMS or an HSM.",
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Is attest descriptive enough? Should it be something like attestation-uri?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed with 4fc5893

@@ -16,6 +16,13 @@ import (
"go.step.sm/crypto/pemutil"
)

// Attestor is the interface implemented by step-kms-plugin using the key, sign
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Attestor is the interface implemented by step-kms-plugin using the key, sign
// Attestor is the interface implemented by step-kms-plugin using the key, sign,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed with 389fef8

Copy link
Contributor

@dopey dopey left a comment

Choose a reason for hiding this comment

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

lgtm

@maraino maraino removed the request for review from hslatman September 13, 2022 18:01
@maraino maraino merged commit a03cf45 into master Sep 13, 2022
@maraino maraino deleted the device-attestation branch September 13, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants