smtpd: Add support for custom config file

This commit is contained in:
Ossi Salmi 2015-05-20 09:26:27 +03:00
parent 6444c95460
commit a509469be1

View file

@ -18,6 +18,9 @@
# $maildir:
# Directory in user home for INBOX. Defaults to "Mail".
#
# $config:
# Path to custom configuration file.
#
# $custom:
# Array of custom accept/reject rules.
#
@ -39,6 +42,7 @@ class smtpd(
$listen=false,
$gecos=true,
$maildir="Mail",
$config=undef,
$custom=undef,
$domains=undef,
$virtuals=undef,
@ -130,6 +134,15 @@ class smtpd(
include ssl
if $config {
$content = undef
} else {
$content = $listen ? {
true => template("smtpd/server.conf.erb"),
default => template("smtpd/client.conf.erb"),
}
}
file { "${confdir}/smtpd.conf":
ensure => present,
mode => "0644",
@ -138,10 +151,8 @@ class smtpd(
"openbsd" => "wheel",
default => "root",
},
content => $listen ? {
true => template("smtpd/server.conf.erb"),
default => template("smtpd/client.conf.erb"),
},
source => $config,
content => $content,
notify => Service[$service],
}
@ -154,21 +165,7 @@ class smtpd(
},
}
if $listen == true {
include procmail
procmail::rc { "00-default.rc":
content => "MAILDIR=\$HOME/${maildir}\nDEFAULT=\$MAILDIR/INBOX\n",
}
file { [ "/root/${maildir}", "/etc/skel/${maildir}" ]:
ensure => directory,
mode => "0700",
owner => "root",
group => "wheel",
before => Service["smtpd"],
}
if $listen == true or $config {
file { "${ssl::private}/smtpd.key":
ensure => present,
mode => "0600",
@ -185,6 +182,22 @@ class smtpd(
source => $ssl_cert,
notify => Service["smtpd"],
}
}
if $listen == true {
include procmail
procmail::rc { "00-default.rc":
content => "MAILDIR=\$HOME/${maildir}\nDEFAULT=\$MAILDIR/INBOX\n",
}
file { [ "/root/${maildir}", "/etc/skel/${maildir}" ]:
ensure => directory,
mode => "0700",
owner => "root",
group => "wheel",
before => Service["smtpd"],
}
if $gecos == true {
file { "/usr/local/sbin/generate-smtpd-gecos.sh":