smtpd: Initial server support
Still missing are TLS and authentication support.
This commit is contained in:
parent
0b7dca59d3
commit
ce5dd6a96d
4 changed files with 142 additions and 8 deletions
|
@ -5,11 +5,15 @@
|
|||
# $mail_domain:
|
||||
# Domain to masquerade as (envelope only).
|
||||
#
|
||||
# $smtpd_relay:
|
||||
# URI of mail relay server.
|
||||
# $mail_server:
|
||||
# Hostname of mail relay server.
|
||||
#
|
||||
class smtpd {
|
||||
|
||||
if $mail_server {
|
||||
$relay = "smtp+tls://${mail_server}"
|
||||
}
|
||||
|
||||
file { "/etc/mailer.conf":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
|
@ -20,6 +24,15 @@ class smtpd {
|
|||
}
|
||||
|
||||
file { "/etc/mail/smtpd.conf":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
source => "puppet:///modules/smtpd/smtpd.conf",
|
||||
notify => Service["smtpd"],
|
||||
}
|
||||
|
||||
file { "/etc/mail/smtpd.conf.local":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
|
@ -41,3 +54,102 @@ class smtpd {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Configure smtpd as mail server
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $maildir:
|
||||
# Directory in user home for INBOX.
|
||||
#
|
||||
# $domains:
|
||||
# Primary domains to accept mail for.
|
||||
#
|
||||
# $virtual:
|
||||
# Virtual domains to accept mail for.
|
||||
#
|
||||
class smtpd::server($maildir, $domains, $virtual=undef) inherits smtpd {
|
||||
|
||||
include procmail
|
||||
|
||||
procmail::rc { "00default.rc":
|
||||
content => "MAILDIR=\$HOME/${maildir}\nDEFAULT=\$MAILDIR/INBOX\n",
|
||||
}
|
||||
|
||||
$mda = "/usr/local/bin/procmail -Y -t -f %{sender} rcpt=%{rcpt}"
|
||||
|
||||
File["/etc/mail/smtpd.conf.local"] {
|
||||
content => template("smtpd/server.conf.erb"),
|
||||
}
|
||||
|
||||
file { "/etc/mail/aliases":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
source => [
|
||||
"puppet:///files/mail/aliases.${::homename}",
|
||||
"puppet:///files/mail/aliases",
|
||||
],
|
||||
}
|
||||
exec { "makemap -t aliases /etc/mail/aliases":
|
||||
refreshonly => true,
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
subscribe => File["/etc/mail/aliases"],
|
||||
notify => Service["smtpd"],
|
||||
}
|
||||
|
||||
smtpd::aliases { $domains: }
|
||||
|
||||
if $virtual {
|
||||
smtpd::virtual { $virtual: }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
define smtpd::aliases() {
|
||||
|
||||
file { "/etc/mail/aliases.${name}":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
source => [
|
||||
"puppet:///files/mail/aliases.${name}",
|
||||
"puppet:///files/mail/aliases.${::homename}",
|
||||
"puppet:///files/mail/aliases",
|
||||
],
|
||||
}
|
||||
exec { "makemap -t aliases /etc/mail/aliases.${name}":
|
||||
refreshonly => true,
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
subscribe => File["/etc/mail/aliases.${name}"],
|
||||
notify => Service["smtpd"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
define smtpd::virtual() {
|
||||
|
||||
file { "/etc/mail/virtual.${name}":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
source => [
|
||||
"puppet:///files/mail/virtual.${name}",
|
||||
"puppet:///files/mail/virtual.${::homename}",
|
||||
"puppet:///files/mail/virtual",
|
||||
],
|
||||
}
|
||||
exec { "makemap -t aliases /etc/mail/virtual.${name}":
|
||||
refreshonly => true,
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
subscribe => File["/etc/mail/virtual.${name}"],
|
||||
notify => Service["smtpd"],
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue