Skip to content
Open
6 changes: 6 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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}")
Expand Down
25 changes: 23 additions & 2 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -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'],
}
}
}

2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 9 additions & 1 deletion templates/main.cf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
3 changes: 3 additions & 0 deletions templates/smtp_generic_maps.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% @smtp_generic_maps_definitions.each do |definition| -%>
<%= definition %>
<% end -%>