diff --git a/manifests/init.pp b/manifests/init.pp index 4aca743..6b24d2b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,6 +4,12 @@ # # Parameters: # +# [*header_checks*] +# If not undef, sets the header_checks field in main.cfg to +# regexp:/etc/postfix/header_checks +# It populates the header_checks file with the contents of this string. +# Default: undef +# # Actions: # # Requires: @@ -28,13 +34,16 @@ # [Remember: No empty lines between comments and class definition] class postfix ( - $remove_sendmail = undef, - $myorigin = undef, - $mydestination = undef, - $relayhost = undef, - $relayhost_port = undef, - $daemon_directory = $::postfix::params::daemon_directory, - $inet_interfaces = $::postfix::params::inet_interfaces, + $remove_sendmail = undef, + $myorigin = undef, + $mydestination = undef, + $relayhost = undef, + $relayhost_port = undef, + $daemon_directory = $::postfix::params::daemon_directory, + $inet_interfaces = $::postfix::params::inet_interfaces, + $inet_protocols = $::postfix::params::inet_protocols, + $enable_daemon_directory = $::postfix::params::enable_daemon_directory, + $header_checks = undef, ) inherits postfix::params { if $remove_sendmail { @@ -59,6 +68,14 @@ ], } + if $header_checks { + file{$postfix::params::header_checks_file: + ensure => file, + content => $header_checks, + before => File['postfix_config'], + } + } + file{'postfix_config': ensure => 'file', path => $postfix::params::config_file, @@ -74,5 +91,4 @@ File['postfix_config'] ] } - -} +} \ No newline at end of file diff --git a/manifests/params.pp b/manifests/params.pp index c43806e..40bd266 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -42,10 +42,19 @@ fail("The postfix module does not support the ${::osfamily} family of operating systems.") } } - + + $header_checks_file = '/etc/postfix/header_checks' + + if $::lsbdistcodename == 'xenial' { + $enable_daemon_directory = false + }else{ + $enable_daemon_directory = true + } + # Set OS independent varibles here $sendmail_package = 'sendmail' $sendmailcf_package = 'sendmail-cf' $sendmail_service = 'sendmail' $inet_interfaces = 'localhost' + $inet_protocols = 'all' } diff --git a/templates/main.cf.erb b/templates/main.cf.erb index 0377e4f..bfc9474 100644 --- a/templates/main.cf.erb +++ b/templates/main.cf.erb @@ -41,7 +41,9 @@ command_directory = /usr/sbin # daemon programs (i.e. programs listed in the master.cf file). This # directory must be owned by root. # +<% if @enable_daemon_directory == true %> daemon_directory = <%= @daemon_directory %> +<% end %> # The data_directory parameter specifies the location of Postfix-writable # data files (caches, random numbers). This directory must be owned @@ -121,7 +123,7 @@ myorigin = <%= @myorigin %> inet_interfaces = <%= @inet_interfaces %> # Enable IPv4, and IPv6 if supported -inet_protocols = all +inet_protocols = <%= @inet_protocols %> # The proxy_interfaces parameter specifies the network interface # addresses that this mail system receives mail on by way of a @@ -559,6 +561,10 @@ alias_database = hash:/etc/aliases # For details, see "man header_checks". # #header_checks = regexp:/etc/postfix/header_checks +<% if @header_checks -%> +header_checks = regexp:/etc/postfix/header_checks +local_header_rewrite_clients = static:all +<% end -%> # FAST ETRN SERVICE #