summaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/macros.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-25 17:34:25 -0700
committerelijah <elijah@riseup.net>2013-06-25 17:34:25 -0700
commitc033a0ff259d89e937a371335d67b1975dca6354 (patch)
tree69cf4e40d15040f3ab5f8f96a5c03072385403a9 /lib/leap_cli/config/macros.rb
parent0ffdf42cf2171deb0bdd4c54f8281c1c1257ee86 (diff)
lock version for allowed platform & add authorized_keys support
Diffstat (limited to 'lib/leap_cli/config/macros.rb')
-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