1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 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
|
# @summary Manages the Postfix related files
#
# @api private
#
class postfix::files {
assert_private()
$alias_maps = $postfix::all_alias_maps
$amavis_procs = $postfix::amavis_procs
$inet_interfaces = $postfix::inet_interfaces
$inet_protocols = $postfix::inet_protocols
$mail_user = $postfix::mail_user
$manage_conffiles = $postfix::manage_conffiles
$maincf_source = $postfix::maincf_source
$mastercf_source = $postfix::mastercf_source
$mastercf_content = $postfix::mastercf_content
$mastercf_template = $postfix::mastercf_template
$master_smtp = $postfix::master_smtp
$master_smtps = $postfix::master_smtps
$master_submission = $postfix::master_submission
$master_entries = $postfix::master_entries
$master_bounce_command = $postfix::master_bounce_command
$master_defer_command = $postfix::master_defer_command
$myorigin = $postfix::myorigin
$manage_mailname = $postfix::manage_mailname
$manage_aliases = $postfix::manage_aliases
$manage_root_alias = $postfix::manage_root_alias
$root_mail_recipient = $postfix::root_mail_recipient
$chroot = $postfix::chroot
$smtp_listen = $postfix::_smtp_listen
$use_amavisd = $postfix::use_amavisd
$use_dovecot_lda = $postfix::use_dovecot_lda
$use_schleuder = $postfix::use_schleuder
$use_sympa = $postfix::use_sympa
assert_type(Optional[String], $mastercf_source)
assert_type(Optional[String], $master_smtp)
assert_type(Optional[String], $master_smtps)
$jail = $chroot ? {
true => 'y',
default => 'n',
}
File {
replace => $manage_conffiles,
}
if $manage_mailname {
file { '/etc/mailname':
ensure => 'file',
content => "${facts['networking']['fqdn']}\n",
mode => '0644',
seltype => $postfix::params::seltype,
}
}
# Aliases
if $manage_aliases {
file { '/etc/aliases':
ensure => 'file',
content => "# file managed by puppet\n",
notify => Exec['newaliases'],
replace => false,
seltype => $postfix::params::aliasesseltype,
}
}
# Config files
if $mastercf_source {
$_mastercf_content = undef
} elsif $mastercf_content {
$_mastercf_content = $mastercf_content
} elsif $mastercf_template {
$_mastercf_content = epp($mastercf_template)
} else {
$_mastercf_content = template(
$postfix::params::master_os_template,
'postfix/master.cf.common.erb'
)
}
file { "${postfix::confdir}/master.cf":
ensure => 'file',
content => $_mastercf_content,
group => $postfix::root_group,
mode => '0644',
owner => 'root',
seltype => $postfix::params::seltype,
source => $mastercf_source,
}
# Config files
file { "${postfix::confdir}/main.cf":
ensure => 'file',
group => $postfix::root_group,
mode => '0644',
owner => 'root',
replace => false,
seltype => $postfix::params::seltype,
source => $maincf_source,
}
postfix::config {
'alias_maps': value => $alias_maps;
'inet_interfaces': value => $inet_interfaces;
'inet_protocols': value => $inet_protocols;
'myorigin': value => $myorigin;
}
case $facts['os']['family'] {
'RedHat': {
postfix::config {
'mailq_path': value => '/usr/bin/mailq.postfix';
'newaliases_path': value => '/usr/bin/newaliases.postfix';
'sendmail_path': value => '/usr/sbin/sendmail.postfix';
}
}
default: {}
}
if $manage_aliases and $manage_root_alias {
postfix::mailalias { 'root':
recipient => $root_mail_recipient,
}
}
}
|