"virtual_mailbox_base": value => '/var/mail/virtual';
"virtual_uid_maps": value => 'static:5000';
"virtual_gid_maps": value => 'static:5000';
- "virtual_transport": value => 'dovecot';
- "dovecot_destination_recipient_limit": value => '1';
"recipient_delimiter": value => '+';
}
- postfix::hash { "/etc/postfix/virtual":
- ensure => present,
- }
-
- postfix::hash { "/etc/postfix/transport":
- ensure => present,
- }
-
# Recipient restrictions
postfix::config { "smtpd_recipient_restrictions":
value => 'permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client psbl.surriel.com, check_policy_service inet:127.0.0.1:60000' }
- # Virtual mailboxes
- file { '/var/mail/virtual':
- ensure => directory,
- owner => vmail,
- group => vmail,
- mode => 0750,
- require => User['vmail'],
- }
-
- group { "vmail":
+ postfix::hash { "/etc/postfix/virtual":
ensure => present,
- gid => 5000,
}
- user { "vmail":
- ensure => present,
- uid => 5000,
- gid => "vmail",
- password => "*",
- home => '/var/mail/virtual',
- require => Group['vmail'],
- }
-
- # Sympa mailing list manager
- case $mail_sympa {
- true: { }
- default: {
- file { "/etc/postfix/transport_regexp":
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- notify => Service['postfix'],
- }
-
- file { "/etc/postfix/virtual_regexp":
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- notify => Service['postfix'],
- }
- }
+ postfix::hash { "/etc/postfix/transport":
+ ensure => present,
}
}
class mail::packages {
# The needed packages
- package { [ 'postfix-mysql', 'dovecot-imapd', 'maildrop' ]:
+ package { [ 'postgrey', 'amavisd-new', 'spamassassin', 'spamc' ]:
ensure => installed,
}
- package { [ 'postgrey', 'amavisd-new', 'spamassassin', 'spamc', 'libpam-mysql', 'libgsasl7' ]:
+ package { [ 'clamav-base', 'clamav-daemon', 'clamav-freshclam' ]:
ensure => installed,
}
+}
- package { [ 'clamav-base', 'clamav-daemon', 'clamav-freshclam' ]:
+class mail::packages::virtual {
+ package { [ 'libpam-mysql', 'libgsasl7' ]:
+ ensure => installed,
+ }
+
+ package { [ 'postfix-mysql', 'dovecot-imapd', 'maildrop' ]:
ensure => installed,
}
class mail::postfixadmin {
+ # Class configuration
+ case $postfixadmin_database_password {
+ '': { fail("You need to define \$postfixadmin_database_password host config") }
+ }
+
+ case $postfixadmin_setup_hash {
+ '': {
+ warning("You need to define \$postfixadmin_setup_hash host config")
+ $postfixadmin_setup_hash = 'changeme'
+ }
+ }
+
+ case $postfixadmin_database_user {
+ '': { $postfixadmin_database_user = "postfix" }
+ }
+
+ case $postfixadmin_database_host {
+ '': { $postfixadmin_database_host = "localhost" }
+ }
+
+ case $postfixadmin_database_name {
+ '': { $postfixadmin_database_name= "postfix" }
+ }
+
#
# Database configuration
#
#
# Postfix configuration
#
+ postfix::config {
+ "virtual_transport": value => 'dovecot';
+ "dovecot_destination_recipient_limit": value => '1';
+ }
+
postfix::config { "virtual_mailbox_domains":
value => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf',
require => File['/etc/postfix/sql/mysql_virtual_domains_maps.cf'],
--- /dev/null
+class mail::regexps {
+ file { "/etc/postfix/transport_regexp":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ notify => Service['postfix'],
+ }
+
+ file { "/etc/postfix/virtual_regexp":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ notify => Service['postfix'],
+ }
+}
--- /dev/null
+class mail::regular {
+ postfix::config { "virtual_alias_maps":
+ value => 'hash://postfix/virtual, regexp:/etc/postfix/virtual_regexp',
+ }
+}
class mail::schleuder {
+ # Schleuder subsystems
+ include mail::packages::schleuder
+
postfix::config { "schleuder_destination_recipient_limit": value => '1' }
postfix::transport { "encrypted.$domain":
-class mail::sympa {
+class mail::sympa inherits mail::regexps {
+ # Sympa subsystems
+ include mail::web::sympa
+ include mail::packages::sympa
+
+ # Class configuration
+ case $sympa_database_password {
+ '': { fail("You need to define \$sympa_database_password host config") }
+ }
+
+ case $sympa_database_name {
+ '': { $sympa_database_name= "sympa" }
+ }
+
+ case $sympa_database_host {
+ '': { $sympa_database_host = "localhost" }
+ }
+
+ case $sympa_subdomain {
+ '': { $sympa_subdomain = "lists" }
+ }
+
+ case $sympa_listmasters {
+ '': { $sympa_listmasters = "listmaster@${fqdn}" }
+ }
+
+ case $sympa_lang {
+ '': { $sympa_lang = "en_US" }
+ }
+
#
# Database configuration
#
mode => 0640,
content => template('mail/sympa/sympa.conf.erb'),
require => [ File['/etc/sympa'], User['sympa'] ],
+ notify => Service['apache'],
}
- file { "/etc/postfix/transport_regexp":
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- content => template('mail/postfix/transport_regexp.erb'),
- notify => Service['postfix'],
+ File["/etc/postfix/transport_regexp"] {
+ content => template('mail/postfix/sympa/transport_regexp.erb'),
}
- file { "/etc/postfix/virtual_regexp":
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- content => template('mail/postfix/virtual_regexp.erb'),
- notify => Service['postfix'],
+ File["/etc/postfix/virtual_regexp"] {
+ content => template('mail/postfix/sympa/virtual_regexp.erb'),
}
postfix::config {
'': { $postfix_mynetworks = "127.0.0.0/8" }
}
- case $postfixadmin_database_password {
- '': { fail("You need to define \$postfixadmin_database_password host config") }
- }
-
- case $postfixadmin_setup_hash {
- '': {
- warning("You need to define \$postfixadmin_setup_hash host config")
- $postfixadmin_setup_hash = 'changeme'
- }
- }
-
- case $postfixadmin_database_user {
- '': { $postfixadmin_database_user = "postfix" }
- }
-
- case $postfixadmin_database_host {
- '': { $postfixadmin_database_host = "localhost" }
- }
-
- case $postfixadmin_database_name {
- '': { $postfixadmin_database_name= "postfix" }
- }
-
# Module requirements
include postfix
- include database
include ssl::mail
- # Subsystems
+ # Common subsystems
include mail::packages
include mail::base
- include mail::sasl
include mail::tls
- include mail::dovecot
include mail::amavisd
include mail::header_checks
- include mail::postfixadmin
- include mail::web
include mail::clamav
+ # Virtual mail system
+ case $mail_virtual {
+ true: {
+ include mail::virtual
+ }
+ default: {
+ include mail::regular
+ }
+ }
+
# Sympa mailing list manager
case $mail_sympa {
true: {
-
- case $sympa_database_password {
- '': { fail("You need to define \$sympa_database_password host config") }
- }
-
- case $sympa_database_name {
- '': { $sympa_database_name= "sympa" }
- }
-
- case $sympa_database_host {
- '': { $sympa_database_host = "localhost" }
- }
-
- case $sympa_subdomain {
- '': { $sympa_subdomain = "lists" }
- }
-
- case $sympa_listmasters {
- '': { $sympa_listmasters = "listmaster@${fqdn}" }
- }
-
- case $sympa_lang {
- '': { $sympa_lang = "en_US" }
- }
-
include mail::sympa
- include mail::web::sympa
- include mail::packages::sympa
+ }
+ default: {
+ include mail::regexps
}
}
# Schleuder mailing list manager
case $mail_schleuder {
true: {
- include mail::packages::schleuder
include mail::schleuder
}
}
--- /dev/null
+class mail::virtual {
+ # Virtual subsystems
+ include database
+ include mail::packages::virtual
+ include mail::sasl
+ include mail::dovecot
+ include mail::postfixadmin
+ include mail::web::virtual
+
+ # Virtual mailboxes
+ file { '/var/mail/virtual':
+ ensure => directory,
+ owner => vmail,
+ group => vmail,
+ mode => 0750,
+ require => User['vmail'],
+ }
+
+ group { "vmail":
+ ensure => present,
+ gid => 5000,
+ }
+
+ user { "vmail":
+ ensure => present,
+ uid => 5000,
+ gid => "vmail",
+ password => "*",
+ home => '/var/mail/virtual',
+ require => Group['vmail'],
+ }
+}
-class mail::web inherits websites::setup {
+class mail::web::virtual inherits websites::setup {
include php::imap
apache::site { "postfixadmin":