-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix ed25519 generated SSH key marshalling #14101
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This adds a test to ensure that we can issue leaf SSH certificates using the newly generated SSH CA keys. Presently this fails because the ed25519 key private is stored using PKIX's PKCS8 PrivateKey object format rather than using OpenSSH's desired private key format: > path_config_ca_test.go:211: bad case 12: err: failed to parse stored CA private key: ssh: invalid openssh private key format, resp: <nil> Signed-off-by: Alexander Scheel <[email protected]>
As mentioned in various terraform-provider-tls discussions, OpenSSH doesn't understand the standard OpenSSL/PKIX ed25519 key structure (as generated by PKCS8 marshalling). Instead, we need to place it into the OpenSSH RFC 8709 format. As mentioned in this dependency's README, support in golang.org/x/crypto/ssh is presently lacking for this. When the associated CL is merged, we should be able to remove this dep and rely on the (extended) standard library, however, no review progress appears to have been made since the CL was opened by the author. See also: https://go-review.googlesource.com/c/crypto/+/218620/ Signed-off-by: Alexander Scheel <[email protected]>
cipherboy
force-pushed
the
cipherboy-issue-from-generated
branch
from
February 16, 2022 16:42
44989b6
to
c9ef972
Compare
schultz-is
approved these changes
Feb 16, 2022
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.
lgtm
Thanks @schultz-is! |
@@ -306,6 +306,7 @@ require ( | |||
github.com/mattn/go-isatty v0.0.14 // indirect | |||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect | |||
github.com/miekg/dns v1.1.41 // indirect | |||
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a // indirect |
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.
nit: This is a direct dependency so running go mod tidy will force a change in the future?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the generation test to ensure that, for each generated CA key type, we can sign certificates with this key pair. This ensures that they're stored in a format understood by
golang.org/x/crypto/ssh
.Notably, this caught a bug in the Ed25519 key handling: OpenSSH (and
golang.org/x/crypto/ssh
) do not understand the PKCS8 PrivateKey structure we were using. As mentioned in an internal RFC (TF 461), and with investigation from aterraform-provider-tls
PR author, it appears that usingedkey
is the best approach.As this feature hasn't been released, we shouldn't need a changelog entry for it.