From 07e7af8352167495fa48c925d616d04eaa86010a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 5 Mar 2015 09:22:35 +0100 Subject: [PATCH] Add an Authentication prop to use SOGo's internal auth --- .../templates/etc/dovecot/dovecot.conf/014AuthCache | 20 +++++++++++++++++--- root/etc/e-smith/templates/etc/pam.d/dovecot/05cas | 3 ++- .../templates/etc/sogo/sogo.conf/55authSource | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/014AuthCache b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/014AuthCache index 11e4281..6e82b8e 100644 --- a/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/014AuthCache +++ b/root/etc/e-smith/templates/etc/dovecot/dovecot.conf/014AuthCache @@ -1,3 +1,17 @@ -auth_cache_size = { $dovecot{'AuthCacheSize'} || '5242880' } -auth_cache_ttl = 7200 -auth_cache_negative_ttl = 0 +{ +# Only enable auth cache if SOGo is using CAS +my $sogo_auth = $sogod{'Authentication'} || 'cas'; +if (lc $sogo_auth eq 'cas'){ + my $size = $dovecot{'AuthCacheSize'} || '5242880'; + my $ttl = $dovecot{'AuthCacheTTL'} || '7200'; + my $neg_ttl = $dovecot{'AuthCacheNegativeTTL'} || '0'; + $OUT .=<<"EOF"; +auth_cache_size = $size +auth_cache_ttl = $ttl +auth_cache_negative_ttl = $neg_ttl +EOF +} +else{ + $OUT .= "# No auth cache as SOGo doesn't use CAS"; +} +} diff --git a/root/etc/e-smith/templates/etc/pam.d/dovecot/05cas b/root/etc/e-smith/templates/etc/pam.d/dovecot/05cas index 668824c..50aeac0 100644 --- a/root/etc/e-smith/templates/etc/pam.d/dovecot/05cas +++ b/root/etc/e-smith/templates/etc/pam.d/dovecot/05cas @@ -1,5 +1,6 @@ { -if (-d '/var/service/dovecot'){ +my $auth = $sogod{'Authentication'} || 'cas'; +if (lc $auth eq 'cas'){ $OUT .=<<"HERE"; auth sufficient pam_cas.so -simap://localhost -f/etc/pam_cas.conf HERE diff --git a/root/etc/e-smith/templates/etc/sogo/sogo.conf/55authSource b/root/etc/e-smith/templates/etc/sogo/sogo.conf/55authSource index 66c1ae6..4d1819e 100644 --- a/root/etc/e-smith/templates/etc/sogo/sogo.conf/55authSource +++ b/root/etc/e-smith/templates/etc/sogo/sogo.conf/55authSource @@ -56,8 +56,8 @@ \} ); { - # is smeserver-dovecot installed ? - if (-d '/var/service/dovecot'){ + my $auth = $sogod{'Authentication'} || 'cas'; + if (lc $auth eq 'cas'){ $OUT .=<<"HERE"; SOGoAuthenticationType = cas; SOGoCASServiceURL = "https://auth.$DomainName/cas/";