|
|
|
@ -1,5 +1,9 @@ |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
use esmith::util; |
|
|
|
|
my $base = esmith::util::ldapBase($DomainName); |
|
|
|
|
|
|
|
|
|
my $name = $domain->key; |
|
|
|
|
my $target = $domain->prop('ProxyPassTarget') || ''; |
|
|
|
|
my $redirect = $domain->prop('Redirect') || ''; |
|
|
|
|
my $rewrite = $domain->prop('Rewrite') || ''; |
|
|
|
@ -7,6 +11,8 @@ my $allow = $domain->prop('AllowHosts') || ''; |
|
|
|
|
my $preserve = $domain->prop('ProxyPreserveHost') || 'no'; |
|
|
|
|
my $keepalive = $domain->prop('ProxyNoKeepAlive') || 'no'; |
|
|
|
|
my @env = split(/[;,]/, ($domain->prop('SetEnv') || '')); |
|
|
|
|
my $auth = $domain->prop('Authentication') || 'none'; |
|
|
|
|
my @groups = split(/[;,]/, ($domain->prop('AllowGroups') || '')); |
|
|
|
|
|
|
|
|
|
# ProxyPass ? |
|
|
|
|
if ($target =~ m|https?://[\d\w\.\-/]*|){ |
|
|
|
@ -61,5 +67,27 @@ if ($allow ne ''){ |
|
|
|
|
EOF |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($auth =~ m/^Basic$/i){ |
|
|
|
|
my $require = "Require valid-user"; |
|
|
|
|
if (scalar(@groups) > 0){ |
|
|
|
|
$require = "Require ldap-group "; |
|
|
|
|
$require .= "cn=$_,ou=Groups,$base " foreach(@groups); |
|
|
|
|
} |
|
|
|
|
$OUT .=<<"EOF"; |
|
|
|
|
|
|
|
|
|
<Location /> |
|
|
|
|
AuthType basic |
|
|
|
|
AuthName "$name" |
|
|
|
|
AuthBasicProvider ldap |
|
|
|
|
AuthLDAPURL ldap://localhost/ou=Users,$base?uid |
|
|
|
|
AuthLDAPGroupAttribute memberUid |
|
|
|
|
AuthLDAPGroupAttributeIsDN off |
|
|
|
|
$require |
|
|
|
|
</location> |
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|