-
Notifications
You must be signed in to change notification settings - Fork 268
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
Add support for creating API tokens backed by KMS signer (WIP) #1399
base: master
Are you sure you want to change the base?
Conversation
4f46e13
to
064866f
Compare
52d9a4b
to
cd18588
Compare
a71ac72
to
8a7cd1b
Compare
39ea27c
to
e53225b
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.
Just a couple of minor things
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.
Can we add a test that compares this with the one in the standard library?
func createClientCertificate(crtFile, keyFile, passwordFile, tpmDevice string) (*tls.Certificate, error) { | ||
certs, err := pemutil.ReadCertificateBundle(crtFile) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed reading %q: %w", crtFile, err) |
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.
Pemutil already returns a wrapped error, if we wrap it again, we will get:
failed reading "foo.crt": error parsing foo.crt: open foo.crt: no such file or directory
If we want a nicer message, we can fix crypto or use something like:
func maybeUnwrap(err error) error {
if wrapped := errors.Unwrap(err); wrapped != nil {
return wrapped
}
return err
}
// options, such as specifying the TPM device that backs the TSS2 | ||
// signer. | ||
p, _ := pem.Decode(b) | ||
if p.Type != "TSS2 PRIVATE 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've just added this smallstep/crypto#743 to avoid this condition.
This PR:
--password-file
flag.User-Agent
andX-Request-Id
HTTP request headers.Using an ECDSA key:
Using an RSA key:
Using the TSS2 PEM encoded private key (exported using
step tpm key get 'test-rsa' --device '/path/to/tpmsimulator.sock' --storage-directory /path/to/tpmstorage --tss2 > tpmrsa.tss2.pem
), specified as atpmkms
URI:Using the same TSS2 PEM encoded private key directly:
Note that the
device
andtpm-device
flags and URI parts can be omitted in case the default system TPM locations are to be used. The use of a TPM simulator is just for demonstration and testing purposes.