diff options
Diffstat (limited to 'lib/leap_cli/commands/user.rb')
-rw-r--r-- | lib/leap_cli/commands/user.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/leap_cli/commands/user.rb b/lib/leap_cli/commands/user.rb index 00c4b62..7be91c8 100644 --- a/lib/leap_cli/commands/user.rb +++ b/lib/leap_cli/commands/user.rb @@ -1,13 +1,14 @@ require 'gpgme' # -# notes: +# perhaps we want to verify that the key files are actually the key files we expect. +# we could use 'file' for this: # -# file ~/.gnupg/00440025.asc -# /home/elijah/.gnupg/00440025.asc: PGP public key block +# > file ~/.gnupg/00440025.asc +# ~/.gnupg/00440025.asc: PGP public key block # -# file ~/.ssh/id_rsa.pub -# /home/elijah/.ssh/id_rsa.pub: OpenSSH RSA public key +# > file ~/.ssh/id_rsa.pub +# ~/.ssh/id_rsa.pub: OpenSSH RSA public key # module LeapCli @@ -103,5 +104,13 @@ module LeapCli return `gpg --armor --export-options export-minimal --export #{key_id}`.strip end + def update_authorized_keys + buffer = StringIO.new + Dir.glob(path([:user_ssh, '*'])).each do |keyfile| + buffer << File.read(keyfile) + end + write_file!(:authorized_keys, buffer.string) + end + end end
\ No newline at end of file |