From 375527b1629597e35a6aeeef6c248a8b085abd87 Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 24 Nov 2015 16:03:13 -0500 Subject: Switch from 'vmail' to leap-mx's user/group (#6936, #7639) This change will make sure that the user/group for leap-mx exist, and it changes the mail location from /var/mail/vmail to the more helpful name /var/mail/leap-mx. This change requires: https://github.com/leapcode/leap_mx/pull/78 and it would replace merge request: https://github.com/leapcode/leap_mx/pull/65 and fix https://leap.se/code/issues/6936 and https://leap.se/code/issues/7635 Change-Id: Idbe678dc999e394232c2eeef2b2018d39ab7cc3b --- puppet/modules/leap_mx/manifests/init.pp | 24 ++++++++++++++++------ puppet/modules/leap_mx/templates/mx.conf.erb | 2 +- .../files/agent/local_checks/mx/check_leap_mx.sh | 2 +- puppet/modules/site_postfix/manifests/mx.pp | 24 ++++------------------ 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/puppet/modules/leap_mx/manifests/init.pp b/puppet/modules/leap_mx/manifests/init.pp index 5561e326..9c1b9143 100644 --- a/puppet/modules/leap_mx/manifests/init.pp +++ b/puppet/modules/leap_mx/manifests/init.pp @@ -15,18 +15,29 @@ class leap_mx { # # USER AND GROUP # + # Make the user for leap-mx. This user is where all legitimate, non-system + # mail is delivered so leap-mx can process it. Previously, we let the system + # pick a uid/gid, but we need to know what they are set to in order to set the + # virtual_uid_maps and virtual_gid_maps. Its a bit overkill write a fact just + # for this, so instead we pick arbitrary numbers that seem unlikely to be used + # and then use them in the postfix configuration group { 'leap-mx': ensure => present, + gid => 42424, allowdupe => false; } user { 'leap-mx': - ensure => present, - allowdupe => false, - gid => 'leap-mx', - home => '/etc/leap', - require => Group['leap-mx']; + ensure => present, + comment => 'Leap Mail', + allowdupe => false, + uid => 42424, + gid => 'leap-mx', + home => '/var/mail/leap-mx', + shell => '/bin/false', + managehome => true, + require => Group['leap-mx']; } # @@ -52,7 +63,8 @@ class leap_mx { ensure => $sources['leap-mx']['revision'], require => [ Class['site_apt::preferences::twisted'], - Class['site_apt::leap_repo'] ]; + Class['site_apt::leap_repo'] + User['leap-mx'] ]; 'leap-keymanager': ensure => latest; diff --git a/puppet/modules/leap_mx/templates/mx.conf.erb b/puppet/modules/leap_mx/templates/mx.conf.erb index e05bc150..a2c293c6 100644 --- a/puppet/modules/leap_mx/templates/mx.conf.erb +++ b/puppet/modules/leap_mx/templates/mx.conf.erb @@ -1,5 +1,5 @@ [mail1] -path=/var/mail/vmail/Maildir +path=/var/mail/leap-mx/Maildir recursive=True [couchdb] diff --git a/puppet/modules/site_check_mk/files/agent/local_checks/mx/check_leap_mx.sh b/puppet/modules/site_check_mk/files/agent/local_checks/mx/check_leap_mx.sh index b8687c9a..4711e247 100755 --- a/puppet/modules/site_check_mk/files/agent/local_checks/mx/check_leap_mx.sh +++ b/puppet/modules/site_check_mk/files/agent/local_checks/mx/check_leap_mx.sh @@ -12,7 +12,7 @@ STATUS[1]='Warning' STATUS[2]='Critical' CHECKNAME='Leap_MX_Queue' -WATCHDIR='/var/mail/vmail/Maildir/new/' +WATCHDIR='/var/mail/leap-mx/Maildir/new/' total=`find $WATCHDIR -type f -mmin +$MAXAGE | wc -l` diff --git a/puppet/modules/site_postfix/manifests/mx.pp b/puppet/modules/site_postfix/manifests/mx.pp index de317205..7ec60d49 100644 --- a/puppet/modules/site_postfix/manifests/mx.pp +++ b/puppet/modules/site_postfix/manifests/mx.pp @@ -34,17 +34,17 @@ class site_postfix::mx { 'virtual_mailbox_domains': value => 'deliver.local'; 'virtual_mailbox_base': - value => '/var/mail/vmail'; + value => '/var/mail/leap-mx'; 'virtual_mailbox_maps': value => 'static:Maildir/'; - # Note: virtual-aliases map will take precedence over leap_mx + # Note: virtual-aliases map will take precedence over leap-mx # lookup (tcp:localhost) 'virtual_alias_maps': value => 'hash:/etc/postfix/virtual-aliases tcp:localhost:4242'; 'luser_relay': value => ''; # uid and gid are set to an arbitrary hard-coded value here, this - # must match the 'vmail' user block below + # must match the 'leap-mx' user/group 'virtual_uid_maps': value => 'static:42424'; 'virtual_gid_maps': @@ -79,22 +79,6 @@ class site_postfix::mx { # greater verbosity for debugging, take out for production #include site_postfix::debug - # Make the 'vmail' user for leap-mx. This user is where all legitimate, - # non-system mail is delivered so leap-mx can process it. Previously, we let - # the system pick a uid/gid, but we need to know what they are set to in order - # to set the virtual_uid_maps and virtual_gid_maps. Its a bit overkill write a - # fact just for this, so instead we pick arbitrary numbers that seem unlikely - # to be used and then use them in the postfix configuration - user { 'vmail': - ensure => present, - comment => 'Leap Mailspool', - home => '/var/mail/vmail', - shell => '/bin/false', - uid => '42424', - gid => '42424', - managehome => true, - } - class { 'postfix': preseed => true, root_mail_recipient => $root_mail_recipient, @@ -114,6 +98,6 @@ clean_smtps unix n - n - 0 cleanup Class['Site_config::X509::Cert'], Class['Site_config::X509::Client_ca::Key'], Class['Site_config::X509::Client_ca::Ca'], - User['vmail'] ] + User['leap-mx'] ] } } -- cgit v1.2.3