From ef36071860a87c41cc3f930bedf4a6f6efc8cab5 Mon Sep 17 00:00:00 2001 From: varac Date: Fri, 14 Aug 2015 12:00:20 +0200 Subject: renamed README -> README.md --- README | 213 -------------------------------------------------------------- README.md | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 213 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 86e1d7b..0000000 --- a/README +++ /dev/null @@ -1,213 +0,0 @@ -= Postfix Puppet module - -This module will help install and configure postfix. - -A couple of classes will preconfigure postfix for common needs. - -This module needs: - -- the concat module: git://labs.riseup.net/shared-concat - -!! Upgrade Notice (01/2013) !! - -This module now uses parameterized classes, where it used global variables -before. So please whatch out before pulling, you need to change the -class declarations in your manifest ! - -Deprecation notice ------------------- - -It used to be that one could drop header checks snippets into the -following source directories: - - "puppet:///modules/site-postfix/${fqdn}/header_checks.d" - "puppet:///modules/site-postfix/header_checks.d" - "puppet:///files/etc/postfix/header_checks.d" - "puppet:///modules/postfix/header_checks.d" - -... and TLS policy snippets into those: - - "puppet:///modules/site-postfix/${fqdn}/tls_policy.d" - "puppet:///modules/site-postfix/tls_policy.d" - "puppet:///modules/postfix/tls_policy.d" - -This is not supported anymore. - -Every such snippet much now be configured using the (respectively) -postfix::header_checks_snippet and postfix::tlspolicy_snippet defines. - -Note: You will need to set a global Exec { path => '...' } to a proper pathing -in your manifests, or you will experience some issues such as: - -err: Failed to apply catalog: Parameter unless failed: 'test "x$(postconf -h relay_domains)" == 'xlocalhost host.foo.com'' is not qualified and no path was specified. Please qualify the command or specify a path. - -See: http://www.puppetcookbook.com/posts/set-global-exec-path.html for more -information about how to do this - -Postfix class configuration parameters --------------------------------------- - - * use_amavisd => 'yes' - to include postfix::amavis - - * anon_sasl => 'yes' - to hide the originating IP in email - relayed for an authenticated SASL client; this needs Postfix - 2.3 or later to work; beware! Postfix logs the header replacement - has been done, which means that you are storing this information, - unless you are anonymizing your logs. - - * manage_header_checks => 'yes' - to manage header checks (see - postfix::header_checks for details) - - * manage_transport_regexp => 'yes' - to manage header checks (see - postfix::transport_regexp for details) - - * manage_virtual_regexp => 'yes' - to manage header checks (see - postfix::virtual_regexp for details) - - * manage_tls_policy => 'yes - to manage TLS policy (see - postfix::tlspolicy for details) - - * inet_interfaces: by default, postfix will bind to all interfaces, but - sometimes you don't want that. To bind to specific interfaces, use the - 'inet_interfaces' parameter and set it to exactly what would be in the - main.cf file. - - * myorigin: some hosts have weird-looking host names (dedicated servers and VPSes). To - set the server's domain of origin, set the 'myorigin' parameter - - * smtp_listen: address on which the smtp service will listen (Default: 127.0.0.1) - - * root_mail_recipient: who will receive root's emails (Default: 'nobody') - - * tls_fingerprint_digest: fingerprint digest for tls policy class (Default: 'sha1') - - * use_dovecot_lda: include dovecot declaration at master.cf - - * use_schleuder: whether to include schleuder portion at master.cf - - * use_sympa: whether to include sympa portion at master.cf - - * use_firma: whether to include firma portion at master.cf - - * use_mlmmj: whether to include mlmmj portion at master.cf - - * use_submission: set to "yes" to enable submission section at master.cf - - * use_smtps: set to "yes" to enable smtps section at master.cf - - * mastercf_tail: set this for additional content to be added at the end of master.cf - -== Examples: - - class { 'postfix': } - - class { 'postfix': anon_sasl => 'yes', myorigin => 'foo.bar.tz' } - - postfix::config { "relay_domains": value => "localhost host.foo.com" } - - -Convience classes -================= - -postfix::config ---------------- -this can be used to pass arbitrary postfix configurations by passing the $name -to postconf to add/alter/remove options in main.cf - -Parameters: -- *name*: name of the parameter. -- *ensure*: present/absent. defaults to present. -- *value*: value of the parameter. -- *nonstandard*: inform postfix::config that this parameter is not recognized - by the "postconf" command. defaults to false. - -Requires: -- Class["postfix"] - -Example usage: - - postfix::config { - "smtp_use_tls" => "yes"; - "smtp_sasl_auth_enable" => "yes"; - "smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords"; - "relayhost" => "[mail.example.com]:587"; - } - - -postfix::disable ----------------- -If you include this class, the postfix package will be removed and the service -stopped. - - -postfix::hash -------------- -This can be used to create 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. - -Parameters: -- *name*: the name of the map file. -- *ensure*: present/absent, defaults to present. -- *source*: file source. - -Requires: -- Class["postfix"] - -Example usage: - - postfix::hash { "/etc/postfix/virtual": - ensure => present, - } - postfix::config { "virtual_alias_maps": - value => "hash:/etc/postfix/virtual" - } - - -postfix::virtual ----------------- -Manages content of the /etc/postfix/virtual map - -Parameters: -- *name*: name of address postfix will lookup. See virtual(8). -- *destination*: where the emails will be delivered to. See virtual(8). -- *ensure*: present/absent, defaults to present. - -Requires: -- Class["postfix"] -- Postfix::Hash["/etc/postfix/virtual"] -- Postfix::Config["virtual_alias_maps"] -- common::line (from module common) - -Example usage: - - postfix::hash { "/etc/postfix/virtual": - ensure => present, - } - postfix::config { "virtual_alias_maps": - value => "hash:/etc/postfix/virtual" - } - postfix::virtual { "user@example.com": - ensure => present, - destination => "root", - } - -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: - - postfix::mailalias { "postmaster": - ensure => present, - recipient => 'foo' - } - diff --git a/README.md b/README.md new file mode 100644 index 0000000..86e1d7b --- /dev/null +++ b/README.md @@ -0,0 +1,213 @@ += Postfix Puppet module + +This module will help install and configure postfix. + +A couple of classes will preconfigure postfix for common needs. + +This module needs: + +- the concat module: git://labs.riseup.net/shared-concat + +!! Upgrade Notice (01/2013) !! + +This module now uses parameterized classes, where it used global variables +before. So please whatch out before pulling, you need to change the +class declarations in your manifest ! + +Deprecation notice +------------------ + +It used to be that one could drop header checks snippets into the +following source directories: + + "puppet:///modules/site-postfix/${fqdn}/header_checks.d" + "puppet:///modules/site-postfix/header_checks.d" + "puppet:///files/etc/postfix/header_checks.d" + "puppet:///modules/postfix/header_checks.d" + +... and TLS policy snippets into those: + + "puppet:///modules/site-postfix/${fqdn}/tls_policy.d" + "puppet:///modules/site-postfix/tls_policy.d" + "puppet:///modules/postfix/tls_policy.d" + +This is not supported anymore. + +Every such snippet much now be configured using the (respectively) +postfix::header_checks_snippet and postfix::tlspolicy_snippet defines. + +Note: You will need to set a global Exec { path => '...' } to a proper pathing +in your manifests, or you will experience some issues such as: + +err: Failed to apply catalog: Parameter unless failed: 'test "x$(postconf -h relay_domains)" == 'xlocalhost host.foo.com'' is not qualified and no path was specified. Please qualify the command or specify a path. + +See: http://www.puppetcookbook.com/posts/set-global-exec-path.html for more +information about how to do this + +Postfix class configuration parameters +-------------------------------------- + + * use_amavisd => 'yes' - to include postfix::amavis + + * anon_sasl => 'yes' - to hide the originating IP in email + relayed for an authenticated SASL client; this needs Postfix + 2.3 or later to work; beware! Postfix logs the header replacement + has been done, which means that you are storing this information, + unless you are anonymizing your logs. + + * manage_header_checks => 'yes' - to manage header checks (see + postfix::header_checks for details) + + * manage_transport_regexp => 'yes' - to manage header checks (see + postfix::transport_regexp for details) + + * manage_virtual_regexp => 'yes' - to manage header checks (see + postfix::virtual_regexp for details) + + * manage_tls_policy => 'yes - to manage TLS policy (see + postfix::tlspolicy for details) + + * inet_interfaces: by default, postfix will bind to all interfaces, but + sometimes you don't want that. To bind to specific interfaces, use the + 'inet_interfaces' parameter and set it to exactly what would be in the + main.cf file. + + * myorigin: some hosts have weird-looking host names (dedicated servers and VPSes). To + set the server's domain of origin, set the 'myorigin' parameter + + * smtp_listen: address on which the smtp service will listen (Default: 127.0.0.1) + + * root_mail_recipient: who will receive root's emails (Default: 'nobody') + + * tls_fingerprint_digest: fingerprint digest for tls policy class (Default: 'sha1') + + * use_dovecot_lda: include dovecot declaration at master.cf + + * use_schleuder: whether to include schleuder portion at master.cf + + * use_sympa: whether to include sympa portion at master.cf + + * use_firma: whether to include firma portion at master.cf + + * use_mlmmj: whether to include mlmmj portion at master.cf + + * use_submission: set to "yes" to enable submission section at master.cf + + * use_smtps: set to "yes" to enable smtps section at master.cf + + * mastercf_tail: set this for additional content to be added at the end of master.cf + +== Examples: + + class { 'postfix': } + + class { 'postfix': anon_sasl => 'yes', myorigin => 'foo.bar.tz' } + + postfix::config { "relay_domains": value => "localhost host.foo.com" } + + +Convience classes +================= + +postfix::config +--------------- +this can be used to pass arbitrary postfix configurations by passing the $name +to postconf to add/alter/remove options in main.cf + +Parameters: +- *name*: name of the parameter. +- *ensure*: present/absent. defaults to present. +- *value*: value of the parameter. +- *nonstandard*: inform postfix::config that this parameter is not recognized + by the "postconf" command. defaults to false. + +Requires: +- Class["postfix"] + +Example usage: + + postfix::config { + "smtp_use_tls" => "yes"; + "smtp_sasl_auth_enable" => "yes"; + "smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords"; + "relayhost" => "[mail.example.com]:587"; + } + + +postfix::disable +---------------- +If you include this class, the postfix package will be removed and the service +stopped. + + +postfix::hash +------------- +This can be used to create 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. + +Parameters: +- *name*: the name of the map file. +- *ensure*: present/absent, defaults to present. +- *source*: file source. + +Requires: +- Class["postfix"] + +Example usage: + + postfix::hash { "/etc/postfix/virtual": + ensure => present, + } + postfix::config { "virtual_alias_maps": + value => "hash:/etc/postfix/virtual" + } + + +postfix::virtual +---------------- +Manages content of the /etc/postfix/virtual map + +Parameters: +- *name*: name of address postfix will lookup. See virtual(8). +- *destination*: where the emails will be delivered to. See virtual(8). +- *ensure*: present/absent, defaults to present. + +Requires: +- Class["postfix"] +- Postfix::Hash["/etc/postfix/virtual"] +- Postfix::Config["virtual_alias_maps"] +- common::line (from module common) + +Example usage: + + postfix::hash { "/etc/postfix/virtual": + ensure => present, + } + postfix::config { "virtual_alias_maps": + value => "hash:/etc/postfix/virtual" + } + postfix::virtual { "user@example.com": + ensure => present, + destination => "root", + } + +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: + + postfix::mailalias { "postmaster": + ensure => present, + recipient => 'foo' + } + -- cgit v1.2.3 From 2f4eb46acfa6c29aeb19297b3c7fe803adccf069 Mon Sep 17 00:00:00 2001 From: varac Date: Fri, 14 Aug 2015 12:09:55 +0200 Subject: documented facter version issue for wheezy hosts in README.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 86e1d7b..7a6b01f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -= Postfix Puppet module +Postfix Puppet module +===================== This module will help install and configure postfix. @@ -11,9 +12,19 @@ This module needs: !! Upgrade Notice (01/2013) !! This module now uses parameterized classes, where it used global variables -before. So please whatch out before pulling, you need to change the +before. So please whatch out before pulling, you need to change the class declarations in your manifest ! +Issues +------ + +- Debian wheezy hosts (or below): If you get this error msg: + + "Could not find template 'postfix/master.cf.debian-.erb' at /ssrv/leap/puppet/modules/postfix/manifests/init.pp:158 on node rew07plain1.rewire.org" + + you need to use the facter package from wheezy-backports instead of the wheezy one. See https://gitlab.com/shared-puppet-modules-group/postfix/merge_requests/6#note_1892207 for more details. + + Deprecation notice ------------------ -- cgit v1.2.3 From 58c687dcaa5c24d3258b34a2a75e7a964431fd91 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 21 Aug 2015 17:09:58 -0700 Subject: make default value for alias_maps optional --- manifests/init.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index f454be9..4a7ca72 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,7 +52,8 @@ class postfix( $use_smtps = "no", $mastercf_tail = "", $inet_interfaces = 'all', - $myorigin = $::fqdn + $myorigin = $::fqdn, + $default_alias_maps = true ) { # selinux labels differ from one distribution to another @@ -165,9 +166,13 @@ class postfix( } # Default configuration parameters + if $default_alias_maps { + postfix::config { + "alias_maps": value => "hash:/etc/aliases"; + } + } postfix::config { - "myorigin": value => "${myorigin}"; - "alias_maps": value => "hash:/etc/aliases"; + "myorigin": value => "${myorigin}"; "inet_interfaces": value => "${inet_interfaces}"; } -- cgit v1.2.3 From 6751268f0ff2002a8aa5bf56d59027e636ccafa3 Mon Sep 17 00:00:00 2001 From: varac Date: Sat, 28 Nov 2015 22:45:12 +0100 Subject: [deprec] Use @ in front of erb tags in debian master.cf Puppet 3 now throws a deprecation warning about this. --- templates/master.cf.debian-7.erb | 26 +++++++++++++------------- templates/master.cf.debian-8.erb | 22 +++++++++++----------- templates/master.cf.debian-sid.erb | 26 +++++++++++++------------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/templates/master.cf.debian-7.erb b/templates/master.cf.debian-7.erb index cc4bbf0..7b653fb 100644 --- a/templates/master.cf.debian-7.erb +++ b/templates/master.cf.debian-7.erb @@ -8,25 +8,25 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<% if smtp_listen == 'all' %>smtp inet n - - - - smtpd -<% else %><%= smtp_listen %>:smtp inet n - - - - smtpd<% end %> +<% if @smtp_listen == 'all' %>smtp inet n - - - - smtpd +<% else %><%= @smtp_listen %>:smtp inet n - - - - smtpd<% end %> #smtp inet n - - - 1 postscreen #smtpd pass - - - - - smtpd #dnsblog unix - - - - 0 dnsblog #tlsproxy unix - - - - 0 tlsproxy -<% if use_submission == 'yes' %>submission inet n - - - - smtpd +<% if @use_submission == 'yes' %>submission inet n - - - - smtpd -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING <% end %> -<% if use_smtps == 'yes' %>smtps inet n - - - - smtpd +<% if @use_smtps == 'yes' %>smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING <% end %> -#628 inet n - - - - qmqpd +#628 inet n - - - - qmqpd pickup fifo n - - 60 1 pickup cleanup unix n - - - 0 cleanup qmgr fifo n - n 300 1 qmgr @@ -114,7 +114,7 @@ mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} -<% if use_amavisd == 'yes' %> +<% if @use_amavisd == 'yes' %> amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes @@ -133,25 +133,25 @@ 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 use_dovecot_lda == 'yes' %> +<% if @use_dovecot_lda == 'yes' %> dovecot unix - n n - - pipe - flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} + flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} <% end %> -<% if use_schleuder == 'yes' %> +<% if @use_schleuder == 'yes' %> schleuder unix - n n - - pipe flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user} <% end %> -<% if use_sympa == 'yes' %> +<% if @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 %> -<% if use_mlmmj == 'yes' %> +<% if @use_mlmmj == 'yes' %> mlmmj unix - n n - - pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop/ <%- end -%> -<%- unless mastercf_tail.to_s.empty? then -%> -<%= mastercf_tail %> +<%- unless @mastercf_tail.to_s.empty? then -%> +<%= @mastercf_tail %> <%- end -%> diff --git a/templates/master.cf.debian-8.erb b/templates/master.cf.debian-8.erb index a4c39b7..7b653fb 100644 --- a/templates/master.cf.debian-8.erb +++ b/templates/master.cf.debian-8.erb @@ -8,19 +8,19 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<% if smtp_listen == 'all' %>smtp inet n - - - - smtpd -<% else %><%= smtp_listen %>:smtp inet n - - - - smtpd<% end %> +<% if @smtp_listen == 'all' %>smtp inet n - - - - smtpd +<% else %><%= @smtp_listen %>:smtp inet n - - - - smtpd<% end %> #smtp inet n - - - 1 postscreen #smtpd pass - - - - - smtpd #dnsblog unix - - - - 0 dnsblog #tlsproxy unix - - - - 0 tlsproxy -<% if use_submission == 'yes' %>submission inet n - - - - smtpd +<% if @use_submission == 'yes' %>submission inet n - - - - smtpd -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING <% end %> -<% if use_smtps == 'yes' %>smtps inet n - - - - smtpd +<% if @use_smtps == 'yes' %>smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject @@ -114,7 +114,7 @@ mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} -<% if use_amavisd == 'yes' %> +<% if @use_amavisd == 'yes' %> amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes @@ -133,25 +133,25 @@ 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 use_dovecot_lda == 'yes' %> +<% if @use_dovecot_lda == 'yes' %> dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} <% end %> -<% if use_schleuder == 'yes' %> +<% if @use_schleuder == 'yes' %> schleuder unix - n n - - pipe flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user} <% end %> -<% if use_sympa == 'yes' %> +<% if @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 %> -<% if use_mlmmj == 'yes' %> +<% if @use_mlmmj == 'yes' %> mlmmj unix - n n - - pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop/ <%- end -%> -<%- unless mastercf_tail.to_s.empty? then -%> -<%= mastercf_tail %> +<%- unless @mastercf_tail.to_s.empty? then -%> +<%= @mastercf_tail %> <%- end -%> diff --git a/templates/master.cf.debian-sid.erb b/templates/master.cf.debian-sid.erb index d5a5a14..7b653fb 100644 --- a/templates/master.cf.debian-sid.erb +++ b/templates/master.cf.debian-sid.erb @@ -8,25 +8,25 @@ # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== -<% if smtp_listen == 'all' %>smtp inet n - - - - smtpd -<% else %><%= smtp_listen %>:smtp inet n - - - - smtpd<% end %> +<% if @smtp_listen == 'all' %>smtp inet n - - - - smtpd +<% else %><%= @smtp_listen %>:smtp inet n - - - - smtpd<% end %> #smtp inet n - - - 1 postscreen #smtpd pass - - - - - smtpd #dnsblog unix - - - - 0 dnsblog #tlsproxy unix - - - - 0 tlsproxy -<% if use_submission == 'yes' %>submission inet n - - - - smtpd +<% if @use_submission == 'yes' %>submission inet n - - - - smtpd -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING <% end %> -<% if use_smtps == 'yes' %>smtps inet n - - - - smtpd +<% if @use_smtps == 'yes' %>smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING <% end %> -#628 inet n - - - - qmqpd +#628 inet n - - - - qmqpd pickup fifo n - - 60 1 pickup cleanup unix n - - - 0 cleanup qmgr fifo n - n 300 1 qmgr @@ -114,7 +114,7 @@ mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} -<% if use_amavisd == 'yes' %> +<% if @use_amavisd == 'yes' %> amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes @@ -133,25 +133,25 @@ 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 use_dovecot_lda == 'yes' %> +<% if @use_dovecot_lda == 'yes' %> dovecot unix - n n - - pipe - flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} + flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension} <% end %> -<% if use_schleuder == 'yes' %> +<% if @use_schleuder == 'yes' %> schleuder unix - n n - - pipe flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user} <% end %> -<% if use_sympa == 'yes' %> +<% if @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 %> -<% if use_mlmmj == 'yes' %> +<% if @use_mlmmj == 'yes' %> mlmmj unix - n n - - pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop/ <%- end -%> -<%- unless mastercf_tail.to_s.empty? then -%> -<%= mastercf_tail %> +<%- unless @mastercf_tail.to_s.empty? then -%> +<%= @mastercf_tail %> <%- end -%> -- cgit v1.2.3 From 1eea47c2f6b8f0290fb27558eb873563fc99758b Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 14:44:38 +0100 Subject: linted init.pp --- manifests/init.pp | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4a7ca72..54f36e5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,23 +34,23 @@ # } # class postfix( - $smtp_listen = "127.0.0.1", - $root_mail_recipient = "nobody", - $anon_sasl = "no", - $manage_header_checks = "no", - $manage_tls_policy = "no", - $manage_transport_regexp = "no", - $manage_virtual_regexp = "no", + $smtp_listen = '127.0.0.1', + $root_mail_recipient = 'nobody', + $anon_sasl = 'no', + $manage_header_checks = 'no', + $manage_tls_policy = 'no', + $manage_transport_regexp = 'no', + $manage_virtual_regexp = 'no', $tls_fingerprint_digest = 'sha1', - $use_amavisd = "no", - $use_dovecot_lda = "no", - $use_schleuder = "no", - $use_sympa = "no", - $use_firma = "no", - $use_mlmmj = "no", - $use_submission = "no", - $use_smtps = "no", - $mastercf_tail = "", + $use_amavisd = 'no', + $use_dovecot_lda = 'no', + $use_schleuder = 'no', + $use_sympa = 'no', + $use_firma = 'no', + $use_mlmmj = 'no', + $use_submission = 'no', + $use_smtps = 'no', + $mastercf_tail = '', $inet_interfaces = 'all', $myorigin = $::fqdn, $default_alias_maps = true @@ -61,8 +61,8 @@ class postfix( RedHat, CentOS: { case $::operatingsystemmajrelease { - "4": { $postfix_seltype = "etc_t" } - "5": { $postfix_seltype = "postfix_etc_t" } + '4': { $postfix_seltype = 'etc_t' } + '5': { $postfix_seltype = 'postfix_etc_t' } default: { $postfix_seltype = undef } } } @@ -81,7 +81,8 @@ class postfix( if $anon_sasl == 'yes' { include postfix::anonsasl } - if $header_checks == 'yes' { + # this global variable needs to get parameterized as well + if $::header_checks == 'yes' { include postfix::header_checks } if $manage_tls_policy == 'yes' { @@ -99,7 +100,7 @@ class postfix( include postfix::virtual_regexp } - package { ["postfix", "mailx"]: + package { ['postfix', 'mailx']: ensure => installed } @@ -107,86 +108,87 @@ class postfix( Package[mailx] { name => 'bsd-mailx' } } - service { "postfix": + service { 'postfix': ensure => running, - require => Package["postfix"], + require => Package['postfix'], } - file { "/etc/mailname": + file { '/etc/mailname': ensure => present, - content => "${fqdn}\n", + content => "${::fqdn}\n", seltype => $postfix_seltype, } # Aliases - file { "/etc/aliases": - ensure => present, + file { '/etc/aliases': + ensure => present, content => "# file managed by puppet\n", replace => false, seltype => $postfix_seltype, - notify => Exec["newaliases"], + notify => Exec['newaliases'], } # Aliases - exec { "newaliases": - command => "/usr/bin/newaliases", + exec { 'newaliases': + command => '/usr/bin/newaliases', refreshonly => true, - require => Package["postfix"], - subscribe => File["/etc/aliases"], + require => Package['postfix'], + subscribe => File['/etc/aliases'], } # Config files - file { "/etc/postfix/master.cf": + file { '/etc/postfix/master.cf': ensure => present, - owner => "root", - group => "root", - mode => "0644", + owner => 'root', + group => 'root', + mode => '0644', content => $::operatingsystem ? { - Redhat => template("postfix/master.cf.redhat5.erb"), - CentOS => template("postfix/master.cf.redhat5.erb"), + Redhat => template('postfix/master.cf.redhat5.erb'), + CentOS => template('postfix/master.cf.redhat5.erb'), Debian => template("postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"), - Ubuntu => template("postfix/master.cf.debian-etch.erb"), + Ubuntu => template('postfix/master.cf.debian-etch.erb'), }, seltype => $postfix_seltype, - notify => Service["postfix"], - require => Package["postfix"], + notify => Service['postfix'], + require => Package['postfix'], } # Config files - file { "/etc/postfix/main.cf": + file { '/etc/postfix/main.cf': ensure => present, - owner => "root", - group => "root", - mode => "0644", - source => "puppet:///modules/postfix/main.cf", + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/postfix/main.cf', replace => false, seltype => $postfix_seltype, - notify => Service["postfix"], - require => Package["postfix"], + notify => Service['postfix'], + require => Package['postfix'], } # Default configuration parameters if $default_alias_maps { postfix::config { - "alias_maps": value => "hash:/etc/aliases"; + 'alias_maps': value => 'hash:/etc/aliases'; } } postfix::config { - "myorigin": value => "${myorigin}"; - "inet_interfaces": value => "${inet_interfaces}"; + 'myorigin': value => $myorigin; + 'inet_interfaces': value => $inet_interfaces; } case $::operatingsystem { RedHat, CentOS: { postfix::config { - "sendmail_path": value => "/usr/sbin/sendmail.postfix"; - "newaliases_path": value => "/usr/bin/newaliases.postfix"; - "mailq_path": value => "/usr/bin/mailq.postfix"; + 'sendmail_path': value => '/usr/sbin/sendmail.postfix'; + 'newaliases_path': value => '/usr/bin/newaliases.postfix'; + 'mailq_path': value => '/usr/bin/mailq.postfix'; } } + default: {} } - postfix::mailalias {"root": + postfix::mailalias {'root': recipient => $root_mail_recipient, } } -- cgit v1.2.3 From f4201357e5da4cbdecd558218c262c01d92c4697 Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 14:50:56 +0100 Subject: [refactor] Dont use case statement in resource def --- manifests/init.pp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 54f36e5..f92e20b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -56,10 +56,12 @@ class postfix( $default_alias_maps = true ) { - # selinux labels differ from one distribution to another case $::operatingsystem { RedHat, CentOS: { + $master_cf_template = 'postfix/master.cf.redhat5.erb' + + # selinux labels differ from one distribution to another case $::operatingsystemmajrelease { '4': { $postfix_seltype = 'etc_t' } '5': { $postfix_seltype = 'postfix_etc_t' } @@ -67,8 +69,17 @@ class postfix( } } + 'Debian': { + $master_cf_template = "postfix/master.cf.debian-${::operatingsystemmajrelease}.erb" + } + + 'Ubuntu': { + $master_cf_template = 'postfix/master.cf.debian-sid.erb' + } + default: { - $postfix_seltype = undef + $postfix_seltype = undef + $master_cf_template = undef } } @@ -142,12 +153,7 @@ class postfix( owner => 'root', group => 'root', mode => '0644', - content => $::operatingsystem ? { - Redhat => template('postfix/master.cf.redhat5.erb'), - CentOS => template('postfix/master.cf.redhat5.erb'), - Debian => template("postfix/master.cf.debian-${::operatingsystemmajrelease}.erb"), - Ubuntu => template('postfix/master.cf.debian-etch.erb'), - }, + content => template($master_cf_template), seltype => $postfix_seltype, notify => Service['postfix'], require => Package['postfix'], -- cgit v1.2.3 From 969076a813b88dafd222c413bf6fbabab837eafb Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 1 Dec 2015 16:27:41 +0100 Subject: join case statements in init.pp --- manifests/init.pp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index f92e20b..d298183 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -58,7 +58,7 @@ class postfix( case $::operatingsystem { - RedHat, CentOS: { + 'RedHat', 'CentOS': { $master_cf_template = 'postfix/master.cf.redhat5.erb' # selinux labels differ from one distribution to another @@ -67,6 +67,12 @@ class postfix( '5': { $postfix_seltype = 'postfix_etc_t' } default: { $postfix_seltype = undef } } + + postfix::config { + 'sendmail_path': value => '/usr/sbin/sendmail.postfix'; + 'newaliases_path': value => '/usr/bin/newaliases.postfix'; + 'mailq_path': value => '/usr/bin/mailq.postfix'; + } } 'Debian': { @@ -183,17 +189,6 @@ class postfix( 'inet_interfaces': value => $inet_interfaces; } - case $::operatingsystem { - RedHat, CentOS: { - postfix::config { - 'sendmail_path': value => '/usr/sbin/sendmail.postfix'; - 'newaliases_path': value => '/usr/bin/newaliases.postfix'; - 'mailq_path': value => '/usr/bin/mailq.postfix'; - } - } - default: {} - } - postfix::mailalias {'root': recipient => $root_mail_recipient, } -- cgit v1.2.3