summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-08-26 11:31:22 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-08-26 11:31:22 -0300
commitdb85b89742382894cb5736fa6a654e92dc92bf20 (patch)
treefa3e27e1b01b11c785490a08c9399f6ccedfb7e4
parent012f17f3f9acf8fc6f18a832715a751e379693ca (diff)
downloadpuppet-mail-db85b89742382894cb5736fa6a654e92dc92bf20.tar.gz
puppet-mail-db85b89742382894cb5736fa6a654e92dc92bf20.tar.bz2
Major refactor to enhance per-subsystem config isolation
-rw-r--r--manifests/base.pp53
-rw-r--r--manifests/packages.pp12
-rw-r--r--manifests/postfixadmin.pp29
-rw-r--r--manifests/regexps.pp17
-rw-r--r--manifests/regular.pp5
-rw-r--r--manifests/schleuder.pp3
-rw-r--r--manifests/sympa.pp50
-rw-r--r--manifests/system.pp71
-rw-r--r--manifests/virtual.pp32
-rw-r--r--manifests/web.pp2
-rw-r--r--templates/postfix/sympa/transport_regexp.erb (renamed from templates/postfix/transport_regexp.erb)0
-rw-r--r--templates/postfix/sympa/virtual_regexp.erb (renamed from templates/postfix/virtual_regexp.erb)0
12 files changed, 148 insertions, 126 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index f3b68e4..a8bd59a 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -11,65 +11,18 @@ class mail::base {
"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,
}
}
diff --git a/manifests/packages.pp b/manifests/packages.pp
index ec52009..0cc4a71 100644
--- a/manifests/packages.pp
+++ b/manifests/packages.pp
@@ -1,14 +1,20 @@
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,
}
diff --git a/manifests/postfixadmin.pp b/manifests/postfixadmin.pp
index be3e312..e00d8ce 100644
--- a/manifests/postfixadmin.pp
+++ b/manifests/postfixadmin.pp
@@ -1,4 +1,28 @@
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
#
@@ -9,6 +33,11 @@ class mail::postfixadmin {
#
# 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'],
diff --git a/manifests/regexps.pp b/manifests/regexps.pp
new file mode 100644
index 0000000..d05ad68
--- /dev/null
+++ b/manifests/regexps.pp
@@ -0,0 +1,17 @@
+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'],
+ }
+}
diff --git a/manifests/regular.pp b/manifests/regular.pp
new file mode 100644
index 0000000..da35e33
--- /dev/null
+++ b/manifests/regular.pp
@@ -0,0 +1,5 @@
+class mail::regular {
+ postfix::config { "virtual_alias_maps":
+ value => 'hash://postfix/virtual, regexp:/etc/postfix/virtual_regexp',
+ }
+}
diff --git a/manifests/schleuder.pp b/manifests/schleuder.pp
index ec31e11..ae51c9c 100644
--- a/manifests/schleuder.pp
+++ b/manifests/schleuder.pp
@@ -1,4 +1,7 @@
class mail::schleuder {
+ # Schleuder subsystems
+ include mail::packages::schleuder
+
postfix::config { "schleuder_destination_recipient_limit": value => '1' }
postfix::transport { "encrypted.$domain":
diff --git a/manifests/sympa.pp b/manifests/sympa.pp
index 78ec9e4..18e8c9a 100644
--- a/manifests/sympa.pp
+++ b/manifests/sympa.pp
@@ -1,4 +1,33 @@
-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
#
@@ -30,24 +59,15 @@ class mail::sympa {
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 {
diff --git a/manifests/system.pp b/manifests/system.pp
index 53ec12f..e48f52e 100644
--- a/manifests/system.pp
+++ b/manifests/system.pp
@@ -10,84 +10,41 @@ class mail::system {
'': { $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
}
}
diff --git a/manifests/virtual.pp b/manifests/virtual.pp
new file mode 100644
index 0000000..5035c77
--- /dev/null
+++ b/manifests/virtual.pp
@@ -0,0 +1,32 @@
+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'],
+ }
+}
diff --git a/manifests/web.pp b/manifests/web.pp
index 2bfd5c4..73db06c 100644
--- a/manifests/web.pp
+++ b/manifests/web.pp
@@ -1,4 +1,4 @@
-class mail::web inherits websites::setup {
+class mail::web::virtual inherits websites::setup {
include php::imap
apache::site { "postfixadmin":
diff --git a/templates/postfix/transport_regexp.erb b/templates/postfix/sympa/transport_regexp.erb
index a7885f7..a7885f7 100644
--- a/templates/postfix/transport_regexp.erb
+++ b/templates/postfix/sympa/transport_regexp.erb
diff --git a/templates/postfix/virtual_regexp.erb b/templates/postfix/sympa/virtual_regexp.erb
index b1c1245..b1c1245 100644
--- a/templates/postfix/virtual_regexp.erb
+++ b/templates/postfix/sympa/virtual_regexp.erb