cloudtools / ssh-cert-authority

An implementation of an SSH certificate authority.
BSD 2-Clause "Simplified" License
728 stars 71 forks source link

User-selectable folder for SSH keys ("identity files") #28

Closed shatil closed 7 years ago

shatil commented 7 years ago

Introduces --ssh-dir flag to get and request subcommands so user may specify in what directory their identity files (also called SSH private keys, like id_rsa, id_dsa, id_ecdsa, etc.) are located.

Default folder remains ~/.ssh.

shatil commented 7 years ago

Before:

$ ssh-cert-authority get -e dev OY57UPLQRAG5E
Couldn't find ssh key for cert.

After:

$ ssh-cert-authority get -e dev --ssh-dir /tmp OY57UPLQRAG5E
Certificate data:
  Serial: 8519678261889338834
  Key id: ec2-user
  Principals: [ec2-user ubuntu]
  Options:
  Permissions:
      permit-agent-forwarding:
      permit-port-forwarding:
      permit-pty:
  Valid for public key: 2e:08:03:e6:d8:e1:96:61:0f:0e:4d:db:92:a5:9f:03
  Valid from 2017-05-23 20:45:00 +0000 UTC - 2017-05-23 22:47:00 +0000 UTC
pubkey /tmp/temp_rsa.pub, privkey /tmp/temp_rsa
Identity added: /tmp/temp_rsa (/tmp/temp_rsa)
Lifetime set to 6983 seconds
Certificate added: /tmp/temp_rsa-cert.pub (ec2-user)
Lifetime set to 6983 seconds

And all tests continue to pass:

$ go test ./...
ok      ssh-cert-authority      1.031s
ok      ssh-cert-authority/client       0.008s
ok      ssh-cert-authority/util 0.009s
bobveznat commented 7 years ago

Just an FYI I'm still thinking about this one a few minutes at a time.

shatil commented 7 years ago

I'm in no rush :)

shatil commented 7 years ago

Still thinking? :)

bobveznat commented 7 years ago

Sorry for the delay, I've had you sitting as unread in my inbox for months :-. Anyway, this looks good, and you're all merged in. Thank you for your continued contributions to the project.