diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 13:03:50 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-15 13:03:50 -0400 |
commit | 61fc766d07e5252b9618c6548ea714649ab54a54 (patch) | |
tree | 38b7b8bd1057269ca40f2e63d570abbe3864ca02 /bin/ssh-list-authorized-keys | |
parent | 30b47ce9573dde234210ea9e0d1606ee5104b96e (diff) |
Pull tool configuration into a hackers-git.yml
Diffstat (limited to 'bin/ssh-list-authorized-keys')
-rwxr-xr-x | bin/ssh-list-authorized-keys | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/bin/ssh-list-authorized-keys b/bin/ssh-list-authorized-keys index 6a03c8d..5e178e1 100755 --- a/bin/ssh-list-authorized-keys +++ b/bin/ssh-list-authorized-keys @@ -1,22 +1,17 @@ #!/usr/bin/env ruby # Usage: ssh-list-authorized-keys [username] -cfg_groups = [ "repo", "git" ] -###################################################################### -require 'set' -require 'yaml' +load "#{File.dirname(__FILE__)}/common.rb" -all_users = Dir.glob("users/*.yml").map{|f|YAML::load(open(f))} -users = Set.new +all_users = load_all_users -groupnames = ARGV & cfg_groups +groupnames = ARGV & cfg["ssh_pseudo_users"] usernames = ARGV & all_users.map{|u|u["username"]} -unless groupnames.empty? - groupnames.push("hackers") -end - -users = all_users.find_all{|u| usernames.include?(u["username"]) or not ((u["groups"]||[]) & groupnames).empty?} +users = all_users.find_all{|u| + # [ username was listed ] or [ the user is in a listed group ] + usernames.include?(u["username"]) or not (u["groups"] & groupnames).empty? +} # Buffer the output to avoid EPIPE when the reader hangs up early output="" |