2009-12-17 20:20:17 +01:00
|
|
|
## @file
|
|
|
|
# Manager tree structure and tests
|
|
|
|
|
|
|
|
## @class
|
|
|
|
# Manager tree structure and tests
|
2009-12-11 19:17:00 +01:00
|
|
|
package Lemonldap::NG::Manager::_Struct;
|
|
|
|
|
|
|
|
use strict;
|
2010-01-28 18:58:49 +01:00
|
|
|
use Lemonldap::NG::Common::Conf::SAML::Metadata;
|
|
|
|
|
2009-12-11 19:17:00 +01:00
|
|
|
our $VERSION = '0.1';
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @method protected hashref cstruct(hashref h,string k)
|
|
|
|
# Merge $h with the structure produced with $k and return it.
|
|
|
|
# Used to manage virtual hosts.
|
|
|
|
#@param $h Result of struct()
|
|
|
|
#@param $k Name of the virtual host
|
|
|
|
#@return Tree structure
|
2009-12-11 19:17:00 +01:00
|
|
|
sub cstruct {
|
|
|
|
shift;
|
|
|
|
my ( $h, $k ) = @_;
|
|
|
|
%$h = (
|
|
|
|
%$h,
|
|
|
|
virtualHosts => {
|
|
|
|
$k => {
|
|
|
|
_nodes => [qw(rules:rules:rules headers)],
|
|
|
|
rules => {
|
|
|
|
_nodes => ["hash:/locationRules/$k:rules:rules"],
|
|
|
|
_js => 'rulesRoot'
|
|
|
|
},
|
2009-12-29 18:03:24 +01:00
|
|
|
headers => {
|
|
|
|
_nodes => ["hash:/exportedHeaders/$k"],
|
|
|
|
_js => 'hashRoot'
|
|
|
|
},
|
2009-12-11 19:17:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
return $h;
|
|
|
|
}
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @method protected hashref struct(hashref h,string k)
|
|
|
|
# Returns the tree structure
|
|
|
|
#@return Tree structure
|
2009-12-11 19:17:00 +01:00
|
|
|
sub struct {
|
2009-12-23 10:37:38 +01:00
|
|
|
my $self = shift;
|
2009-12-11 19:17:00 +01:00
|
|
|
return {
|
2010-01-29 17:42:35 +01:00
|
|
|
_nodes => [qw(n:generalParameters n:variables n:virtualHosts n:samlServiceMetaData)],
|
2010-01-11 17:04:36 +01:00
|
|
|
_help => 'default',
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
######################
|
|
|
|
# GENERAL PARAMETERS #
|
|
|
|
######################
|
2009-12-11 19:17:00 +01:00
|
|
|
generalParameters => {
|
|
|
|
_nodes => [
|
2010-01-22 17:04:15 +01:00
|
|
|
qw(portalParams n:authParams logParams cookieParams sessionParams n:advancedParams)
|
2009-12-11 19:17:00 +01:00
|
|
|
],
|
2010-01-11 17:04:36 +01:00
|
|
|
_help => 'default',
|
2010-01-22 17:04:15 +01:00
|
|
|
|
|
|
|
# PORTAL PARAMETERS
|
|
|
|
portalParams => {
|
|
|
|
_nodes => [
|
|
|
|
qw(portal portalSkin portalDisplayLogout portalDisplayResetPassword portalDisplayChangePassword portalDisplayAppslist portalAutocomplete portalRequireOldPassword portalUserAttr portalOpenLinkInNewWindow)
|
|
|
|
],
|
|
|
|
_help => 'portalParams',
|
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
portal => 'text:/portal',
|
2010-01-22 17:04:15 +01:00
|
|
|
portalSkin => 'text:/portalSkin',
|
|
|
|
portalDisplayLogout => 'text:/portalDisplayLogout',
|
|
|
|
portalDisplayResetPassword =>
|
|
|
|
'text:/portalDisplayResetPassword',
|
|
|
|
portalDisplayChangePassword =>
|
|
|
|
'text:/portalDisplayChangePassword',
|
|
|
|
portalDisplayAppslist => 'text:/portalDisplayAppslist',
|
|
|
|
portalAutocomplete => 'bool:/portalAutocomplete',
|
|
|
|
portalRequireOldPassword => 'bool:/portalRequireOldPassword',
|
|
|
|
portalUserAttr => 'text:/portalUserAttr',
|
|
|
|
portalOpenLinkInNewWindow => 'bool:/portalOpenLinkInNewWindow',
|
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
|
|
|
|
# AUTHENTICATION AND USERDB PARAMETERS
|
2009-12-11 19:17:00 +01:00
|
|
|
authParams => {
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
# Displayed nodes depend on authentication/userDB modules choosed
|
2009-12-23 10:37:38 +01:00
|
|
|
_nodes => sub {
|
|
|
|
my $self = shift;
|
2009-12-29 18:03:24 +01:00
|
|
|
my $auth = $self->conf->{authentication}
|
2009-12-23 10:37:38 +01:00
|
|
|
|| $self->defaultConf()->{authentication};
|
2009-12-29 18:03:24 +01:00
|
|
|
my $udb = $self->conf->{userDB}
|
2009-12-23 10:37:38 +01:00
|
|
|
|| $self->defaultConf()->{userDB};
|
|
|
|
$auth = lc($auth);
|
|
|
|
$udb = lc($udb);
|
2009-12-30 18:02:23 +01:00
|
|
|
my %res = qw(authentication 1 userDB 1);
|
2009-12-23 10:37:38 +01:00
|
|
|
foreach my $mod ( ( $auth, ( $auth ne $udb ? $udb : () ) ) )
|
|
|
|
{
|
|
|
|
my $tmp = {
|
|
|
|
ldap => ['ldapParams'],
|
|
|
|
ssl => [qw(ldapParams SSLRequired)],
|
|
|
|
}->{$mod};
|
|
|
|
if ($tmp) {
|
|
|
|
$res{$_}++ foreach (@$tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
my @u = keys %res;
|
|
|
|
return \@u;
|
|
|
|
},
|
|
|
|
_help => 'authParams',
|
|
|
|
authentication => 'text:/authentication:authParams:authParams',
|
|
|
|
userDB => 'text:/userDB:authParams:authParams',
|
|
|
|
ldapParams => {
|
|
|
|
_nodes => [
|
|
|
|
qw(ldapServer ldapPort ldapBase managerDn managerPassword)
|
|
|
|
],
|
|
|
|
_help => 'ldap',
|
|
|
|
ldapServer => 'text:/ldapServer',
|
|
|
|
ldapPort => 'int:/ldapPort',
|
|
|
|
ldapBase => 'text:/ldapBase',
|
|
|
|
managerDn => 'text:/managerDn',
|
|
|
|
managerPassword => 'text:/managerPassword',
|
|
|
|
},
|
2009-12-30 15:22:24 +01:00
|
|
|
SSLRequired => 'bool:/SSLRequired',
|
2009-12-23 10:37:38 +01:00
|
|
|
},
|
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
# LOGS PARAMETERS
|
2009-12-23 10:37:38 +01:00
|
|
|
logParams => {
|
2009-12-30 18:02:23 +01:00
|
|
|
_nodes => [qw(syslog useXForwardedForIP whatToTrace)],
|
|
|
|
syslog => 'text:/syslog',
|
2009-12-30 15:22:24 +01:00
|
|
|
useXForwardedForIP => 'bool:/useXForwardedForIP',
|
2009-12-19 09:57:59 +01:00
|
|
|
whatToTrace => 'text:/whatToTrace:whatToTrace:text',
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
# COOKIE PARAMETERS
|
2009-12-11 19:17:00 +01:00
|
|
|
cookieParams => {
|
2009-12-14 15:01:46 +01:00
|
|
|
_nodes =>
|
|
|
|
[qw(cookieName domain securedCookie cookieExpiration)],
|
2009-12-19 09:57:59 +01:00
|
|
|
_help => 'cookies',
|
2009-12-11 19:17:00 +01:00
|
|
|
cookieName => 'text:/cookieName:cookieName:text',
|
|
|
|
domain => 'text:/domain:domain:text',
|
|
|
|
securedCookie =>
|
|
|
|
'int:/securedCookie:securedCookie:securedCookieValues',
|
2009-12-14 15:01:46 +01:00
|
|
|
cookieExpiration => 'text:/cookieExpiration',
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
# SESSIONS PARAMETERS
|
2009-12-11 19:17:00 +01:00
|
|
|
sessionParams => {
|
2009-12-23 10:37:38 +01:00
|
|
|
_nodes => [
|
2010-01-22 17:04:15 +01:00
|
|
|
qw(sessionStorage grantSessionRule singleSession singleIP singleUserByIP notifyDeleted notifyOther timeout storePassword)
|
2009-12-23 10:37:38 +01:00
|
|
|
],
|
2009-12-11 19:17:00 +01:00
|
|
|
_help => 'storage',
|
|
|
|
sessionStorage => {
|
|
|
|
_nodes => [qw(globalStorage globalStorageOptions)],
|
|
|
|
globalStorage => 'text:/globalStorage',
|
|
|
|
globalStorageOptions => {
|
|
|
|
_nodes => ['hash:/globalStorageOptions'],
|
|
|
|
_js => 'hashRoot'
|
|
|
|
},
|
|
|
|
},
|
2009-12-30 15:22:24 +01:00
|
|
|
singleSession => 'bool:/singleSession',
|
|
|
|
singleIP => 'bool:/singleIP',
|
|
|
|
singleUserByIP => 'bool:/singleUserByIP',
|
2010-01-11 17:04:36 +01:00
|
|
|
notifyDeleted => 'bool:/notifyDeleted',
|
2010-01-12 10:53:49 +01:00
|
|
|
notifyOther => 'bool:/notifyOther',
|
2009-12-30 15:22:24 +01:00
|
|
|
storePassword => 'bool:/storePassword',
|
2009-12-23 10:37:38 +01:00
|
|
|
timeout => 'text:/timeout:timeout:text',
|
2010-01-22 17:04:15 +01:00
|
|
|
grantSessionRule => 'text:/grantSessionRule',
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
# OTHER PARAMETERS
|
2009-12-14 15:01:46 +01:00
|
|
|
advancedParams => {
|
|
|
|
_nodes => [
|
2010-01-27 15:06:02 +01:00
|
|
|
qw(Soap exportedAttr trustedDomains https notifications passwordManagement userControl portalForceAuthn)
|
2009-12-14 15:01:46 +01:00
|
|
|
],
|
2009-12-30 15:22:24 +01:00
|
|
|
Soap => 'bool:/Soap',
|
|
|
|
https => 'bool:/https',
|
2009-12-19 09:57:59 +01:00
|
|
|
exportedAttr => 'text:/exportedAttr',
|
2009-12-14 15:01:46 +01:00
|
|
|
notifications => {
|
|
|
|
_nodes => [
|
|
|
|
qw(notification notificationStorage notificationStorageOptions)
|
|
|
|
],
|
2009-12-19 09:57:59 +01:00
|
|
|
_help => 'notifications',
|
2009-12-30 15:22:24 +01:00
|
|
|
notification => 'bool:/notification',
|
2009-12-19 09:57:59 +01:00
|
|
|
notificationStorage => 'text:/notificationStorage',
|
2009-12-14 15:01:46 +01:00
|
|
|
notificationStorageOptions => {
|
|
|
|
_nodes => ['hash:/notificationStorageOptions'],
|
|
|
|
_js => 'hashRoot'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
passwordManagement => {
|
|
|
|
_nodes => [
|
|
|
|
qw(passwordDB SMTPServer mailFrom mailSubject randomPasswordRegexp mailBody)
|
|
|
|
],
|
|
|
|
passwordDB => 'text:/passwordDB',
|
|
|
|
SMTPServer => 'text:/SMTPServer',
|
|
|
|
mailFrom => 'text:/mailFrom',
|
|
|
|
mailSubject => 'text:/mailSubject',
|
|
|
|
randomPasswordRegexp => 'text:/randomPasswordRegexp',
|
|
|
|
mailBody => 'text:/mailBody',
|
|
|
|
},
|
|
|
|
trustedDomains => 'text:/trustedDomains',
|
2009-12-19 09:57:59 +01:00
|
|
|
userControl => 'text:/userControl:userControl:text',
|
2010-01-27 15:06:02 +01:00
|
|
|
portalForceAuthn =>
|
|
|
|
'bool:/portalForceAuthn:portalForceAuthn:bool',
|
2009-12-14 15:01:46 +01:00
|
|
|
}
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-15 17:40:47 +01:00
|
|
|
#############
|
|
|
|
# VARIABLES #
|
|
|
|
#############
|
|
|
|
|
|
|
|
variables => {
|
2010-01-18 23:49:22 +01:00
|
|
|
_nodes => [qw(cn:exportedVars cn:macros n:groups)],
|
2010-01-15 17:40:47 +01:00
|
|
|
_help => 'default',
|
|
|
|
|
|
|
|
# EXPORTED ATTRIBUTES
|
|
|
|
exportedVars => {
|
|
|
|
_nodes => ['hash:/exportedVars:vars:btext'],
|
2010-01-27 15:06:02 +01:00
|
|
|
_js => 'hashRoot',
|
2010-01-15 17:40:47 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
# MACROS
|
|
|
|
macros => {
|
|
|
|
_nodes => ['hash:/macros:macros:btext'],
|
2010-01-27 15:06:02 +01:00
|
|
|
_js => 'hashRoot',
|
2010-01-15 17:40:47 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
# GROUPS
|
2009-12-19 09:57:59 +01:00
|
|
|
groups => {
|
|
|
|
_nodes => ['hash:/groups:groups:btext'],
|
|
|
|
_js => 'hashRoot',
|
|
|
|
_help => 'default',
|
|
|
|
},
|
2010-01-15 17:40:47 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2010-01-11 17:04:36 +01:00
|
|
|
#################
|
|
|
|
# VIRTUAL HOSTS #
|
|
|
|
#################
|
2009-12-19 09:57:59 +01:00
|
|
|
virtualHosts => {
|
2009-12-30 16:40:37 +01:00
|
|
|
_nodes => ['nhash:/locationRules:virtualHosts:vhost'],
|
2009-12-19 09:57:59 +01:00
|
|
|
_upload => ['/exportedHeaders'],
|
|
|
|
_help => 'default',
|
2009-12-30 15:22:24 +01:00
|
|
|
_call => '$(\'#bnewvh\').show();',
|
2009-12-19 09:57:59 +01:00
|
|
|
},
|
2010-01-28 18:58:49 +01:00
|
|
|
|
|
|
|
#################
|
|
|
|
# SAML METADATA #
|
|
|
|
#################
|
|
|
|
|
2010-01-29 17:42:35 +01:00
|
|
|
samlServiceMetaData => Lemonldap::NG::Common::Conf::SAML::Metadata::createSimpleStruct(),
|
2009-12-11 19:17:00 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @method protected hashref testStruct()
|
|
|
|
# Returns the tests to do with the datas uploaded.
|
|
|
|
# @return hashref
|
2009-12-11 19:17:00 +01:00
|
|
|
sub testStruct {
|
2010-01-11 17:04:36 +01:00
|
|
|
my $safe = Safe->new();
|
2009-12-11 19:17:00 +01:00
|
|
|
my $assignTest = qr/(?<=[^=<!>\?])=(?![=~])/;
|
|
|
|
my $assignMsg = 'containsAnAssignment';
|
|
|
|
my $perlExpr = sub {
|
|
|
|
my $e = shift;
|
2010-01-11 17:04:36 +01:00
|
|
|
$safe->reval( $e, 1 );
|
|
|
|
return 1 unless ($@);
|
2009-12-11 19:17:00 +01:00
|
|
|
return 1 if ( $@ =~ /Global symbol "\$.*requires explicit package/ );
|
2010-01-11 17:04:36 +01:00
|
|
|
return ( 1,
|
|
|
|
"Function \"<b>$1</b>\" must be declared in customFunctions" )
|
|
|
|
if ( $@ =~ /Bareword "(.*?)" not allowed while "strict subs"/ );
|
2010-01-04 14:28:10 +01:00
|
|
|
return ( 0, $@ );
|
2009-12-11 19:17:00 +01:00
|
|
|
};
|
2009-12-14 15:01:46 +01:00
|
|
|
my $boolean = { test => qr/^(?:0|1)?$/, msgFail => 'Value must be 0 or 1' };
|
2009-12-19 09:57:59 +01:00
|
|
|
my $pcre = sub {
|
|
|
|
my $r = shift;
|
|
|
|
my $q;
|
|
|
|
eval { $q = qr/$r/ };
|
|
|
|
return ( $@ ? ( 0, $@ ) : 1 );
|
|
|
|
};
|
|
|
|
my $testNotDefined = { test => sub { 1 }, msgFail => 'Ok' };
|
2009-12-23 10:37:38 +01:00
|
|
|
|
2009-12-11 19:17:00 +01:00
|
|
|
return {
|
2009-12-19 09:57:59 +01:00
|
|
|
mailFrom => $testNotDefined,
|
|
|
|
trustedDomains => $testNotDefined,
|
|
|
|
exportedAttr => $testNotDefined,
|
|
|
|
mailSubject => $testNotDefined,
|
|
|
|
randomPasswordRegexp => $testNotDefined,
|
|
|
|
passwordDB => $testNotDefined,
|
|
|
|
mailBody => $testNotDefined,
|
|
|
|
SMTPServer => $testNotDefined,
|
|
|
|
cookieExpiration => $testNotDefined,
|
|
|
|
notificationStorage => $testNotDefined,
|
|
|
|
authentication => {
|
2009-12-11 19:17:00 +01:00
|
|
|
test => qr/^[a-zA-Z][\w\:]*$/,
|
|
|
|
msgFail => 'Bad module name',
|
|
|
|
},
|
2009-12-19 09:57:59 +01:00
|
|
|
cda => $boolean,
|
2009-12-11 19:17:00 +01:00
|
|
|
cookieName => {
|
|
|
|
test => qr/^[a-zA-Z]\w*$/,
|
|
|
|
msgFail => 'Bad cookie name',
|
|
|
|
},
|
|
|
|
domain => {
|
|
|
|
test => qr/^\.?\w+(?:\.[a-zA-Z]\w*)*(?:\.[a-zA-Z]+)$/,
|
|
|
|
msgFail => 'Bad domain',
|
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
exportedHeaders => {
|
|
|
|
keyTest => qr/^[a-zA-Z](?:[\w\-\.]*\w)?$/,
|
|
|
|
keyMsgFail => 'Bad virtual host name',
|
|
|
|
'*' => {
|
|
|
|
keyTest => qr/^\w([\w\-]*\w)?$/,
|
|
|
|
keyMsgFail => 'Bad header name',
|
|
|
|
test => $perlExpr,
|
|
|
|
warnTest => sub {
|
|
|
|
my $e = shift;
|
|
|
|
return ( 0, $assignMsg ) if ( $e =~ $assignTest );
|
|
|
|
1;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
exportedVars => {
|
|
|
|
keyTest => qr/^[a-zA-Z]\w*$/,
|
|
|
|
keyMsgFail => 'Bad variable name',
|
|
|
|
test => qr/^[a-zA-Z]\w*$/,
|
|
|
|
msgFail => 'Bad attribute name',
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
|
|
|
globalStorage => {
|
|
|
|
test => qr/^[\w:]+$/,
|
|
|
|
msgFail => 'Bad module name',
|
|
|
|
},
|
|
|
|
globalStorageOptions => {
|
|
|
|
keyTest => qr/^\w+$/,
|
|
|
|
keyMsgFail => 'Bad parameter',
|
|
|
|
},
|
2010-01-22 17:04:15 +01:00
|
|
|
grantSessionRule => {
|
|
|
|
test => $perlExpr,
|
|
|
|
warnTest => sub {
|
|
|
|
my $e = shift;
|
|
|
|
return ( 0, $assignMsg ) if ( $e =~ $assignTest );
|
|
|
|
1;
|
|
|
|
},
|
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
groups => {
|
|
|
|
keyTest => qr/^\w[\w-]*$/,
|
|
|
|
keyMsgFail => 'Bad group name',
|
|
|
|
test => $perlExpr,
|
|
|
|
warnTest => sub {
|
|
|
|
my $e = shift;
|
|
|
|
return ( 0, $assignMsg ) if ( $e =~ $assignTest );
|
|
|
|
1;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
https => $boolean,
|
2009-12-11 19:17:00 +01:00
|
|
|
ldapBase => {
|
|
|
|
test => qr/^(?:\w+=.*|)$/,
|
|
|
|
msgFail => 'Bad LDAP base',
|
|
|
|
},
|
|
|
|
ldapPort => {
|
|
|
|
test => qr/^\d*$/,
|
|
|
|
msgFail => 'Bad port number'
|
|
|
|
},
|
|
|
|
ldapServer => {
|
|
|
|
test => sub {
|
|
|
|
my $l = shift;
|
|
|
|
my @s = split( /[\s,]+/, $l );
|
|
|
|
foreach my $s (@s) {
|
|
|
|
$s =~
|
|
|
|
/^(?:ldap(?:s|\+tls|i):\/\/)?\w[\w\-\.]+\w(?::\d{0,5})?\/?$/
|
|
|
|
or return ( 0, "Bad ldap uri \"$s\"" );
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
locationRules => {
|
|
|
|
keyTest => qr/^[a-zA-Z](?:[\w\-\.]*\w)?$/,
|
|
|
|
msgFail => 'Bad virtual host name',
|
|
|
|
'*' => {
|
2009-12-19 09:57:59 +01:00
|
|
|
keyTest => $pcre,
|
|
|
|
test => sub {
|
2009-12-11 19:17:00 +01:00
|
|
|
my $e = shift;
|
|
|
|
return 1 if ( $e eq 'accept' or $e eq 'deny' );
|
|
|
|
if ( $e =~ s/^logout(?:_(?:app|sso|app_sso))?\s*// ) {
|
|
|
|
return (
|
|
|
|
$e =~ /^(?:https?:\/\/\S+)?$/
|
|
|
|
? 1
|
|
|
|
: ( 0, "bad url \"$e\"" )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return &$perlExpr($e);
|
|
|
|
},
|
|
|
|
warnTest => sub {
|
|
|
|
my $e = shift;
|
|
|
|
return ( 0, $assignMsg )
|
|
|
|
if ( $e =~ $assignTest
|
|
|
|
and $e !~ /^(?:accept|deny|logout)/ );
|
|
|
|
1;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
macros => {
|
|
|
|
keyTest => qr/^[a-zA-Z]\w*$/,
|
|
|
|
keyMsgFail => 'Bad macro name',
|
2010-01-11 17:04:36 +01:00
|
|
|
test => $perlExpr,
|
|
|
|
warnTest => sub {
|
|
|
|
my $e = shift;
|
|
|
|
return ( 0, $assignMsg ) if ( $e =~ $assignTest );
|
|
|
|
1;
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
managerDn => {
|
|
|
|
test => qr/^(?:\w+=.*,\w+=.*)?$/,
|
|
|
|
msgFail => 'Bad LDAP dn',
|
|
|
|
},
|
|
|
|
managerPassword => {
|
2009-12-23 13:55:23 +01:00
|
|
|
test => qr/^\S*$/,
|
2009-12-23 10:37:38 +01:00
|
|
|
msgFail => 'Bad LDAP password',
|
2009-12-11 19:17:00 +01:00
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
notification => $boolean,
|
2009-12-23 10:37:38 +01:00
|
|
|
notificationStorage => {
|
|
|
|
test => qr/^[\w:]+$/,
|
|
|
|
msgFail => 'Bad module name',
|
|
|
|
},
|
|
|
|
notificationStorageOptions => {
|
|
|
|
keyTest => qr/^\w+$/,
|
|
|
|
keyMsgFail => 'Bad parameter',
|
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
notifyDeleted => $boolean,
|
2010-01-12 10:53:49 +01:00
|
|
|
notifyOther => $boolean,
|
2010-01-11 17:04:36 +01:00
|
|
|
portal => {
|
2009-12-23 10:37:38 +01:00
|
|
|
test => qr/^https?:\/\/\S+$/,
|
|
|
|
msgFail => 'Bad portal value',
|
|
|
|
},
|
2010-01-27 15:06:02 +01:00
|
|
|
portalAutocomplete => $boolean,
|
2010-01-22 17:04:15 +01:00
|
|
|
portalDisplayAppslist => { test => $perlExpr, },
|
|
|
|
portalDisplayChangePassword => { test => $perlExpr, },
|
|
|
|
portalDisplayLogout => { test => $perlExpr, },
|
|
|
|
portalDisplayResetPassword => $boolean,
|
2010-01-27 15:06:02 +01:00
|
|
|
portalForceAuthn => $boolean,
|
2010-01-22 17:04:15 +01:00
|
|
|
portalOpenLinkInNewWindow => $boolean,
|
|
|
|
portalParams => $testNotDefined,
|
|
|
|
portalRequireOldPassword => $boolean,
|
|
|
|
portalSkin => {
|
|
|
|
test => qr/\w+$/,
|
|
|
|
msgFail => 'Bad skin name',
|
|
|
|
},
|
|
|
|
portalUserAttr => {
|
|
|
|
test => qr/\w+$/,
|
2010-01-27 15:06:02 +01:00
|
|
|
msgFail => 'Unvalid session field',
|
2010-01-22 17:04:15 +01:00
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
protection => {
|
2009-12-14 15:01:46 +01:00
|
|
|
keyTest => qr/^(?:none|authentificate|manager|)$/,
|
|
|
|
msgFail => 'must be one of none authentificate manager',
|
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
securedCookie => {
|
|
|
|
test => qr/^(?:0|1|2)$/,
|
|
|
|
msgFail => 'securedCookie must be 0, 1 or 2',
|
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
singleSession => $boolean,
|
|
|
|
singleIP => $boolean,
|
|
|
|
singleUserByIP => $boolean,
|
2009-12-23 10:37:38 +01:00
|
|
|
Soap => $boolean,
|
|
|
|
SSLRequired => $boolean,
|
|
|
|
storePassword => $boolean,
|
|
|
|
syslog => {
|
|
|
|
test => qw/^(?:auth|authpriv|daemon|local\d|user)?$/,
|
|
|
|
msgFail =>
|
|
|
|
'Only auth|authpriv|daemon|local0-7|user is allowed here',
|
|
|
|
},
|
|
|
|
timeout => {
|
|
|
|
test => qr/^\d*$/,
|
|
|
|
msgFail => 'Bad number'
|
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
userControl => {
|
2009-12-19 09:57:59 +01:00
|
|
|
test => $pcre,
|
|
|
|
msgFail => 'Bad regular expression',
|
|
|
|
},
|
2009-12-23 10:37:38 +01:00
|
|
|
userDB => {
|
|
|
|
test => qr/^[a-zA-Z][\w\:]*$/,
|
|
|
|
msgFail => 'Bad module name',
|
|
|
|
},
|
|
|
|
useXForwardedForIP => $boolean,
|
2010-01-18 23:49:22 +01:00
|
|
|
variables => $testNotDefined,
|
2009-12-23 10:37:38 +01:00
|
|
|
whatToTrace => {
|
|
|
|
test => qr/^\$?[a-zA-Z]\w*$/,
|
|
|
|
msgFail => 'Bad value',
|
|
|
|
},
|
2009-12-11 19:17:00 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
## @method protected hashref defaultConf()
|
|
|
|
#@return Hashref of default values
|
2009-12-11 19:17:00 +01:00
|
|
|
sub defaultConf {
|
|
|
|
return {
|
2010-01-11 17:04:36 +01:00
|
|
|
authentication => 'LDAP',
|
|
|
|
cda => '0',
|
|
|
|
cookieName => 'lemonldap',
|
|
|
|
domain => 'example.com',
|
2009-12-29 18:03:24 +01:00
|
|
|
exportedHeaders => { 'test.example.com' => { 'Auth-User' => '$uid' }, },
|
2010-01-11 17:04:36 +01:00
|
|
|
exportedVars => { cn => 'cn', mail => 'mail', uid => 'uid', },
|
|
|
|
globalStorage => 'Apache::Session::File',
|
2009-12-14 15:01:46 +01:00
|
|
|
globalStorageOptions => {
|
2009-12-19 09:57:59 +01:00
|
|
|
'Directory' => '/var/lib/lemonldap-ng/sessions/',
|
2009-12-14 15:01:46 +01:00
|
|
|
'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/'
|
|
|
|
},
|
2010-01-11 17:04:36 +01:00
|
|
|
https => '0',
|
|
|
|
ldapBase => 'dc=example,dc=com',
|
|
|
|
ldapPort => '389',
|
|
|
|
ldapServer => 'localhost',
|
2009-12-29 18:03:24 +01:00
|
|
|
locationRules => { 'test.example.com' => { default => 'accept' }, },
|
2010-01-11 17:04:36 +01:00
|
|
|
managerDn => '',
|
|
|
|
managerPassword => '',
|
|
|
|
notification => '0',
|
2009-12-19 09:57:59 +01:00
|
|
|
notificationStorage => 'File',
|
2009-12-23 10:37:38 +01:00
|
|
|
notificationStorageOptions =>
|
|
|
|
{ dirName => '/var/lib/lemonldap-ng/notifications', },
|
2010-01-11 17:04:36 +01:00
|
|
|
notifyDeleted => '1',
|
2010-01-12 10:53:49 +01:00
|
|
|
notifyOther => '1',
|
2009-12-23 10:37:38 +01:00
|
|
|
portal => 'http://auth.example.com/',
|
2010-01-27 15:06:02 +01:00
|
|
|
portalSkin => 'pastel',
|
|
|
|
portalUserAttr => '_user',
|
2009-12-23 10:37:38 +01:00
|
|
|
protection => 'none',
|
|
|
|
securedCookie => '0',
|
|
|
|
singleSession => '0',
|
|
|
|
singleIP => '0',
|
|
|
|
singleUserByIP => '0',
|
|
|
|
Soap => '1',
|
|
|
|
SSLRequired => '0',
|
|
|
|
storePassword => '0',
|
|
|
|
syslog => '',
|
|
|
|
timeout => '7200',
|
|
|
|
userControl => '^[\w\.\-@]+$',
|
|
|
|
userDB => 'LDAP',
|
|
|
|
useXForwardedForIP => '0',
|
|
|
|
whatToTrace => '$uid',
|
2009-12-11 19:17:00 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-12-29 18:03:24 +01:00
|
|
|
sub subDefaultConf {
|
|
|
|
return {
|
|
|
|
locationRules => { default => 'deny' },
|
|
|
|
exportedHeaders => { 'Auth-User' => '$uid' },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-12-11 19:17:00 +01:00
|
|
|
1;
|