diff --git a/manifests/params.pp b/manifests/params.pp index 7b80935..c30ccbe 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -23,6 +23,7 @@ $postfix_package_ensure = installed $postgrey_package = 'postgrey' $spamassassin_package = 'spamassassin' + $spamassassin_localcf = '/etc/mail/spamassassin/local.cf' $spampd_package = 'spampd' $spampd_config = '/etc/sysconfig/spampd' $spampd_template = 'postfix/sysconfig-spampd.erb' @@ -32,6 +33,7 @@ $newaliases_path = '/usr/bin/newaliases.postfix' $sendmail_path = '/usr/sbin/sendmail.postfix' $postmap = '/usr/sbin/postmap' + $smtp_generic_maps_file = '/etc/postfix/generic' } 'Debian': { $postfix_version = undef @@ -49,6 +51,7 @@ $postfix_package_ensure = installed $postgrey_package = 'postgrey' $spamassassin_package = 'spamassassin' + $spamassassin_localcf = '/etc/mail/spamassassin/local.cf' $spampd_package = 'spampd' $spampd_config = '/etc/default/spampd' $spampd_template = 'postfix/default-spampd.erb' @@ -58,6 +61,7 @@ $newaliases_path = '/usr/bin/newaliases.postfix' $sendmail_path = '/usr/sbin/sendmail.postfix' $postmap = '/usr/sbin/postmap' + $smtp_generic_maps_file = '/etc/postfix/generic' } 'FreeBSD': { $postfix_version = undef @@ -75,6 +79,7 @@ $postfix_package_ensure = installed $postgrey_package = 'mail/postgrey' $spamassassin_package = 'mail/spamassassin' + $spamassassin_localcf = '/usr/local/etc/mail/spamassassin/local.cf' $spampd_package = 'mail/spampd' $spampd_config = '/etc/sysconfig/spampd' $spampd_template = 'postfix/sysconfig-spampd.erb' @@ -84,6 +89,7 @@ $newaliases_path = '/usr/local/bin/newaliases' $sendmail_path = '/usr/local/sbin/sendmail' $postmap = '/usr/local/sbin/postmap' + $smtp_generic_maps_file = '/usr/local/etc/postfix/generic' } default: { fail("Unsupported OS family ${::osfamily}") diff --git a/manifests/server.pp b/manifests/server.pp index 94a43cf..4d2d488 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -13,7 +13,9 @@ # See the main.cf comments for help on these options $myhostname = $::fqdn, $mydomain = false, + $append_dot_mydomain = 'yes', $myorigin = '$myhostname', + $append_at_myorigin = 'yes', $inet_interfaces = 'localhost', $inet_protocols = 'all', $proxy_interfaces = false, @@ -83,6 +85,12 @@ $canonical_maps = false, $sender_canonical_maps = false, $smtp_generic_maps = false, + $smtp_generic_maps_type = 'hash', + $smtp_generic_maps_file = $::postfix::params::smtp_generic_maps_file, + $smtp_generic_maps_definitions = [], + $compatibility_level = '0', + $smtputf8_enable = 'yes', + $postmap = $::postfix::params::postmap, $relocated_maps = false, $extra_main_parameters = {}, # master.cf @@ -152,6 +160,7 @@ $spamassassin_package = $::postfix::params::spamassassin_package, $spampd_package = $::postfix::params::spampd_package, $spampd_config = $::postfix::params::spampd_config, + $spamassassin_localcf = $::postfix::params::spamassassin_localcf, $spampd_template = $::postfix::params::spampd_template, $root_group = $::postfix::params::root_group, $mailq_path = $::postfix::params::mailq_path, @@ -211,7 +220,7 @@ notify => Service['spampd'], } # Change the spamassassin options - file { '/etc/mail/spamassassin/local.cf': + file { $spamassassin_localcf: require => Package[$spamassassin_package], content => template('postfix/spamassassin-local.cf.erb'), notify => Service['spampd'], @@ -250,6 +259,18 @@ group => $root_group, postfixdir => $config_directory, } - + if $smtp_generic_maps { + file { $smtp_generic_maps_file: + ensure => present, + content => template('postfix/smtp_generic_maps.erb'), + } + ~> + exec { 'Update postmap': + command => "${postmap} ${smtp_generic_maps_file}", + subscribe => File[$smtp_generic_maps_file], + refreshonly => true, + notify => Service['postfix'], + } + } } diff --git a/metadata.json b/metadata.json index 2d4b6ae..fb1b0e7 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "thias-postfix", - "version": "0.3.4", + "version": "0.4.1", "author": "Matthias Saou", "license": "Apache-2.0", "summary": "Postfix Mail Transport Agent module", diff --git a/templates/main.cf.erb b/templates/main.cf.erb index 2e0beb0..1bc3eee 100644 --- a/templates/main.cf.erb +++ b/templates/main.cf.erb @@ -103,6 +103,9 @@ mydomain = <%= @mydomain %> #myorigin = $mydomain myorigin = <%= @myorigin %> +append_at_myorigin = <%= @append_at_myorigin %> +append_dot_mydomain = <%= @append_dot_mydomain %> + # RECEIVING MAIL # The inet_interfaces parameter specifies the network interface @@ -940,9 +943,14 @@ sender_canonical_maps = <%= @sender_canonical_maps %> <% end -%> <% if @smtp_generic_maps -%> -smtp_generic_maps = <%= @smtp_generic_maps %> +smtp_generic_maps = <%= @smtp_generic_maps_type %>:<%= @smtp_generic_maps_file %> <% end -%> + +smtputf8_enable = <%= @smtputf8_enable %> + +compatibility_level = <%= @compatibility_level %> + <% if @postscreen -%> # Postscreen configuration postscreen_access_list = diff --git a/templates/smtp_generic_maps.erb b/templates/smtp_generic_maps.erb new file mode 100644 index 0000000..d5c366a --- /dev/null +++ b/templates/smtp_generic_maps.erb @@ -0,0 +1,3 @@ +<% @smtp_generic_maps_definitions.each do |definition| -%> +<%= definition %> +<% end -%>