summaryrefslogtreecommitdiff
path: root/bin/ssh-list-authorized-keys
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ssh-list-authorized-keys')
-rwxr-xr-xbin/ssh-list-authorized-keys19
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=""