From 18661db4da9bb3f599ee473993c267de918fa0ce Mon Sep 17 00:00:00 2001 From: Francois Deppierraz Date: Tue, 22 Dec 2009 20:28:15 +0100 Subject: [PATCH 01/12] Breaks backward compat: A few $postfix_ng_ variables were changed into $postfix_ variables --- manifests/classes/postfix-mailman.pp | 2 +- manifests/classes/postfix-mta.pp | 4 ++-- manifests/classes/postfix.pp | 4 ++-- templates/master.cf.debian-etch.erb | 2 +- templates/master.cf.redhat5.erb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/classes/postfix-mailman.pp b/manifests/classes/postfix-mailman.pp index c6c7981..cba0848 100644 --- a/manifests/classes/postfix-mailman.pp +++ b/manifests/classes/postfix-mailman.pp @@ -15,7 +15,7 @@ # } # class postfix::mailman { - $postfix_ng_smtp_listen = "0.0.0.0" + $postfix_smtp_listen = "0.0.0.0" include postfix postfix::config { diff --git a/manifests/classes/postfix-mta.pp b/manifests/classes/postfix-mta.pp index 9046bad..16b1981 100644 --- a/manifests/classes/postfix-mta.pp +++ b/manifests/classes/postfix-mta.pp @@ -2,7 +2,7 @@ # == Class: postfix::mta # # This class configures a minimal MTA, listening on -# $postfix_ng_smtp_listen (default to localhost) and delivering mail to +# $postfix_smtp_listen (default to localhost) and delivering mail to # $postfix_mydestination (default to $fqdn). # # A valid relay host is required ($postfix_relayhost) for outbound email. @@ -19,7 +19,7 @@ # # node "toto.example.com" { # $postfix_relayhost = "mail.example.com" -# $postfix_ng_smtp_listen = "0.0.0.0" +# $postfix_smtp_listen = "0.0.0.0" # $postfix_mydestination = "\$myorigin, myapp.example.com" # # include postfix::mta diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index 8c4173e..91a33e3 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -34,8 +34,8 @@ class postfix { } # Default value for various options - case $postfix_ng_smtp_listen { - "": { $postfix_ng_smtp_listen = "127.0.0.1" } + case $postfix_smtp_listen { + "": { $postfix_smtp_listen = "127.0.0.1" } } case $root_mail_recipient { "": { $root_mail_recipient = "nobody" } diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index 674682c..9a8351a 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -7,7 +7,7 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<%= postfix_ng_smtp_listen %>:smtp inet n - - - - smtpd +<%= postfix_smtp_listen %>:smtp inet n - - - - smtpd #submission inet n - - - - smtpd # -o smtpd_enforce_tls=yes # -o smtpd_sasl_auth_enable=yes diff --git a/templates/master.cf.redhat5.erb b/templates/master.cf.redhat5.erb index 08564b2..8c3ee53 100644 --- a/templates/master.cf.redhat5.erb +++ b/templates/master.cf.redhat5.erb @@ -7,7 +7,7 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<%= postfix_ng_smtp_listen %>:smtp inet n - n - - smtpd +<%= postfix_smtp_listen %>:smtp inet n - n - - smtpd #smtp inet n - n - - smtpd #submission inet n - n - - smtpd # -o smtpd_enforce_tls=yes From 3b8ef235fa00291e5d7f2be7512a55b3fbd3693d Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Tue, 9 Feb 2010 21:50:59 +0100 Subject: [PATCH 02/12] postfix: added support for CentOS and Ubuntu Based on a suggestion and patch from Nick Anderson. Thanks ! --- manifests/classes/postfix.pp | 6 ++++-- manifests/definitions/hash.pp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index 91a33e3..f1f803a 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -20,7 +20,7 @@ class postfix { # selinux labels differ from one distribution to another case $operatingsystem { - RedHat: { + RedHat, CentOS: { case $lsbmajdistrelease { "4": { $postfix_seltype = "etc_t" } "5": { $postfix_seltype = "postfix_etc_t" } @@ -81,7 +81,9 @@ class postfix { mode => "0644", content => $operatingsystem ? { Redhat => template("postfix/master.cf.redhat5.erb"), + CentOS => template("postfix/master.cf.redhat5.erb"), Debian => template("postfix/master.cf.debian-etch.erb"), + Ubuntu => template("postfix/master.cf.debian-etch.erb"), }, seltype => $postfix_seltype, notify => Service["postfix"], @@ -108,7 +110,7 @@ class postfix { } case $operatingsystem { - RedHat: { + RedHat, CentOS: { postfix::config { "sendmail_path": value => "/usr/sbin/sendmail.postfix"; "newaliases_path": value => "/usr/bin/newaliases.postfix"; diff --git a/manifests/definitions/hash.pp b/manifests/definitions/hash.pp index a0514ee..3f605f0 100644 --- a/manifests/definitions/hash.pp +++ b/manifests/definitions/hash.pp @@ -34,7 +34,7 @@ define postfix::hash ($ensure="present") { # selinux labels differ from one distribution to another case $operatingsystem { - RedHat: { + RedHat, CentOS: { case $lsbmajdistrelease { "4": { $postfix_seltype = "etc_t" } "5": { $postfix_seltype = "postfix_etc_t" } From 972762ce0c8b18950bdb37300b45477e7eb782d5 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 10 Jul 2010 13:34:10 -0300 Subject: [PATCH 03/12] Allowing 'all' for postfix_smtp_listen --- templates/master.cf.debian-etch.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index 9a8351a..d711551 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -7,7 +7,8 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<%= postfix_smtp_listen %>:smtp inet n - - - - smtpd +<% if postfix_smtp_listen == 'all' %>smtp inet n - - - - smtpd +<% else %><%= postfix_smtp_listen %>:smtp inet n - - - - smtpd<% end %> #submission inet n - - - - smtpd # -o smtpd_enforce_tls=yes # -o smtpd_sasl_auth_enable=yes From 3ecf57eb82ed7fcc41b30695dbe3ba45b9a0a7c6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 6 Aug 2010 18:31:11 -0300 Subject: [PATCH 04/12] Optional amavisd configuration --- templates/master.cf.debian-etch.erb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index d711551..df1241c 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -75,4 +75,22 @@ scalemail-backend unix - n n - 2 pipe mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} +<% if postfix_use_amavisd == 'yes' %> +amavis unix - - - - 2 smtp + -o smtp_data_done_timeout=1200 + -o smtp_send_xforward_command=yes +127.0.0.1:10025 inet n - - - - smtpd + -o content_filter= + -o local_recipient_maps= + -o relay_recipient_maps= + -o smtpd_restriction_classes= + -o smtpd_client_restrictions= + -o smtpd_helo_restrictions= + -o smtpd_sender_restrictions= + -o smtpd_recipient_restrictions=permit_mynetworks,reject + -o mynetworks=127.0.0.0/8 + -o strict_rfc821_envelopes=yes + -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks + -o smtpd_bind_address=127.0.0.1 +<% end %> From 2703cae7300bcb545e94d1e7ae806f5995548520 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 8 Aug 2010 00:42:55 -0300 Subject: [PATCH 05/12] Group for main.cf and master.cf --- manifests/classes/postfix.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index f1f803a..a3bbef9 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -78,6 +78,7 @@ class postfix { file { "/etc/postfix/master.cf": ensure => present, owner => "root", + group => "root", mode => "0644", content => $operatingsystem ? { Redhat => template("postfix/master.cf.redhat5.erb"), @@ -94,6 +95,7 @@ class postfix { file { "/etc/postfix/main.cf": ensure => present, owner => "root", + group => "root", mode => "0644", source => "puppet:///postfix/main.cf", replace => false, From eef9c501a2c65f60a77520575b2740bfbc9a2ec4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 8 Aug 2010 17:45:08 -0300 Subject: [PATCH 06/12] Introducing postfix_use_dovecot_lda --- templates/master.cf.debian-etch.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index df1241c..af387ef 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -94,3 +94,7 @@ amavis unix - - - - 2 smtp -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_bind_address=127.0.0.1 <% end %> +<% if postfix_use_dovecot_lda == 'yes' %> +dovecot unix - n n - - pipe + flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} +<% end %> From 1156b6f823e94c963cb0db7586cf56b801ea930f Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 15 Aug 2010 13:58:29 -0300 Subject: [PATCH 07/12] Adding source parameter at postfix::hash --- manifests/definitions/hash.pp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/manifests/definitions/hash.pp b/manifests/definitions/hash.pp index 3f605f0..9fa508b 100644 --- a/manifests/definitions/hash.pp +++ b/manifests/definitions/hash.pp @@ -5,11 +5,10 @@ Creates postfix hashed "map" files. It will create "${name}", and then build "${name}.db" using the "postmap" command. The map file can then be referred to using postfix::config. -Note: the content of the file is not managed by this definition. - Parameters: - *name*: the name of the map file. -- *ensure*: present/absent, defaults to present +- *ensure*: present/absent, defaults to present. +- *source*: file source. Requires: - Class["postfix"] @@ -29,7 +28,7 @@ Example usage: } */ -define postfix::hash ($ensure="present") { +define postfix::hash ($ensure="present", $source = false) { # selinux labels differ from one distribution to another case $operatingsystem { @@ -47,11 +46,24 @@ define postfix::hash ($ensure="present") { } } - file {"${name}": - ensure => $ensure, - mode => 600, - seltype => $postfix_seltype, - require => Package["postfix"], + case $source { + false: { + file {"${name}": + ensure => $ensure, + mode => 600, + seltype => $postfix_seltype, + require => Package["postfix"], + } + } + default: { + file {"${name}": + ensure => $ensure, + mode => 600, + source => $source, + seltype => $postfix_seltype, + require => Package["postfix"], + } + } } file {"${name}.db": From 4250af19b6c1c2b854957d86dd7a7354f1f898e6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 17 Aug 2010 22:31:07 -0300 Subject: [PATCH 08/12] Group and ownership for hash files --- manifests/definitions/hash.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/definitions/hash.pp b/manifests/definitions/hash.pp index 9fa508b..c8bb7c7 100644 --- a/manifests/definitions/hash.pp +++ b/manifests/definitions/hash.pp @@ -51,6 +51,8 @@ define postfix::hash ($ensure="present", $source = false) { file {"${name}": ensure => $ensure, mode => 600, + owner => root, + group => root, seltype => $postfix_seltype, require => Package["postfix"], } @@ -59,6 +61,8 @@ define postfix::hash ($ensure="present", $source = false) { file {"${name}": ensure => $ensure, mode => 600, + owner => root, + group => root, source => $source, seltype => $postfix_seltype, require => Package["postfix"], From 777d2cef1c466924f6fc40640932ef74b76276f0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 23 Aug 2010 21:53:07 -0300 Subject: [PATCH 09/12] Schleuder configuration --- templates/master.cf.debian-etch.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index af387ef..d8e02d8 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -98,3 +98,7 @@ amavis unix - - - - 2 smtp dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} <% end %> +<% if postfix_use_schleuder == 'yes' %> +schleuder unix - n n - - pipe + flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user} +<% end %> From 9cfb03fef5af5d2a75334e527b088f9713a87b3f Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 24 Aug 2010 13:41:42 -0300 Subject: [PATCH 10/12] Adding sympa transports --- templates/master.cf.debian-etch.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index d8e02d8..e6bc4ec 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -102,3 +102,9 @@ dovecot unix - n n - - pipe schleuder unix - n n - - pipe flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user} <% end %> +<% if postfix_use_sympa == 'yes' %> +sympa unix - n n - - pipe + flags=R user=sympa argv=/usr/lib/sympa/bin/queue ${recipient} +sympabounce unix - n n - - pipe + flags=R user=sympa argv=/usr/lib/sympa/bin/bouncequeue ${user} +<% end %> From 328c20af92a410bba35457c61a4882c489e0d9dd Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 14 Sep 2010 18:27:45 -0300 Subject: [PATCH 11/12] Fixing deprecation issue --- manifests/classes/postfix.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index a3bbef9..a9e1d3f 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -97,7 +97,7 @@ class postfix { owner => "root", group => "root", mode => "0644", - source => "puppet:///postfix/main.cf", + source => "puppet:///modules/postfix/main.cf", replace => false, seltype => $postfix_seltype, notify => Service["postfix"], From 6193e0e0e9f2263d9a297cc0f19dffe1b25483de Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Thu, 23 Sep 2010 13:05:57 -0400 Subject: [PATCH 12/12] Add mailalias resource wrapper --- manifests/classes/postfix.pp | 3 +-- manifests/definitions/mailalias.pp | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 manifests/definitions/mailalias.pp diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index a9e1d3f..1d60a57 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -121,8 +121,7 @@ class postfix { } } - mailalias {"root": + postfix::mailalias {"root": recipient => $root_mail_recipient, - notify => Exec["newaliases"], } } diff --git a/manifests/definitions/mailalias.pp b/manifests/definitions/mailalias.pp new file mode 100644 index 0000000..0d457e7 --- /dev/null +++ b/manifests/definitions/mailalias.pp @@ -0,0 +1,32 @@ +/* +== Definition: postfix::mailalias + +Wrapper around Puppet mailalias resource, provides newaliases executable. + +Parameters: +- *name*: the name of the alias. +- *ensure*: present/absent, defaults to present. +- *recipient*: recipient of the alias. + +Requires: +- Class["postfix"] + +Example usage: + + node "toto.example.com" { + + include postfix + + postfix::mailalias { "postmaster": + ensure => present, + recipient => 'foo' + } + +*/ +define mailalias ($ensure = 'present', $recipient) { + mailalias { "${name}": + ensure => $ensure, + recipient => $recipient, + notify => Exec['newaliases'] + } +}