Enable CAS authentication if smeserver-dovecot is installed

This commit is contained in:
Daniel Berteaud 2013-09-17 10:34:20 +02:00
parent 84cedb6958
commit 09229996a1
8 changed files with 103 additions and 1 deletions

View File

@ -10,6 +10,7 @@ templates2events("/etc/cron.d/sogo-alarm", qw(email-update bootstrap-console-sav
templates2events("/var/lib/sogo/GNUstep/Defaults/.GNUstepDefaults", qw(email-update bootstrap-console-save pre-backup));
templates2events("/etc/sysconfig/sogo", qw(email-update bootstrap-console-save));
templates2events("/etc/logrotate.d/sogo", qw(email-update bootstrap-console-save));
templates2events("/etc/pam.d/dovecot", qw(email-update bootstrap-console-save));
safe_symlink("restart", "root/etc/e-smith/events/email-update/services2adjust/sogod");
safe_symlink("restart", "root/etc/e-smith/events/email-update/services2adjust/memcached-sogo");

View File

@ -23,6 +23,9 @@ Requires: sope49-gdl1-mysql
Requires: sogo-ealarms-notify
Requires: ipasserelle-base
Requires: memcached
Requires: ipasserelle-portal
Requires: smeserver-lemonldap-ng >= 0.2.6
Requires: smeserver-pam_cas
Obsoletes: smeserver-sogo
Provides: smeserver-sogo

View File

@ -0,0 +1,10 @@
{
if (-d '/var/service/dovecot'){
$OUT .=<<"HERE";
auth sufficient pam_cas.so -simap://localhost -f/etc/pam_cas.conf
HERE
}
else{
return "";
}
}

View File

@ -0,0 +1,4 @@
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth

View File

@ -0,0 +1,8 @@
{
$OUT = <<HERE;
#%PAM-1.0
HERE
$OUT .=
Text::Template::_load_text("/etc/e-smith/templates-default/template-begin");
}

View File

@ -0,0 +1,16 @@
{
$conf->{'applicationList'}->{'010apps'}->{'sogo'} = {
'options' => {
'logo' => 'mail.png',
'name' => 'SOGo',
'description' => 'Mails, agendas, contacts',
'uri' => "https://$host.$domain/SOGo",
'display' => 'on'
},
'type' => 'application'
} unless ($conf->{'applicationList'}->{'010apps'}->{'sogo'});
$OUT = '';
}

View File

@ -55,4 +55,12 @@
type = ldap;
\}
);
{
# is smeserver-dovecot installed ?
if (-d '/var/service/dovecot'){
$OUT .=<<"HERE";
SOGoAuthenticationType = cas;
SOGoCASServiceURL = "https://auth.$DomainName/cas/";
HERE
}
}

View File

@ -0,0 +1,52 @@
package Apache::FilterChangeLength;
use strict;
use warnings FATAL => 'all';
use Apache2::RequestRec ();
use APR::Table ();
use APR::Bucket ();
use APR::Brigade ();
use base qw(Apache2::Filter);
use Apache2::Const -compile => qw(OK);
use APR::Const -compile => ':common';
sub handler {
my ($filter, $bb) = @_;
my $ctx = $filter->ctx;
my $data = exists $ctx->{data} ? $ctx->{data} : '';
$ctx->{invoked}++;
my ($bdata, $seen_eos) = flatten_bb($bb);
$data .= $bdata if $bdata;
if ($seen_eos) {
my $len = length $data;
$filter->r->headers_out->set('Content-Length', $len);
$filter->print($data) if $data;
}
else {
# store context for all but the last invocation
$ctx->{data} = $data;
$filter->ctx($ctx);
}
return Apache2::Const::OK;
}
sub flatten_bb {
my ($bb) = shift;
my $seen_eos = 0;
my @data;
for (my $b = $bb->first; $b; $b = $bb->next($b)) {
$seen_eos++, last if $b->is_eos;
$b->read(my $bdata);
push @data, $bdata;
}
return (join('', @data), $seen_eos);
}
1;