add basic auth

tags/0.1.0
Daniel Berteaud 11 years ago
parent 3503370aed
commit 3de2f3a54a
  1. 27
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98OpenSondage

@ -1,10 +1,31 @@
{ {
my $access = $opensondage{'access'} || 'private'; my $access = $opensondage{'access'} || 'private';
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess"; my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
my $auth = $opensondage{'Authentication'}' || 'http';
my $alias = (($opensondage{'AliasOnPrimary'} || 'enabled') eq 'enabled') ? my $alias = (($opensondage{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
'Alias /opensondage /usr/share/opensondage' : ''; 'Alias /opensondage /usr/share/opensondage' : '';
my $authuser = '';
my $authadmin = '';
if ($auth eq 'http'){
$authuser =<<'EOF';
<FilesMatch "^($|(index|adminstubs|info_sondage)\.php)">
SSLRequireSSL on
AuthName "OpenSondage"
AuthType Basic
AuthExternal pwauth
Require valid-user
</FilesMatch>
EOF
$authadmin =<<'EOF';
<Directory /usr/share/opensondage/admin>
SSLRequireSSL on
AuthName "OpenSondage Admin"
AuthType Basic
AuthExternal pwauth
Require user admin
</Directory>
EOF
}
if ($opensondage{'status'} eq 'enabled'){ if ($opensondage{'status'} eq 'enabled'){
$OUT .=<<"END" $OUT .=<<"END"
@ -27,7 +48,9 @@ $alias
<Files ~ "\.(txt|TXT|sql|SQL)$"> <Files ~ "\.(txt|TXT|sql|SQL)$">
Deny from all Deny from all
</Files> </Files>
$authuser
</Directory> </Directory>
$authadmin
<Directory ~ "/usr/share/opensondage/(errors|adodb|iCalcreator|locale|php2pdf|scripts)"> <Directory ~ "/usr/share/opensondage/(errors|adodb|iCalcreator|locale|php2pdf|scripts)">
Deny from all Deny from all
</Directory> </Directory>

Loading…
Cancel
Save