Puppet Class: sendmail::mc
- Inherits:
- sendmail::params
- Defined in:
- manifests/mc.pp
Overview
Class: sendmail::mc
Manage the sendmail.mc file
Parameters:
- ostype
-
The value for the OSTYPE macro in the sendmail.mc file. Default value: operating system specific.
- sendmail_mc_domain
-
The name of the m4 file that holds common data for a domain. This is an optional configuration item. It may be used by large sites to gather shared data into one file. Some Linux distributions (e.g. Debian) use this setting to provide defaults for certain features. Default value: operating system specific.
- cf_version
-
The configuration version string for Sendmail. This string will be appended to the Sendmail version in the HELO message. If unset, no configuration version will be used. Default value: undef.
- smart_host
-
Servers that are behind a firewall may not be able to deliver mail directly to the outside world. In this case the host may need to forward the mail to the gateway machine defined by this parameter. All nonlocal mail is forwarded to this gateway. Default value: undef.
- domain_name
-
Sets the official canonical name of the local machine. Normally this parameter is not required as Sendmail uses the fully qualified domain name by default. Setting this parameter will override the value of the ‘$j’ macro in the sendmail.cf file. Default value: undef.
- max_message_size
-
Define the maximum message size that will be accepted. This can be a pure numerical value given in bytes (e.g. 33554432) or a number with a prefixed byte unit (e.g. 32MB). The conversion is done using the 1024 convention (see the ‘to_bytes’ function in the ‘stdlib’ module), so valid prefixes are either ‘k’ for 1024 bytes or ‘M’ for 1048576 bytes. Default value: undef.
- log_level
-
The loglevel for the sendmail process. Valid options: a numeric value. Default value: undef.
- dont_probe_interfaces
-
Sendmail normally probes all network interfaces to get the hostnames that the server may have. These hostnames are then considered local. This option can be used to prevent the reverse lookup of the network addresses. If this option is set to ‘localhost’ then all network interfaces except for the loopback interface is probed. Valid options: the strings ‘true’, ‘false’ or ‘localhost’. Default value: undef.
- enable_ipv4_daemon
-
Should the host accept mail on all IPv4 network adresses. Valid options: ‘true’ or ‘false’. Default value: ‘true’.
- enable_ipv6_daemon
-
Should the host accept mail on all IPv6 network adresses. Valid options: ‘true’ or ‘false’. Default value: ‘true’.
- mailers
-
An array of mailers to add to the configuration. Default value: [ ‘smtp’, ‘local’ ]
- trust_auth_mech
-
The value of the TRUST_AUTH_MECH macro to set. If this is a string it is used as-is. For an array the value will be concatenated into a string. Default value: undef
- version_id
-
The version id string included in the sendmail.mc file. This has no practical meaning other than having a used defined identifier in the file. Default value: undef.
Requires:
Nothing.
Sample Usage:
class { 'sendmail::mc': }
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'manifests/mc.pp', line 91
class sendmail::mc (
String $ostype = $::sendmail::params::sendmail_mc_ostype,
Optional[String] $sendmail_mc_domain = $::sendmail::params::sendmail_mc_domain,
Optional[String] $cf_version = undef,
Optional[String] $smart_host = undef,
Optional[String] $domain_name = undef,
Optional[Pattern[/^[0-9]*\s*([kM][bB])?$/]] $max_message_size = undef,
Optional[Sendmail::Loglevel] $log_level = undef,
Optional[Boolean] $dont_probe_interfaces = undef,
Boolean $enable_ipv4_daemon = true,
Boolean $enable_ipv6_daemon = true,
Array[String] $mailers = $::sendmail::params::mailers,
Variant[String,Array[String]] $trust_auth_mech = [],
Optional[String] $version_id = undef,
) inherits sendmail::params {
include sendmail::makeall
# Order of fragments
# -------------------------
# 00 # file header
# 01 VERSIONID
# 05 OSTYPE
# 07 DOMAIN
# 10 # define header
# 12 define
# 16 define (timeouts)
# 18 # LDAP header
# 19 LDAP config
# 20 # FEATURE header
# 22 FEATURE
# 28 FEATURE (conncontrol, ratecontrol)
# 29 FEATURE (nullclient)
# 30 MASQUERADE_AS
# 32 GENERICS_DOMAIN, GENERICS_DOMAIN_FILE
# 33 # queue group header
# 34 QUEUE_GROUP
# 35 # macro header
# 37 VIRTUSER_DOMAIN
# 38 MODIFY_MAILER_FLAGS
# 40 DAEMON_OPTIONS
# 45 TRUST_AUTH_MECH
# 47-48 STARTTLS
# 50 # DNSBL header
# 51 DNSBL features
# 55 # Milter header
# 56 Milter
# 60 # MAILER header
# 61-69 MAILER
# 80 LOCAL_CONFIG header
# 81 LOCAL_CONFIG
# LOCAL_RULE_*
# LOCAL_RULESETS
concat { 'sendmail.mc':
ensure => 'present',
path => $::sendmail::params::sendmail_mc_file,
owner => 'root',
group => $::sendmail::params::sendmail_group,
mode => '0644',
notify => Class['sendmail::makeall'],
}
concat::fragment { 'sendmail_mc-header':
target => 'sendmail.mc',
order => '00',
content => epp('sendmail/header.m4.epp'),
}
if $cf_version {
sendmail::mc::define { 'confCF_VERSION':
expansion => $cf_version,
}
}
if $version_id {
sendmail::mc::versionid { $version_id: }
}
if $ostype {
sendmail::mc::ostype { $ostype: }
}
if $sendmail_mc_domain {
sendmail::mc::domain { $sendmail_mc_domain: }
}
if $smart_host {
sendmail::mc::define { 'SMART_HOST':
expansion => $smart_host,
}
}
if $domain_name {
sendmail::mc::define { 'confDOMAIN_NAME':
expansion => $domain_name,
}
}
if $log_level {
sendmail::mc::define { 'confLOG_LEVEL':
expansion => $log_level,
}
}
if $max_message_size {
sendmail::mc::define { 'confMAX_MESSAGE_SIZE':
expansion => to_bytes($max_message_size),
}
}
if $dont_probe_interfaces {
sendmail::mc::define { 'confDONT_PROBE_INTERFACES':
expansion => bool2str($dont_probe_interfaces),
}
}
if $enable_ipv4_daemon {
sendmail::mc::daemon_options { 'MTA-v4':
family => 'inet',
port => 'smtp',
}
}
if $enable_ipv6_daemon {
sendmail::mc::daemon_options { 'MTA-v6':
family => 'inet6',
port => 'smtp',
modify => 'O',
}
}
if ($mailers and !empty($mailers)) {
sendmail::mc::mailer { $mailers:
}
}
if $trust_auth_mech and !empty($trust_auth_mech) {
class { 'sendmail::mc::trust_auth_mech':
trust_auth_mech => $trust_auth_mech,
}
}
if ($::os['family'] == 'FreeBSD') {
# FreeBSD uses a sendmail.mc file named after the hostname of the
# machine. Unfortunately Puppet doesn't know, if $::hostname or $::fqdn
# will be the correct fact to determine the file name that the makefile
# expects (the hostname command is used by the makefile). Therefore we
# use a symbolic link here to create the second alternative.
file { "${::sendmail::params::mail_settings_dir}/${::fqdn}.mc":
ensure => link,
target => "${::hostname}.mc",
before => Concat['sendmail.mc'],
}
}
}
|