Skip to content

Navigation Menu

Sign in
Sign up
This repository was archived by the owner on Nov 27, 2021. It is now read-only.
This repository was archived by the owner on Nov 27, 2021. It is now read-only.

masquerade_domains and canonical maps are not supported ! #6

Open

Description

Hi,
only wanted to mention, that these often used features are not supported.

My fix:

diff -upr puppet-postfix/manifests/config.pp puppet-postfix-new/manifests/config.pp
--- puppet-postfix/manifests/config.pp 2016年06月13日 10:53:41.343218152 +0200
+++ puppet-postfix-new/manifests/config.pp 2016年06月13日 09:08:46.344678602 +0200
@@ -62,4 +62,25 @@ class postfix::config {
 recipient => $::postfix::recipient,
 }
 }
+
+ if $::postfix::sender_canonical_maps {
+ exec { 'postfix.canonical.postmap':
+ command => "/usr/sbin/postmap ${::postfix::config_dir_path}/sender_canonical",
+ refreshonly => true,
+ subscribe => File['postfix.sender_canonical'],
+ require => $::postfix::config_file_require,
+ }
+
+ file { 'postfix.sender_canonical':
+ ensure => $::postfix::config_file_ensure,
+ path => "${::postfix::config_dir_path}/sender_canonical",
+ owner => $::postfix::config_file_owner,
+ group => $::postfix::config_file_group,
+ mode => '0600',
+ content => template('postfix/common/etc/postfix/sender_canonical.erb'),
+ notify => $::postfix::config_file_notify,
+ require => $::postfix::config_file_require,
+ }
+ }
+
 }
diff -upr puppet-postfix/manifests/init.pp puppet-postfix-new/manifests/init.pp
--- puppet-postfix/manifests/init.pp 2016年06月13日 10:53:41.343218152 +0200
+++ puppet-postfix-new/manifests/init.pp 2016年06月13日 09:14:10.431548196 +0200
@@ -29,12 +29,14 @@ class postfix (
 $service_enable = true,
 $myhostname = $::fqdn,
+ $masquerade_domains = undef,
 $mydestination = "${::fqdn}, localhost.${::domain}, localhost",
 $recipient = "admin@${::domain}",
 $relayhost = "smtp.${::domain}",
 $relayport = 25,
 $sasl_user = undef,
 $sasl_pass = undef,
+ $sender_canonical_maps = undef,
 ) inherits ::postfix::params {
 validate_re($package_ensure, '^(absent|latest|present|purged)$')
 validate_string($package_name)
@@ -59,6 +61,8 @@ class postfix (
 validate_hash($config_file_hash)
 validate_hash($config_file_options_hash)
+ if $sender_canonical_maps { validate_hash($sender_canonical_maps) }
+
 validate_re($service_ensure, '^(running|stopped)$')
 validate_string($service_name)
 validate_bool($service_enable)
diff -upr puppet-postfix/metadata.json puppet-postfix-new/metadata.json
--- puppet-postfix/metadata.json 2016年06月13日 10:53:41.343218152 +0200
+++ puppet-postfix-new/metadata.json 2016年02月16日 22:20:20.000000000 +0100
@@ -8,11 +8,9 @@
 "project_page": "https://github.com/dhoppe/puppet-postfix",
 "issues_url": "https://github.com/dhoppe/puppet-postfix/issues",
 "dependencies": [
- {
- "name": "puppetlabs/stdlib",
- "version_requirement": ">= 4.5.0 < 5.0.0"
- }
+ {"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0 < 5.0.0"}
 ],
+ "data_provider": null,
 "operatingsystem_support": [
 {
 "operatingsystem": "Debian",
Only in puppet-postfix: .rspec
Only in puppet-postfix: .rubocop.yml
Only in puppet-postfix-new/templates/common/etc/postfix: sender_canonical.erb
diff -upr puppet-postfix/templates/Debian/etc/postfix/main.cf.erb puppet-postfix-new/templates/Debian/etc/postfix/main.cf.erb
--- puppet-postfix/templates/Debian/etc/postfix/main.cf.erb 2016年06月13日 10:53:41.343218152 +0200
+++ puppet-postfix-new/templates/Debian/etc/postfix/main.cf.erb 2016年06月13日 09:50:05.405681722 +0200
@@ -33,6 +33,12 @@ smtp_tls_note_starttls_offer = yes
 smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
 <% end -%>
+
+<% if scope['::postfix::sender_canonical_maps'] -%>
+sender_canonical_maps = hash:/etc/postfix/sender_canonical
+
+<% end -%>
+
 # TLS parameters
 smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
 smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
@@ -44,6 +50,7 @@ smtp_tls_session_cache_database = btree:
 # information on enabling SSL in the smtp client.
 myhostname = <%= scope['::postfix::myhostname'] %>
+masquerade_domains = <%= scope['::postfix::masquerade_domains'] %>
 alias_maps = hash:/etc/aliases
 alias_database = hash:/etc/aliases
 myorigin = /etc/mailname
diff -upr puppet-postfix/templates/Ubuntu/etc/postfix/main.cf.erb puppet-postfix-new/templates/Ubuntu/etc/postfix/main.cf.erb
--- puppet-postfix/templates/Ubuntu/etc/postfix/main.cf.erb 2016年06月13日 10:53:41.343218152 +0200
+++ puppet-postfix-new/templates/Ubuntu/etc/postfix/main.cf.erb 2016年06月13日 09:48:10.340096281 +0200
@@ -33,6 +33,12 @@ smtp_tls_note_starttls_offer = yes
 smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
 <% end -%>
+
+<% if scope['::postfix::sender_canonical_maps'] -%>
+sender_canonical_maps = hash:/etc/postfix/sender_canonical
+
+<% end -%>
+
 # TLS parameters
 smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
 smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

The erb template: (templates/common/etc/postfix/sender_canonical.erb)

#
# THIS FILE IS MANAGED BY PUPPET
# <%= file %>
#
<% if scope['::postfix::sender_canonical_maps'] -%>
<% scope['::postfix::sender_canonical_maps'].each do |key,value| -%>
<%= value['username'] %> <%= value['email'] %>
<% end -%>
<% end -%>

Example class snippet:

$users = {
 "root" => {
 "username" => "root",
 "email" => "root-${::hostname}@domain.com"
 },
 "postmaster" => {
 "username" => "postmaster",
 "email" => "postmaster-${::hostname}@domain.com"
 }
}
class { 'postfix':
 recipient => "postmaster",
 relayhost => "relay.domain.com",
 relayport => "25",
 sasl_user => "relay",
 sasl_pass => "xxxxxxxxxxxxxx",
 masquerade_domains => "${::domain}",
 sender_canonical_maps => $users,
 config_file_template => "postfix/${::operatingsystem}/etc/postfix/main.cf.erb"
 }

Rgds.

Franz

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /