Add support for SSH private key passphrases (#2331)
This adds support for encrypted SSH keys via passphrase. Co-authored-by: Louis Ruch <louisruch@gmail.com> Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
This commit is contained in:
45 files changed
+1921
-382
No files matched your search
@@ -135,4 +135,23 @@ message SshPrivateKeyAttributes {
|
||||
that: "PrivateKeyHmac"
|
||||
}
|
||||
]; // @gotags: `class:"public"`
|
||||
|
||||
// Input only. The passphrase for the SSH private key associated with the credential.
|
||||
google.protobuf.StringValue private_key_passphrase = 40 [
|
||||
json_name = "private_key_passphrase",
|
||||
(custom_options.v1.generate_sdk_option) = true,
|
||||
(custom_options.v1.mask_mapping) = {
|
||||
this: "attributes.private_key_passphrase"
|
||||
that: "PrivateKeyPassphrase"
|
||||
}
|
||||
]; // @gotags: `class:"secret"`
|
||||
|
||||
// Output only. The hmac value of the SSH private key passphrase.
|
||||
string private_key_passphrase_hmac = 50 [
|
||||
json_name = "private_key_passphrase_hmac",
|
||||
(custom_options.v1.mask_mapping) = {
|
||||
this: "attributes.private_key_passphrase_hmac"
|
||||
that: "PrivateKeyPassphraseHmac"
|
||||
}
|
||||
]; // @gotags: `class:"public"`
|
||||
}
|
||||
@@ -330,4 +330,7 @@ message SshPrivateKeyCredential {
|
||||
|
||||
// Private key of the credential
|
||||
string private_key = 2; // @gotags: `class:"secret"`
|
||||
|
||||
// The optional passphrase of the private_key
|
||||
string private_key_passphrase = 3; // @gotags: `class:"secret"`
|
||||
}
|
||||
@@ -23,11 +23,15 @@ message UsernamePassword {
|
||||
string password = 20; // @gotags: `class:"secret"`
|
||||
}
|
||||
|
||||
// SshPrivateKey is a credential containing a username and a private key.
|
||||
// SshPrivateKey is a credential containing a username a private key and an optional
|
||||
// private key passphrase.
|
||||
message SshPrivateKey {
|
||||
// The username of the credential
|
||||
string username = 10; // @gotags: `class:"public"`
|
||||
|
||||
// The private key of the credential
|
||||
string private_key = 20; // @gotags: `class:"secret"`
|
||||
|
||||
// The optional passphrase of the private_key
|
||||
string private_key_passphrase = 30; // @gotags: `class:"secret"`
|
||||
}
|
||||
@@ -186,4 +186,26 @@ message SshPrivateKeyCredential {
|
||||
// It must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string key_id = 12;
|
||||
|
||||
// private_key_passphrase is the plain-text of the passphrase of the SSH private
|
||||
// key associated with the credential. We are not storing this plain-text
|
||||
// private key passphrase in the database.
|
||||
// @inject_tag: `gorm:"-"`
|
||||
bytes private_key_passphrase = 13 [(custom_options.v1.mask_mapping) = {
|
||||
this: "PrivateKeyPassphrase"
|
||||
that: "attributes.private_key_passphrase"
|
||||
}];
|
||||
|
||||
// private_key_passphrase_encrypted is the ciphertext of the private key passphrase. It is stored in
|
||||
// the database.
|
||||
// @inject_tag: `gorm:"column:private_key_passphrase_encrypted;not_null"`
|
||||
bytes private_key_passphrase_encrypted = 14;
|
||||
|
||||
// private_key_passphrase_hmac is a sha256-hmac of the unencrypted private key passphrase. It is recalculated
|
||||
// everytime the private key passphrase is updated.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
bytes private_key_passphrase_hmac = 15 [(custom_options.v1.mask_mapping) = {
|
||||
this: "PrivateKeyPassphraseHmac"
|
||||
that: "attributes.private_key_passphrase_hmac"
|
||||
}];
|
||||
}
|
||||
@@ -376,4 +376,15 @@ message SshPrivateKeyOverride {
|
||||
//
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string private_key_attribute = 3;
|
||||
|
||||
// private_key_passphrase_attribute is the name of the attribute in the Data
|
||||
// field of a Vault api.Secret that maps to a private key passphrase. If set,
|
||||
// it overrides any default attribute names the system uses to find a
|
||||
// private_key_passphrase attribute.
|
||||
//
|
||||
// See
|
||||
// https://github.com/hashicorp/vault/blob/5e505ec039177e8212cbbab74ccb644c46e62e63/api/secret.go#L25
|
||||
//
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string private_key_passphrase_attribute = 4;
|
||||
}
|
||||
Reference in new issue
Block a user