summaryrefslogtreecommitdiff
path: root/manifests/virtual
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/virtual')
-rw-r--r--manifests/virtual/database.pp119
-rw-r--r--manifests/virtual/packages.pp29
-rw-r--r--manifests/virtual/params.pp5
-rw-r--r--manifests/virtual/web.pp73
4 files changed, 226 insertions, 0 deletions
diff --git a/manifests/virtual/database.pp b/manifests/virtual/database.pp
new file mode 100644
index 0000000..32259a4
--- /dev/null
+++ b/manifests/virtual/database.pp
@@ -0,0 +1,119 @@
+class mail::virtual::database {
+ # Class configuration
+ case $database_password {
+ '': { fail("You need to define database_password host config") }
+ }
+
+ #
+ # Database configuration
+ #
+ database::instance { "${mail::virtual::database_name}":
+ password => "${mail::virtual::database_password}",
+ }
+
+ #
+ # Postfix configuration
+ #
+ postfix::config {
+ "virtual_transport": value => 'dovecot';
+ "dovecot_destination_recipient_limit": value => '1', nonstandard => true;
+ }
+
+ 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'],
+ }
+
+ postfix::config { "virtual_alias_maps":
+ value => 'hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf',
+ require => File['/etc/postfix/sql/mysql_virtual_alias_maps.cf',
+ '/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf',
+ '/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf' ],
+ }
+
+ postfix::config { "virtual_mailbox_maps":
+ value => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf',
+ require => File['/etc/postfix/sql/mysql_virtual_mailbox_maps.cf',
+ '/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf' ],
+ }
+
+ #
+ # Map files
+ #
+ file { "/etc/postfix/sql":
+ ensure => directory,
+ owner => postfix,
+ group => root,
+ mode => 0755,
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_domains_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_domains_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_alias_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_alias_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_alias_domain_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_alias_domain_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_alias_domain_catchall_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_alias_domain_catchall_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_mailbox_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_mailbox_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ file { "/etc/virtual/database/mysql_virtual_alias_domain_mailbox_maps.cf":
+ ensure => present,
+ owner => postfix,
+ mode => 0600,
+ content => template('mail/virtual/database/mysql_virtual_alias_domain_mailbox_maps.cf.erb'),
+ require => File['/etc/virtual/database'],
+ }
+
+ #
+ # Additional for quota support
+ #
+ #postfix::config { "virtual_mailbox_limit_maps":
+ # value => 'mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf',
+ # require => File['/etc/postfix/mysql_virtual_mailbox_limit_maps.cf'],
+ #}
+ #
+ #postfix::config { "virtual_create_maildirsize": value => 'yes' }
+ #postfix::config { "virtual_mailbox_extended ": value => 'yes' }
+ #postfix::config { "virtual_mailbox_limit_override": value => 'yes' }
+ #postfix::config { "virtual_maildir_limit_message": value => 'The user's maildir has overdrawn his quota, try again later.' }
+ #postfix::config { "virtual_overquota_bounce": value => 'yes' }
+ #
+ #file { "/etc/postfix/mysql_virtual_mailbox_limit_maps.cf":
+ # ensure => present,
+ # owner => postfix,
+ # mode => 0600,
+ # content => template('mail/virtual/database/mysql_virtual_mailbox_limit_maps.cf.erb'),
+ # require => File['/etc/virtual/database'],
+ #}
+}
diff --git a/manifests/virtual/packages.pp b/manifests/virtual/packages.pp
new file mode 100644
index 0000000..809115f
--- /dev/null
+++ b/manifests/virtual/packages.pp
@@ -0,0 +1,29 @@
+class mail::virtual::packages {
+ package { [ 'libpam-mysql', 'libgsasl7' ]:
+ ensure => installed,
+ }
+
+ package { [ 'postfix-mysql', 'dovecot-imapd', 'maildrop' ]:
+ ensure => installed,
+ }
+
+ package { [ 'squirrelmail', 'squirrelmail-locales', 'imp4' ]:
+ ensure => installed,
+ }
+
+ package { 'php-crypt-gpg':
+ ensure => installed,
+ }
+
+ # Squeeze (or newer) packages
+ if $::lsbdistcodename != 'lenny' {
+ package { [ 'roundcube', 'roundcube-sqlite', 'roundcube-plugins', 'roundcube-plugins-extra' ]:
+ ensure => latest,
+ }
+ }
+
+ # We'll force SSL through the proxy
+ package { 'squirrelmail-secure-login':
+ ensure => absent,
+ }
+}
diff --git a/manifests/virtual/params.pp b/manifests/virtual/params.pp
new file mode 100644
index 0000000..814b353
--- /dev/null
+++ b/manifests/virtual/params.pp
@@ -0,0 +1,5 @@
+class mail::virtual::params {
+ $database_user = 'postfix'
+ $database_host = 'localhost'
+ $database_name = 'postfix'
+}
diff --git a/manifests/virtual/web.pp b/manifests/virtual/web.pp
new file mode 100644
index 0000000..7c007a9
--- /dev/null
+++ b/manifests/virtual/web.pp
@@ -0,0 +1,73 @@
+class mail::virtual::web(
+ $postfixadmin_setup_hash = hiera('mail::web::virtual::postfixadmin_setup_hash', ''),
+ $roundcube_des_key = hiera('mail::web::virtual::roundcube_des_key', ''),
+ $roundcube_logo = hiera('mail::web::virtual::roundcube_logo', 'null'),
+ $roundcube_login_info = hiera('mail::web::virtual::roundcube_login_info', false)
+) {
+
+ # Class configuration
+ if $::lsbdistcodename != 'lenny' {
+ case $roundcube_des_key {
+ '': { fail("You need to define roundcube_des_key host config") }
+ }
+ }
+
+ case $postfixadmin_setup_hash {
+ '': {
+ warning("You need to define postfixadmin_setup_hash host config")
+ $setup_hash = 'changeme'
+ }
+ }
+
+ include php::imap
+ include websites::setup
+
+ apache::site { "postfixadmin":
+ docroot => "${apache::sites_folder}/postfixadmin/site",
+ use => [ "Site postfixadmin" ],
+ mpm => false,
+ }
+
+ apache::site { "mail":
+ docroot => $::lsbdistcodename ? {
+ 'lenny' => "/usr/share/squirrelmail",
+ default => "/var/lib/roundcube",
+ },
+ source => true,
+ mpm => false,
+ }
+
+ file { "${apache::sites_folder}/postfixadmin/site/config.inc.php":
+ ensure => present,
+ owner => www-data,
+ group => root,
+ mode => 0640,
+ content => template('mail/virtual/postfixadmin/config.inc.php.erb'),
+ require => File["${apache::sites_folder}/postfixadmin/site"],
+ }
+
+ file { "/etc/roundcube/main.inc.php":
+ ensure => $::lsbdistcodename ? {
+ 'lenny' => absent,
+ default => present,
+ },
+ owner => root,
+ group => www-data,
+ mode => 0640,
+ content => template('mail/virtual/roundcube/main.inc.php.erb'),
+ require => Package['roundcube'],
+ }
+
+ file { "/var/lib/roundcube/plugins/login_info":
+ ensure => $::lsbdistcodename ? {
+ 'lenny' => absent,
+ default => directory,
+ },
+ recurse => true,
+ owner => root,
+ group => root,
+ mode => 0644,
+ source => "puppet:///modules/mail/roundcube/plugins/login_info",
+ require => Package['roundcube'],
+ }
+}