Changes from code review

This commit is contained in:
Will May
2017-03-02 16:54:05 +00:00
committed by Vishal Nayak
parent f9d853f7f0
commit ffb5ee7fda
3 changed files with 9 additions and 2 deletions

View File

@@ -537,7 +537,6 @@ func TestBackend_AbleToAutoGenerateSigningKeys(t *testing.T) {
Operation: logical.UpdateOperation,
Path: "config/ca",
Data: map[string]interface{}{
"generate_signing_key": true,
},
},

View File

@@ -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 {

View File

@@ -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
```