summaryrefslogtreecommitdiff
path: root/bin/postfix-generate-virtual-map
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 16:31:13 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 16:31:13 -0400
commit1a435c0f4b41904025d0f263734cb9aea6a03b13 (patch)
tree96ce607542c806c4a99c0463c3fea534e4c8e424 /bin/postfix-generate-virtual-map
parent043466d94da837fefb95cda8ecab44b03049890d (diff)
parente4b972f3c82dbe4b5e363e48ed01d97cc060a2c0 (diff)
Merge remote-tracking branch 'hackers/parabola-hackers'
# Conflicts: # .gitignore
Diffstat (limited to 'bin/postfix-generate-virtual-map')
-rwxr-xr-xbin/postfix-generate-virtual-map18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/postfix-generate-virtual-map b/bin/postfix-generate-virtual-map
new file mode 100755
index 0000000..d5c2d21
--- /dev/null
+++ b/bin/postfix-generate-virtual-map
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+# Usage: postfix-show-virtual-map > ${file} && postmap hash:${file}
+
+load "#{File.dirname(__FILE__)}/common.rb"
+
+users = load_all_users.values.find_all{|u|u["groups"].include?("email")}
+
+users.each do |user|
+ if user["email"] and user["email"].length > 0
+ if user["email"][0] =~ /.*@parabola.nu$/
+ if user["email"].length > 1
+ puts "#{user["username"]}@parabola.nu #{user["email"][1]}"
+ end
+ else
+ puts "#{user["username"]}@parabola.nu #{user["email"][0]}"
+ end
+ end
+end