aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/macros.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-02-06 23:37:05 -0800
committerelijah <elijah@riseup.net>2014-02-06 23:37:05 -0800
commit79afefc5c8a80da51fd735edfcd780c8be5b8ffc (patch)
tree90701ade4e865e8249ba4645b1b5e7dec9989d23 /lib/leap_cli/config/macros.rb
parent14534ad41f76d48b1df8a320076e4e42dc9425ba (diff)
downloadleap_cli-79afefc5c8a80da51fd735edfcd780c8be5b8ffc.tar.gz
leap_cli-79afefc5c8a80da51fd735edfcd780c8be5b8ffc.tar.bz2
added support for 'monitor' ssh keys.
Diffstat (limited to 'lib/leap_cli/config/macros.rb')
-rw-r--r--lib/leap_cli/config/macros.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb
index 8cc72f4..aaed77a 100644
--- a/lib/leap_cli/config/macros.rb
+++ b/lib/leap_cli/config/macros.rb
@@ -315,11 +315,15 @@ module LeapCli; module Config
##
#
- # creates a hash from the ssh key info in users directory, for use in updating authorized_keys file
+ # Creates a hash from the ssh key info in users directory, for use in
+ # updating authorized_keys file. Additionally, the 'monitor' public key is
+ # included, which is used by the monitor nodes to run particular commands
+ # remotely.
#
def authorized_keys
hash = {}
- Dir.glob(Path.named_path([:user_ssh, '*'])).sort.each do |keyfile|
+ keys = Dir.glob(Path.named_path([:user_ssh, '*']))
+ keys.sort.each do |keyfile|
ssh_type, ssh_key = File.read(keyfile).strip.split(" ")
name = File.basename(File.dirname(keyfile))
hash[name] = {
@@ -327,6 +331,11 @@ module LeapCli; module Config
"key" => ssh_key
}
end
+ ssh_type, ssh_key = File.read(Path.named_path(:monitor_pub_key)).strip.split(" ")
+ hash[Leap::Platform.monitor_username] = {
+ "type" => ssh_type,
+ "key" => ssh_key
+ }
hash
end