postfix
: The top-level class, to install and configure Postfix
postfix::files
: Manages the Postfix related filespostfix::ldap
: Provides the Postfix LDAP supportpostfix::mailman
: Configure Postfix to work with mailmanpostfix::mta
: Configures Postfix as minimal MTApostfix::packages
: Install the required packages for postfixpostfix::params
: Default parameterspostfix::satellite
: Configure Postfix as satellitepostfix::service
: Manage service resources for postfix
postfix::canonical
: Manage content of the Postfix canonical mappostfix::conffile
: Manage a Postfix configuration filepostfix::config
: Set values in Postfix config filepostfix::hash
: Creates Postfix hashed "map" files, and builds the corresponding db filepostfix::mailalias
: Manage the content of the Postfix alias mappostfix::map
: Create a Postfix map filepostfix::transport
: Manage the transport map of postfixpostfix::virtual
: Manages the contents of the virtual map.
This class provides a basic setup of Postfix with local and remote delivery and an SMTP server listening on the loopback interface.
class { 'postfix':
smtp_listen => '192.168.1.10',
}
# This class configures a minimal MTA, delivering mail to
# $mydestination. Either a valid relay host or the special
# word 'direct' is required ($relayhost) for outbound email.
#
# transport & virtual maps get configured and can be populated with
# postfix::transport and postfix::virtual
#
class { 'postfix':
relayhost => 'mail.example.com',
smtp_listen => '0.0.0.0',
mydestination => '$myorigin, myapp.example.com',
mta => true,
}
# This configures all local email (cron, mdadm, etc) to be forwarded
# to $root_mail_recipient, using $relayhost as a relay.
#
# This will call postfix::mta and override its parameters.
# You shouldn't call postfix::mta yourself or use mta=true in the postfix class.
class { 'postfix':
relayhost => 'mail.example.com',
myorigin => 'toto.example.com',
root_mail_recipient => '[email protected]',
satellite => true,
}
The following parameters are available in the postfix
class:
alias_maps
amavis_procs
chroot
confdir
conffiles
configs
hashes
inet_interfaces
inet_protocols
ldap
ldap_base
ldap_host
ldap_options
ldap_packages
lookup_table_type
mailaliases
mail_user
mailman
mailx_ensure
maincf_source
manage_aliases
manage_conffiles
manage_mailname
manage_mailx
manage_root_alias
maps
master_bounce_command
master_defer_command
master_entries
master_smtp
master_smtps
master_submission
mastercf_content
mastercf_source
mastercf_template
masquerade_classes
masquerade_domains
masquerade_exceptions
mta
mydestination
mynetworks
myorigin
postfix_ensure
relayhost
root_group
root_mail_recipient
satellite
service_enabled
service_ensure
smtp_listen
transports
use_amavisd
use_dovecot_lda
use_schleuder
use_sympa
virtuals
Data type: String
A string defining the location of the alias map file.
Example: hash:/etc/other_aliases
Default value: 'hash:/etc/aliases'
Data type: Integer
Number of amavis scanner processes to spawn
Default value: 2
Data type: Optional[Boolean]
A boolean to define if Postfix should be run in a chroot jail or not.
If not defined, '-' is used (OS dependant)
Example: true
Default value: undef
Data type: Stdlib::Absolutepath
The base path which should be used as confdir
Default value: '/etc/postfix'
Data type: Hash
A hash of postfix::conffile resources
Default value: {}
Data type: Hash
A hash of postfix::config resources. The hash containing optional configuration values for main.cf.
The values are configured using postfix::config.
Example: {'message_size_limit': {'value': '51200000'}}
Default value: {}
Data type: Hash
A hash of postfix::hash resources
Default value: {}
Data type: String
A string defining the network interfaces that Postfix will listen on.
Example: 127.0.0.1, [::1]
Default value: 'all'
Data type: String
A string defining the internet protocols that Postfix will use.
Example: ipv4
Default value: 'all'
Data type: Boolean
A Boolean defining whether to configure Postfix for LDAP use.
Default value: false
Data type: Optional[String]
A string defining the LDAP search base to use. This parameter maps to the
search_base parameter (ldap_table(5)).
Example: cn=Users,dc=example,dc=com
Default value: undef
Data type: Optional[String]
A string defining the LDAP host. This parameter maps to the server_host parameter (ldap_table(5)).
Example: ldaps://ldap.example.com:636 ldap://ldap2.example.com
.
Default value: undef
Data type: Optional[String]
A free form string that can define any LDAP options to be passed through (ldap_table(5)).
Example: start_tls = yes
.
Default value: undef
Data type: Array[String[1]]
An array of package names to install for LDAP support if $ldap is true.
Default value: []
Data type: String
Table format type as described in http://www.postfix.org/DATABASE_README.html#types. Type has to be supported by system, see "postconf -m" for supported types.
Default value: 'hash'
Data type: Hash
A hash of postfix::mailalias resources. The hash containing optional configuration values for main.cf.
The values are configured using postfix::mailalias.
Example: {'nobody': {'ensure': 'present', 'recipient': 'root'}}
Default value: {}
Data type: String
A string defining the mail user, and optionally group, to execute external commands as.
This parameter maps to the user parameter (pipe(8)).
Example: vmail:vmail
.
Default value: 'vmail'
Data type: Boolean
A Boolean defining whether to configure a basic smtp server that is able to work for the mailman mailing list manager.
Default value: false
Data type: String
Installs mailx package
Default value: 'present'
Data type: String
A string defining the location of a skeleton main.cf file to be used. The default file
supplied is blank. However, if the main.cf file already exists on the system the contents
will NOT be replaced by the contents from maincf_source.
Example: puppet:///modules/some/other/location/main.cf
.
Default value: "puppet:///modules/${module_name}/main.cf"
Data type: Boolean
Manage /etc/aliases file
Default value: true
Data type: Boolean
A Boolean defining whether the puppet module should replace the configuration files for postfix. This setting currently effects only the following files:
- /etc/mailname
- /etc/postfix/master.cf
This setting does NOT effect the following files:
- /etc/aliases
- /etc/postfix/main.cf
Default value: true
Data type: Boolean
A Boolean defining whether the puppet module should manage '/etc/mailname'. See also $manage_conffiles
Default value: true
Data type: Boolean
A Boolean defining whether the puppet module should manage the mailx package. See also $mailx_ensure.
Default value: true
Data type: Boolean
Wheter to manage the mailalias for root user
Default value: true
Data type: Hash
A hash of postfix::map resources
Default value: {}
Data type: String
The bounce command which should be used in master.cf
Default value: 'bounce'
Data type: String
The defer command which should be used in master.cf
Default value: 'bounce'
Data type: Array[String]
Array of strings containing additional entries for the /etc/postfix/master.cf file.
Example: ['submission inet n - n - - smtpd']
.
Default value: []
Data type: Optional[String]
A string to define the smtp line in the /etc/postfix/master.cf file.
If this is defined the smtp_listen parameter will be ignored.
Example: smtp inet n - n - - smtpd
.
Default value: undef
Data type: Optional[String]
A string to define the smtps line in the /etc/postfix/master.cf file.
Example: smtps inet n - n - - smtpd
.
Default value: undef
Data type: Optional[String]
A string to define the submission line in the /etc/postfix/master.cf file.
Example: submission inet n - n - - smtpd
.
Default value: undef
Data type: Optional[String]
Set the content parameter for the master.cf file resource.
Default value: undef
Data type: Optional[String]
A string defining the location of a skeleton master.cf file to be used.
Example: puppet:///modules/some/other/location/master.cf
.
Default value: undef
Data type: Optional[String]
Set the epp template path which will be used for master.cf file resource.
Default value: undef
Data type: Optional[Array[String[1]]]
Postfix config parameter masquerade_classes as an array.
What addresses are subject to address masquerading.
Example: ['envelope_sender', 'envelope_recipient', 'header_sender', 'header_recipient']
Default value: undef
Data type: Optional[Array[String[1]]]
An array defining the masquerade_domains to use.
The order of elements matters here, so be aware of how you define the elements.
Example: ['foo.example.com', 'example.com']
Default value: undef
Data type: Optional[Array[String[1]]]
An array defining the masquerade_exceptions to use. This optional list of user names that are not
subjected to address masquerading, even when their addresses match $masquerade_domains.
Example: ['root']
Default value: undef
Data type: Boolean
A Boolean to define whether to configure Postfix as a mail transfer agent. This option is mutually exclusive with the satellite Boolean.
Default value: false
Data type: String
A string to define the mydestination parameter in main.cf (postconf(5)).
Example: example.com, foo.example.com
.
Default value: '$myhostname, localhost.$mydomain, localhost'
Data type: String
A string to define the mynetworks parameter that holds trusted remote smtp clients (postconf(5)).
Example: 127.0.0.0/8, [::1]/128
.
Default value: '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128'
Data type: String
A string to define the myorigin parameter that holds the domain name that mail appears to come from (postconf(5)).
Example: example.com
Default value: $facts['networking']['fqdn']
Data type: String
The ensure value of the postfix package
Default value: 'present'
Data type: Optional[String]
A string to define the relayhost parameter (postconf(5)).
Example: smtp.example.com
.
Default value: undef
Data type: String
The group permission name for the main.cf and master.cf files.
Default value: 'root'
Data type: Variant[Array[String], String]
A string to define the e-mail address to which all mail directed to root should go (aliases(5)).
Example: [email protected]
.
Default value: 'nobody'
Data type: Boolean
A Boolean to define whether to configure Postfix as a satellite relay host. This setting is mutually exclusive with the mta Boolean.
Default value: false
Data type: Boolean
Defines if the service 'postfix' is enabled on the system
Default value: true
Data type: String
Defines the service state of 'postfix' service
Default value: 'running'
Data type: Variant[Array[String[1]], String[1]]
A string or an array of strings to define the IPs on which to listen in master.cf.
This can also be set to 'all' to listen on all interfaces. If master_smtp is defined
smtp_listen will not be used.
Example: ::1
.
Default value: '127.0.0.1'
Data type: Hash
A hash of postfix::transport resources
Default value: {}
Data type: Boolean
A Boolean to define whether to configure master.cf to allow the use of the amavisd scanner.
Default value: false
Data type: Boolean
A Boolean to define whether to configure master.cf to use dovecot as the local delivery agent.
Default value: false
Data type: Variant[Integer[2, 3], Boolean]
A Boolean to define whether to configure master.cf to use the Schleuder GPG-enabled mailing list.
Can be also set to an integer 2
to use Schleuder v2 instead of v3.
Default value: false
Data type: Boolean
A Boolean to define whether to configure master.cf to use the Sympa mailing list management software.
Default value: false
Data type: Hash
A hash of postfix::virtual resources
Default value: {}
This type manages content of the /etc/postfix/canonical map.
# This defined type requires the following resources:
# - Class["postfix"]
# - Postfix::Hash["/etc/postfix/canonical"]
# - Postfix::Config["canonical_maps"] or Postfix::Config["sender_canonical_maps"] or Postfix::Config["recipient_canonical_maps"]
include postfix
postfix::hash { '/etc/postfix/recipient_canonical':
ensure => present,
}
postfix::config { 'canonical_alias_maps':
value => 'hash:/etc/postfix/recipient_canonical',
}
postfix::canonical { '[email protected]':
file => '/etc/postfix/recipient_canonical',
ensure => present,
destination => 'root',
}
The following parameters are available in the postfix::canonical
defined type:
Data type: Enum['present','absent']
Intended state of the resource
Default value: 'present'
Data type: String
Where the emails will be delivered to.
Data type: Stdlib::Absolutepath
Where to create the file. If not defined "${postfix::confdir}/canonical" will be used as path.
Default value: undef
Data type: String[1]
Depends on the lookup table type, which is used on the postfix::hash and postfix::config resources. Defaults to 'db', the suffix of the "hash" type.
Default value: 'db'
Manages Postfix configuration files. With it, you could create configuration files (other than, main.cf, master.cf, etc.) restarting Postfix when necessary.
postfix::conffile { 'ldapoptions.cf':
source => 'puppet:///modules/postfix/ldapoptions.cf',
}
postfix::conffile { 'ldapoptions.cf':
options => {
server_host => ldap.mydomain.com,
bind => 'yes',
bind_dn => 'cn=admin,dc=mydomain,dc=com',
bind_pw => 'password',
search_base => 'dc=example, dc=com',
query_filter => 'mail=%s',
result_attribute => 'uid',
}
}
The following parameters are available in the postfix::conffile
defined type:
Data type: Enum['present', 'absent', 'directory']
A string whose valid values are present, absent or directory.
Default value: 'present'
Data type: Variant[Array[String], String, Undef]
A string with the source of the file. This is the source
parameter of the underlying file resource.
Example: puppet:///modules/postfix/configfile.cf
Default value: undef
Data type: Optional[String]
The content of the Postfix configuration file. This is an alternative to the source
parameter.
If you don't provide source
neither content
parameters a default template is used and the
content is created with values in the options
hash.
Default value: undef
Data type: Optional[Stdlib::Absolutepath]
Where to create the file. If not defined "${postfix::confdir}/${name}" will be used as path.
Default value: undef
Data type: Stdlib::Filemode
Permissions of the configuration file. This option is useful if you want to create the file with
specific permissions (for example, because you have passwords in it).
Example: 0640
Default value: '0640'
Data type: Hash
Hash with the options used in the default template that is used when neither source
neither content
parameters are provided.
Default value: {}
Data type: Boolean
Switch to set file show_diff parameter
Default value: true
Add/alter/remove options in Postfix main configuration file (main.cf). This uses Augeas to do the editing of the configuration file, as such any configuration value can be used.
postfix::config { 'smtp_use_tls':
ensure => 'present',
value => 'yes',
}
postfix::config { 'relayhost':
ensure => 'blank',
}
postfix::config {
'smtp_tls_mandatory_ciphers': value => 'high';
'smtp_tls_security_level': value => 'secure';
'smtp_tls_CAfile': value => '/etc/pki/tls/certs/ca-bundle.crt';
'smtp_tls_session_cache_database': value => 'btree:${data_directory}/smtp_tls_session_cache';
}
postfix::config { 'disable_vrfy_command':
ensure => present,
value => 'yes',
}
The following parameters are available in the postfix::config
defined type:
Data type: Enum['present', 'absent', 'blank']
Defines if the config parameter is present, absent or blank.
The special value 'blank', will clear the value for the parameter,
but will not remove it from the config file.
Example: blank
Default value: 'present'
Data type: Optional[String]
A string that can contain any text to be used as the configuration value.
Example: btree:${data_directory}/smtp_tls_session_cache
.
Default value: undef
Creates Postfix hashed "map" files. It will create "${name}", and then build "${name}.
" using the "postmap" command. The map file can then be referred to using postfix::config.# This example creates a virtual hashmap in the Postfix config dir
# and adds a value into it with the postfix::config type.
postfix::hash { 'virtual':
ensure => present,
}
postfix::config { 'virtual_alias_maps':
value => 'hash:/etc/postfix/virtual',
}
postfix::hash { '/etc/postfix/sasl_passwd':
ensure => 'present',
source => 'puppet:///modules/profile/postfix/client/sasl_passwd',
}
postfix::hash { '/etc/postfix/sasl_passwd':
ensure => 'present',
content => '#Destination Credentials\nsmtp.example.com gssapi:nopassword',
}
The following parameters are available in the postfix::hash
defined type:
Data type: Enum['present', 'absent']
Defines whether the hash map file is present or not. Value can either be present or absent.
Example: absent
.
Default value: 'present'
Data type: Variant[Array[String], String, Undef]
A string whose value is a location for the source file to be used. This parameter is mutually
exclusive with the content parameter, one or the other must be present, but both cannot be present.
Example: puppet:///modules/some/location/sasl_passwd
.
Default value: undef
Data type: Optional[Variant[Sensitive[String],String]]
A free form string that defines the contents of the file. This parameter is mutually exclusive
with the source parameter.
Example: #Destination Credentials\nsmtp.example.com gssapi:nopassword
.
Default value: undef
Data type: Stdlib::Filemode
the desired file mode
Default value: '0640'
Creates an email alias in the local alias database and updates the binary version of said database.
include postfix
postfix::mailalias { 'postmaster':
ensure => present,
recipient => 'foo',
}
The following parameters are available in the postfix::mailalias
defined type:
Data type: Enum['present', 'absent']
Intended state of the resource
Default value: 'present'
Data type: Variant[String, Array[String]]
The recipient address where the mail should be sent to.
Creates Postfix "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.
postfix::map { '/etc/postfix/virtual':
ensure => present,
}
postfix::config { 'virtual_alias_maps':
value => 'hash:/etc/postfix/virtual',
}
The following parameters are available in the postfix::map
defined type:
Data type: Enum['present', 'absent']
Intended state of the resource
Default value: 'present'
Data type: Optional[Variant[Array[String], String]]
Sets the value of the source parameter for the file. Can't be used together with parameter content.
Default value: undef
Data type: Optional[Variant[Sensitive[String], String]]
The content of the file. Can't be used together with param source.
Default value: undef
Data type: String[1]
Type of the Postfix map (valid values are cidr, pcre, hash...)
Default value: 'hash'
Data type: Optional[Stdlib::Absolutepath]
Where to create the file. If not defined "${postfix::confdir}/${name}" will be used as path.
Default value: undef
Data type: Stdlib::Filemode
File mode of the created file.
Default value: '0640'
Manages content of the /etc/postfix/transport map.
include postfix
postfix::hash { '/etc/postfix/transport':
ensure => present,
}
postfix::config { 'transport_maps':
value => 'hash:/etc/postfix/transport, regexp:/etc/postfix/transport_regexp',
}
postfix::transport {
'mailman.example.com':
ensure => present,
destination => 'mailman';
'slow_transport':
ensure => present,
nexthop => '/^user-.*@mydomain\.com/'
file => '/etc/postfix/transport_regexp',
destination => 'slow'
}
The following parameters are available in the postfix::transport
defined type:
Data type: Enum['present', 'absent']
Defines whether the transport entry is present or not. Value can either be present or absent.
Default value: 'present'
Data type: Optional[String]
The destination to be delivered to (transport(5)).
Example: mailman
.
Default value: undef
Data type: Optional[String]
A string to define where and how to deliver the mail (transport(5)).
Example: [smtp.google.com]:25
.
Default value: undef
Data type: Optional[Stdlib::Absolutepath]
Where to create the file. If not defined "${postfix::confdir}/transport" will be used as path.
Default value: undef
Manages content of the /etc/postfix/virtual map.
include postfix
postfix::hash { "/etc/postfix/virtual":
ensure => present,
}
postfix::config { "virtual_alias_maps":
value => "hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp"
}
postfix::virtual { "[email protected]":
ensure => present,
destination => ['root', 'postmaster'],
}
postfix::virtual { "/.+@.+/"
ensure => present,
file => '/etc/postfix/virtual_regexp',
destination => 'root',
}
Route mail bound for '[email protected]' to root.
postfix::virtual {'[email protected]':
ensure => present,
destination => 'root',
}
The following parameters are available in the postfix::virtual
defined type:
Data type: Enum['present', 'absent']
A string whose valid values are present or absent.
Default value: 'present'
Data type: Variant[String, Array[String]]
A string defining where the e-mails will be delivered to, (virtual(8)).
Example: root
Data type: Optional[Stdlib::Absolutepath]
A string defining the location of the virtual map, pre hash.
If not defined "${postfix::confdir}/virtual" will be used as path.
Example: /etc/postfix/my_virtual_map
.
Default value: undef