-
Notifications
You must be signed in to change notification settings - Fork 80
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
Secure signing: Key rotation with CLI #1002
base: l-monninger/key-spec
Are you sure you want to change the base?
Conversation
…olay/key-rotation-cli
…y version numbers
…utting new key id
Just a note cc @l-monninger, the way I convert the secp256k1 public key (on the AWS side) is from DER public key to the 64-byte public key, i.e. an uncompressed Eth address with the prefix stripped off. Please let me know if that's not the way we want apps to store them for their application public key state? |
} | ||
|
||
/// Creates a new AWS KMS key | ||
fn create_key(&self) -> Result<String> { |
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.
Please follow a similar organizational pattern to the one used in the HSM demo app. I would prefer that if you extract these implementations out, you do it as a separate crate with traits.
} | ||
} | ||
|
||
impl KeyManager for VaultKey { |
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.
The way I see it, KeyManager
should most likely be generic over a Application
and a SigningBackend
.
The Application
can be expected to implement some phases of the rotation, while the SigningBackend
others, so these are also traits ofc.
The thing I do not see a clear argument for is how you are planing to get away without a 2-PC or 3-PC. Both of these operations are fallible.
Please read up on properties of a 2-PC and 3-PC and make your case.
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.
Ah, I didn't realize 2PC and 3PC are formally defined. I thought you meant a two-step or three-step process. Okay I'll read up on them.
So the problem is that the transaction isn't atomic, for example the signing admin can update the signing backend that handles signing for an app replica, but the request to public_key/set
might fail?
In that case, what if, if the request to public_key/set
fails, then the key is simply rotated back to the version it was initially at before calling rotate_key
?
I'm assuming different app replicas always use different public keys.
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.
The first option you're describing is essentially a 2-PC, yes. Instead of a committing and then reverting though, you would usually prepare and then commit.
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.
So if we're doing prepare and then commit, does the "prepare" step happen in Terraform? I'm still a little unclear on what would be optimal for a preparation method? cc @mcmillennick
Summary
secure-signing
,cli
,signing-admin
CLI for signing admin to rotate keys in AWS and Vault apps
Changelog
util/signing/signing-admin
crate with CLI functionality, includingKeyManager
trait withrotate_key
andfetch_public_key
methods, implemented forAwsKey
andVaultKey
structs.notify_application
function to callpublic_key/set
for the application whose key is being updated.demo/hsm
, runcargo build --release
and then in the root of the workspace run for example./target/release/hsm-demo server ed25519 hashi-corp-vault movement_devNet_fullNode_demoApp_signer_wethTransferSign_replica1
to run a Vault app with that key name)In a separate terminal:
2.
util/signing/signing-admin
, runcargo build --release
3. In
/target/release
run (for example with demo app running locally per instruction 1 above):AWS:
Expected output:
Vault:
Expected output:
Outstanding issues
aws
set to--backend
the CLI takes a key alias delineated by slashes, rather than underscores. (See usage example above.)