From 3de2f3a54a53fe480e00da34bb1cc630f84587ee Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 6 Nov 2013 10:55:58 +0100 Subject: [PATCH] add basic auth --- .../etc/httpd/conf/httpd.conf/98OpenSondage | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98OpenSondage b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98OpenSondage index 52808b3..9680d20 100644 --- a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98OpenSondage +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98OpenSondage @@ -1,10 +1,31 @@ { my $access = $opensondage{'access'} || 'private'; my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess"; - +my $auth = $opensondage{'Authentication'}' || 'http'; my $alias = (($opensondage{'AliasOnPrimary'} || 'enabled') eq 'enabled') ? 'Alias /opensondage /usr/share/opensondage' : ''; - +my $authuser = ''; +my $authadmin = ''; +if ($auth eq 'http'){ + $authuser =<<'EOF'; + + SSLRequireSSL on + AuthName "OpenSondage" + AuthType Basic + AuthExternal pwauth + Require valid-user + +EOF + $authadmin =<<'EOF'; + + SSLRequireSSL on + AuthName "OpenSondage Admin" + AuthType Basic + AuthExternal pwauth + Require user admin + +EOF +} if ($opensondage{'status'} eq 'enabled'){ $OUT .=<<"END" @@ -27,7 +48,9 @@ $alias Deny from all +$authuser +$authadmin Deny from all