summaryrefslogtreecommitdiff
path: root/bin/pgp-list-keyids
blob: 93bc2921a6a9d67150a44989e3a004dd972e32f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby
# Usage: pgp-list-keyids
cfg_groups = {
	:trusted => [ "hackers", "bots" ],
	:secondary => [ "trustedusers" ]
}

######################################################################
require 'yaml'

users = Dir.glob("users/*.yml").map{|f|YAML::load(open(f))}

users.each do |user|
	if user["groups"]
		if ! (user["groups"] & cfg_groups[:trusted]).empty?
			puts "trusted/#{user["username"]} #{user["pgp_keyid"]}"
		elsif ! (user["groups"] & cfg_groups[:secondary]).empty?
			puts "secondary/#{user["username"]} #{user["pgp_keyid"]}"
		elsif user["pgp_keyid"]
			puts "revoked/#{user["username"]} #{user["pgp_keyid"]}"
		end
	end
	if user["pgp_revoked_keyids"]
		user["pgp_revoked_keyids"].each do |keyid|
			puts "revoked/#{user["username"]} #{keyid}"
		end
	end
end