From 60544a57c9e2d014061d2c2775654918890a648c Mon Sep 17 00:00:00 2001 From: Varac Date: Thu, 17 Dec 2009 16:37:53 +0100 Subject: added postfix::amavis, no relayhost needed for postfix::mta --- README | 4 ++++ manifests/classes/postfix-amavis.pp | 7 +++++++ manifests/classes/postfix-mta.pp | 6 +++--- manifests/classes/postfix.pp | 9 ++++++++- templates/master.cf.debian-etch.erb | 29 +++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 manifests/classes/postfix-amavis.pp diff --git a/README b/README index 964125f..c2b58e9 100644 --- a/README +++ b/README @@ -4,6 +4,10 @@ This module will help install and configure postfix. A couple of classes will preconfigure postfix for common needs. +Config +------ +- set $postfix_amavis="true" to include postfix::amavis + == Example: include postfix diff --git a/manifests/classes/postfix-amavis.pp b/manifests/classes/postfix-amavis.pp new file mode 100644 index 0000000..47ba532 --- /dev/null +++ b/manifests/classes/postfix-amavis.pp @@ -0,0 +1,7 @@ +class postfix::amavis { + include amavisd-new + postfix::config { + "content_filter": value => "smtp-amavis:[localhost]:10024"; } + +} + diff --git a/manifests/classes/postfix-mta.pp b/manifests/classes/postfix-mta.pp index 9046bad..ff94c91 100644 --- a/manifests/classes/postfix-mta.pp +++ b/manifests/classes/postfix-mta.pp @@ -32,9 +32,9 @@ # class postfix::mta { - case $postfix_relayhost { - "": { fail("Required \$postfix_relayhost variable is not defined.") } - } + #case $postfix_relayhost { + # "": { fail("Required \$postfix_relayhost variable is not defined.") } + #} case $postfix_mydestination { "": { $postfix_mydestination = "\$myorigin" } diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index 8c4173e..a413664 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -41,6 +41,13 @@ class postfix { "": { $root_mail_recipient = "nobody" } } + case $postfix_amavis { + "": { $postfix_amavis = "false" } + "true": { include postfix::amavis } + } + + + package { ["postfix", "mailx"]: ensure => installed @@ -81,7 +88,7 @@ class postfix { mode => "0644", content => $operatingsystem ? { Redhat => template("postfix/master.cf.redhat5.erb"), - Debian => template("postfix/master.cf.debian-etch.erb"), + Debian,Ubuntu => template("postfix/master.cf.debian-etch.erb"), }, seltype => $postfix_seltype, notify => Service["postfix"], diff --git a/templates/master.cf.debian-etch.erb b/templates/master.cf.debian-etch.erb index 674682c..aa5f34f 100644 --- a/templates/master.cf.debian-etch.erb +++ b/templates/master.cf.debian-etch.erb @@ -75,3 +75,32 @@ mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} + +# Amavis +<% if (postfix_amavis == "true" ) -%> + +## http://www.freespamfilter.org/FC4.html#_Toc110999176 + +smtp-amavis unix - - y - 2 smtp + -o smtp_data_done_timeout=1200 + -o smtp_send_xforward_command=yes + -o disable_dns_lookups=yes + +127.0.0.1:10025 inet n - y - - smtpd + -o content_filter= + -o local_recipient_maps= + -o relay_recipient_maps= + -o smtpd_restriction_classes= + -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 smtpd_error_sleep_time=0 + -o smtpd_soft_error_limit=1001 + -o smtpd_hard_error_limit=1000 + -o receive_override_options=no_header_body_checks +<% else -%> +# Amavis not configured +<% end -%> + -- cgit v1.2.3 From e775f510cd06fb2d38367e975bbd819cd6212cd6 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 2 Nov 2010 20:33:01 +0100 Subject: define mailalias -> define postfix::mailalias --- manifests/definitions/mailalias.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/definitions/mailalias.pp b/manifests/definitions/mailalias.pp index 0d457e7..cd1af50 100644 --- a/manifests/definitions/mailalias.pp +++ b/manifests/definitions/mailalias.pp @@ -23,7 +23,7 @@ Example usage: } */ -define mailalias ($ensure = 'present', $recipient) { +define postfix::mailalias ($ensure = 'present', $recipient) { mailalias { "${name}": ensure => $ensure, recipient => $recipient, -- cgit v1.2.3 From 000ec536a0260aaccb65968f16dcedd0728b4e0f Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 2 Nov 2010 20:34:01 +0100 Subject: -> as in template --- README | 2 +- manifests/classes/postfix.pp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index c2b58e9..c81554e 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ A couple of classes will preconfigure postfix for common needs. Config ------ -- set $postfix_amavis="true" to include postfix::amavis +- set $postfix_use_amavisd="true" to include postfix::amavis == Example: diff --git a/manifests/classes/postfix.pp b/manifests/classes/postfix.pp index 36089a6..4449629 100644 --- a/manifests/classes/postfix.pp +++ b/manifests/classes/postfix.pp @@ -5,13 +5,13 @@ # delivery and an SMTP server listening on the loopback interface. # # Parameters: -# - *$postfix_ng_smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1 +# - *$postfix_smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1 # - *$root_mail_recipient*: who will recieve root's emails. defaults to "nobody" # # Example usage: # # node "toto.example.com" { -# $postfix_ng_smtp_listen = "192.168.1.10" +# $postfix_smtp_listen = "192.168.1.10" # include postfix # } # @@ -41,9 +41,9 @@ class postfix { "": { $root_mail_recipient = "nobody" } } - case $postfix_amavis { - "": { $postfix_amavis = "false" } - "true": { include postfix::amavis } + case $postfix_use_amavisd { + "": { $postfix_use_amavisd = "no" } + "yes": { include postfix::amavis } } -- cgit v1.2.3 From 96b41a3e47819846cc8bb0b626f4f8b705b77890 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 2 Nov 2010 20:35:09 +0100 Subject: postfix socket synced with master.pp template --- manifests/classes/postfix-amavis.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/classes/postfix-amavis.pp b/manifests/classes/postfix-amavis.pp index 47ba532..c325238 100644 --- a/manifests/classes/postfix-amavis.pp +++ b/manifests/classes/postfix-amavis.pp @@ -1,7 +1,8 @@ class postfix::amavis { include amavisd-new - postfix::config { - "content_filter": value => "smtp-amavis:[localhost]:10024"; } + postfix::config { + "content_filter": value => "amavis:[127.0.0.1]:10024"; + } } -- cgit v1.2.3