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

node: add amazon kms and benchmark signers (old) #4148

Conversation

pleasew8t
Copy link
Contributor

Amazon KMS Guardian Signer

This PR adds an Amazon AWS KMS Guardian signer, allowing observations to be signed using KMS! The new signer can be used by specifying the ARN of the KMS key to use, through the --guardianSignerUri commandline argument, as follows:

  • --guardianSignerUri=amazonkms://<ARN>

NOTE For the best possible performance, it is recommended that the Guardian be run from an EC2 instance that is in the same region as the KMS key.

The KMS key's spec should be ECC_SECG_P256K1, and should be enabled for signing. In order for the Guardian to authenticate against the KMS service, one of two options are available:

  • Create new API keys in the AWS console that are permissioned to use the KMS key for signing, and add the keys to the EC2 instance's ~/.aws/credentials file. (example here).
  • Create a role that is permissioned to use the KMS key and attach that role to the Guardian EC2 instance.

Copy link
Collaborator

@pires pires left a comment

Choose a reason for hiding this comment

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

Excited about trying this one 👏🏻

node/pkg/guardiansigner/amazonkms.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/amazonkms.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/amazonkms.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/amazonkms.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/amazonkms.go Show resolved Hide resolved
node/pkg/guardiansigner/benchmarksigner.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/benchmarksigner.go Show resolved Hide resolved
@pires pires added the node label Oct 31, 2024
Copy link
Collaborator

@pires pires left a comment

Choose a reason for hiding this comment

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

For the record, as discussed privately, I think metrics should be produced all the time and not limited to when testing/benchmarking.

Copy link
Collaborator

@pires pires left a comment

Choose a reason for hiding this comment

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

Other reviewers may have a different perspective on how this code relies on context.Context but aside from that I think this is ready for broader review.

guardianSignerUri := args[0]
wormchainAddress := args[1]
if !strings.HasPrefix(wormchainAddress, "wormhole") || strings.HasPrefix(wormchainAddress, "wormholeval") {
return errors.New("must provide a bech32 address that has 'wormhole' prefix")
}

guardianSigner, err := guardiansigner.NewGuardianSignerFromUri(guardianSignerUri, *unsafeDevnetMode)
guardianSigner, err := guardiansigner.NewGuardianSignerFromUri(ctx, guardianSignerUri, *unsafeDevnetMode)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Context shouldn't be passed to constructors but to calls, such as Sign and Verify by the callers.

That said, I think we can keep this as is and simply add comments explaining why this is a special case, i.e. you need a context for calling AWS KMS during signer initialization.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively, the initialization may not ask for a parent Context and simply manage its own, e.g. a Context.WithTimeout(timeout) should suffice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the suggestion for managing its own context is good. But I'm on the fence about it, so I'm going to defer this to a broader review for the time being.

node/pkg/governor/governor_monitoring.go Outdated Show resolved Hide resolved
node/pkg/guardiansigner/benchmarksigner.go Outdated Show resolved Hide resolved
@pleasew8t pleasew8t changed the title node: add amazon kms and benchmark signers node: add amazon kms and benchmark signers (old) Nov 22, 2024
@pleasew8t pleasew8t closed this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants