Puppet Class: sendmail::mc
- Inherits:
- sendmail::params
- Defined in:
- manifests/mc.pp
Summary
Manage the sendmail.mc fileOverview
This class uses the ‘concat` module to create configuration fragments to assemble the final configuration file.
On FreeBSD the daemon configuration file is named after the hostname of the server. In this case the class also manages a symbolic link in ‘/etc/mail` to reference the file.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 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 |
# File 'manifests/mc.pp', line 70
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 ($facts['os']['family'] == 'FreeBSD') {
# FreeBSD uses a sendmail.mc file named after the hostname of the
# machine. Unfortunately Puppet doesn't know, if
# $facts[networking][hostname] or $facts[networking][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}/${facts[networking][fqdn]}.mc":
ensure => link,
target => "${facts[networking][hostname]}.mc",
before => Concat['sendmail.mc'],
}
}
}
|