Permalink
Browse files

Added all nodes to mailservers mynetworks list

  • Loading branch information...
1 parent d042c72 commit 0d83a869eb96b92ff70baf4b45bd4c3a8b3ab19c @pehlert committed Sep 9, 2012
Showing with 6 additions and 8 deletions.
  1. +4 −0 recipes/postfix.rb
  2. +2 −8 templates/default/postfix/main.cf.erb
View
4 recipes/postfix.rb
@@ -25,8 +25,12 @@
action :enable
end
+# Get primary IPs of all nodes
+hosts = search(:node, "*:*", %w(ipaddress)).map { |n| n["ipaddress"] }
+
template "/etc/postfix/main.cf" do
source "postfix/main.cf.erb"
+ variables(:mynetworks => hosts)
mode 0644
owner "root"
group "root"
View
10 templates/default/postfix/main.cf.erb
@@ -12,9 +12,7 @@ mail_owner = postfix
# INTERNET HOST AND DOMAIN NAMES
#
myhostname = <%= @node[:fqdn] %>
-
-# TODO: This should be the TLD..
-#mydomain = domain.tld
+mydomain = <%= @node[:fqdn].split('.').last(2).join('.') %>
# SENDING MAIL
#
@@ -23,15 +21,12 @@ myorigin = $mydomain
# TRUST AND RELAY CONTROL
#
-# TODO: How can we automatically ensure that this has the right entries?!
-#mynetworks = 88.198.51.243, 127.0.0.0/8
+mynetworks = <%= @mynetworks.join(', ') %>, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
# DELIVERY TO MAILBOX
#
-#home_mailbox = Mailbox
-#home_mailbox = Maildir/
home_mailbox = .maildir/
# The mailbox_command parameter specifies the optional external
@@ -43,7 +38,6 @@ home_mailbox = .maildir/
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
mailbox_command = /usr/lib/dovecot/deliver
-#mailbox_command = /some/where/procmail -a "$EXTENSION"
# SHOW SOFTWARE VERSION OR NOT

0 comments on commit 0d83a86

Please sign in to comment.