Commit ffb5ee7f authored by Will May's avatar Will May Committed by Vishal Nayak
Browse files

Changes from code review

parent f9d853f7
Showing with 9 additions and 2 deletions
+9 -2
......@@ -537,7 +537,6 @@ func TestBackend_AbleToAutoGenerateSigningKeys(t *testing.T) {
Operation: logical.UpdateOperation,
Path: "config/ca",
Data: map[string]interface{}{
"generate_signing_key": true,
},
},
......
......@@ -27,6 +27,7 @@ func pathConfigCA(b *backend) *framework.Path {
"generate_signing_key": &framework.FieldSchema{
Type: framework.TypeBool,
Description: `Generate SSH key pair internally rather than use the private_key and public_key fields.`,
Default: true,
},
},
......@@ -104,7 +105,14 @@ func generateSSHKeyPair() (string, string, error) {
func parseSSHKeyPair(data *framework.FieldData) (string, string, error) {
publicKey := data.Get("public_key").(string)
if publicKey == "" {
return "", "", errutil.UserError{Err: `missing public_key`}
}
privateKey := data.Get("private_key").(string)
if privateKey == "" {
return "", "", errutil.UserError{Err: `missing public_key`}
}
_, err := ssh.ParsePrivateKey([]byte(privateKey))
if err != nil {
......
......@@ -301,7 +301,7 @@ The first thing to do is to get Vault to generate the key pair that will be used
SSH keys:
```text
$ vault write ssh/config/ca generate_signing_key=true
$ vault write -f ssh/config/ca
Success! Data written to: ssh/config/ca
```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment