summaryrefslogtreecommitdiff
path: root/lib/leap_cli/config
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap_cli/config')
-rw-r--r--lib/leap_cli/config/macros.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb
index b3e7308..94ad034 100644
--- a/lib/leap_cli/config/macros.rb
+++ b/lib/leap_cli/config/macros.rb
@@ -262,5 +262,21 @@ module LeapCli; module Config
end
end
+ #
+ # creates a hash from the ssh key info in users directory, for use in updating authorized_keys file
+ #
+ def authorized_keys
+ hash = {}
+ Dir.glob(Path.named_path([:user_ssh, '*'])).sort.each do |keyfile|
+ ssh_type, ssh_key = File.read(keyfile).strip.split(" ")
+ name = File.basename(File.dirname(keyfile))
+ hash[name] = {
+ "type" => ssh_type,
+ "key" => ssh_key
+ }
+ end
+ hash
+ end
+
end
end; end