diff options
Diffstat (limited to 'bin/ssh-list-authorized-keys')
-rwxr-xr-x | bin/ssh-list-authorized-keys | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/bin/ssh-list-authorized-keys b/bin/ssh-list-authorized-keys deleted file mode 100755 index 6a03c8d..0000000 --- a/bin/ssh-list-authorized-keys +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env ruby -# Usage: ssh-list-authorized-keys [username] -cfg_groups = [ "repo", "git" ] - -###################################################################### -require 'set' -require 'yaml' - -all_users = Dir.glob("users/*.yml").map{|f|YAML::load(open(f))} -users = Set.new - -groupnames = ARGV & cfg_groups -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?} - -# Buffer the output to avoid EPIPE when the reader hangs up early -output="" -users.each do |user| - if user["ssh_keys"] - user["ssh_keys"].each do |addr,key| - output+="#{key} #{user["fullname"]} (#{user["username"]}) <#{addr}>\n" - end - end -end -print output |