From aa73eed866f5b8a5298573bf3c6fcbcffbbee045 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 4 Sep 2012 12:35:54 +0200 Subject: [PATCH] Utilisation de la prop Authentication pour la protection des domaines par LL::NG --- .../db/configuration/migrate/90MigrateLemonLDAP | 14 ++++++++++++++ .../WebAppVirtualHost/05LemonLDAPHandler | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 root/etc/e-smith/db/configuration/migrate/90MigrateLemonLDAP diff --git a/root/etc/e-smith/db/configuration/migrate/90MigrateLemonLDAP b/root/etc/e-smith/db/configuration/migrate/90MigrateLemonLDAP new file mode 100644 index 0000000..b1e36df --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/90MigrateLemonLDAP @@ -0,0 +1,14 @@ +{ + +use esmith::DomainsDB; +my $d = esmith::DomainsDB->open() or die "Couldn't open DomainsDB\n"; + +foreach my $domain ($d->domains){ + my $llng = $domain->prop('LemonLDAP') || ''; + next unless $llng eq 'enabled'; + $domain->set_prop('Authentication', 'LemonLDAP'); + $domain->delete_prop('LemonLDAP'); +} + +} + diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/05LemonLDAPHandler b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/05LemonLDAPHandler index fba7928..5e0e1e4 100644 --- a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/05LemonLDAPHandler +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/05LemonLDAPHandler @@ -1,6 +1,8 @@ { -if (($domain->prop('LemonLDAP') || 'disabled') eq 'enabled'){ +my $auth = $domain->prop('Authentication') || 'none'; + +if ($auth eq 'LemonLDAP'){ $OUT .= " # This virtualhost is configured to be protected by LemonLDAP NG\n" . " PerlHeaderParserHandler My::Package\n" . " ErrorDocument 403 https://auth.$DomainName/?lmError=403\n" . @@ -9,5 +11,9 @@ if (($domain->prop('LemonLDAP') || 'disabled') eq 'enabled'){ $OUT .= " PerlOutputFilterHandler Lemonldap::NG::Handler::Menu\n"; } } +elsif ($auth eq 'LemonLDAPBasic'){ + $OUT .= " # This virtualhost is configured to be protected by LemonLDAP NG (basic auth)\n" . + " PerlHeaderParserHandler Lemonldap::NG::Handler::AuthBasic\n"; +} }