+# add an exim virtualdomain entry on this host
+#
+# @param mail_user User to run the virtual email domain's pipe jobs and deliveries as
+# @param mail_group Group to run the virtual email domain's pipe jobs and deliveries as
+# @param owner User to own the directories and files
+# @param group Group to own the directories and files
+# @param domain email domain (defaults to $name)
+# @param basedir Base directory (it gets created), usually is and defaults to /srv/$name
+# @param maildir Mail directory, usually under base and defaults to $basedir/mail
define exim::vdomain (
- $alias_file,
- $user,
- $group,
- $maildir="/srv/${name}",
- $domain=$name,
+ String $domain = $name,
+ String $basedir = "/srv/${name}",
+ String $maildir = "${basedir}/mail",
+ String $owner = 'root',
+ String $group = 'root',
+ String $mail_user = $owner,
+ String $mail_group = $group,
) {
- file { $maildir:
+ file { $basedir:
ensure => directory,
- mode => '0755',
- owner => root,
- group => root
+ mode => '2755',
+ owner => $owner,
+ group => $group,
}
- file { "${maildir}/mail":
+ file { "${maildir}":
ensure => directory,
- mode => '0755',
- owner => root,
- group => root
+ mode => '2755',
+ owner => $owner,
+ group => $group,
}
- file { "${maildir}/mail/aliases":
- source => $alias_file,
- mode => '0644',
- owner => root,
- group => root
+ file { [
+ "${maildir}/aliases",
+ "${maildir}/callout_users",
+ "${maildir}/grey_users",
+ "${maildir}/neversenders",
+ "${maildir}/rbllist",
+ "${maildir}/rhsbllist",
+ ] :
+ mode => '0644',
+ owner => $owner,
+ group => $group,
}
concat::fragment { "virtualdomain_${domain}":
target => '/etc/exim4/virtualdomains',
- content => "${domain}: user=${user} group=${group} directory=${maildir}/mail\n",
+ content => "${domain}: user=${mail_user} group=${mail_group} directory=${maildir}\n",
}
}