Configure timeout for configuration reload (#1553)

This commit is contained in:
Clément OUDOT 2018-11-26 08:21:00 +01:00
parent ef5b4bcc36
commit 9cb56173db
12 changed files with 74 additions and 49 deletions

View File

@ -193,6 +193,7 @@ sub defaultValues {
'registerDB' => 'Null', 'registerDB' => 'Null',
'registerTimeout' => 0, 'registerTimeout' => 0,
'registerUrl' => 'http://auth.example.com/register', 'registerUrl' => 'http://auth.example.com/register',
'reloadTimeout' => 5,
'remoteGlobalStorage' => 'Lemonldap::NG::Common::Apache::Session::SOAP', 'remoteGlobalStorage' => 'Lemonldap::NG::Common::Apache::Session::SOAP',
'remoteGlobalStorageOptions' => { 'remoteGlobalStorageOptions' => {
'ns' => 'ns' =>

View File

@ -8,17 +8,17 @@ sub types {
'array' => { 'array' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'authParamsText' => { 'authParamsText' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'blackWhiteList' => { 'blackWhiteList' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'bool' => { 'bool' => {
'msgFail' => '__notABoolean__', 'msgFail' => '__notABoolean__',
@ -36,17 +36,17 @@ sub types {
split( /\n/, $@, 0 ) ) split( /\n/, $@, 0 ) )
); );
return $err ? ( 1, "__badExpression__: $err" ) : 1; return $err ? ( 1, "__badExpression__: $err" ) : 1;
} }
}, },
'catAndAppList' => { 'catAndAppList' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'file' => { 'file' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'hostname' => { 'hostname' => {
'form' => 'text', 'form' => 'text',
@ -80,48 +80,48 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
if $_ =~ /exportedvars$/i and defined $conf->{$_}{$val}; if $_ =~ /exportedvars$/i and defined $conf->{$_}{$val};
} }
return 1, "__unknownAttrOrMacro__: $val"; return 1, "__unknownAttrOrMacro__: $val";
} }
}, },
'longtext' => { 'longtext' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'menuApp' => { 'menuApp' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'menuCat' => { 'menuCat' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'oidcmetadatajson' => { 'oidcmetadatajson' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'oidcmetadatajwks' => { 'oidcmetadatajwks' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'oidcOPMetaDataNode' => { 'oidcOPMetaDataNode' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'oidcRPMetaDataNode' => { 'oidcRPMetaDataNode' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'password' => { 'password' => {
'msgFail' => '__malformedValue__', 'msgFail' => '__malformedValue__',
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'pcre' => { 'pcre' => {
'form' => 'text', 'form' => 'text',
@ -132,7 +132,7 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
} }
}; };
return $@ ? ( 0, "__badRegexp__: $@" ) : 1; return $@ ? ( 0, "__badRegexp__: $@" ) : 1;
} }
}, },
'PerlModule' => { 'PerlModule' => {
'form' => 'text', 'form' => 'text',
@ -142,17 +142,17 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'portalskin' => { 'portalskin' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'portalskinbackground' => { 'portalskinbackground' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'post' => { 'post' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'RSAPrivateKey' => { 'RSAPrivateKey' => {
'test' => sub { 'test' => sub {
@ -160,7 +160,7 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
m[^(?:(?:\-+\s*BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY\s*\-+\r?\n)?(?:Proc-Type:.*\r?\nDEK-Info:.*\r?\n[\r\n]*)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+(?:RSA\s+)PRIVATE\s+KEY\s*\-+)?[\r\n]*)?$]s m[^(?:(?:\-+\s*BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY\s*\-+\r?\n)?(?:Proc-Type:.*\r?\nDEK-Info:.*\r?\n[\r\n]*)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+(?:RSA\s+)PRIVATE\s+KEY\s*\-+)?[\r\n]*)?$]s
? 1 ? 1
: ( 1, '__badPemEncoding__' ); : ( 1, '__badPemEncoding__' );
} }
}, },
'RSAPublicKey' => { 'RSAPublicKey' => {
'test' => sub { 'test' => sub {
@ -168,7 +168,7 @@ m[^(?:(?:\-+\s*BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY\s*\-+\r?\n)?(?:Proc-Type:.*\r?\n
m[^(?:(?:\-+\s*BEGIN\s+PUBLIC\s+KEY\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+PUBLIC\s+KEY\s*\-+)?[\r\n]*)?$]s m[^(?:(?:\-+\s*BEGIN\s+PUBLIC\s+KEY\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+PUBLIC\s+KEY\s*\-+)?[\r\n]*)?$]s
? 1 ? 1
: ( 1, '__badPemEncoding__' ); : ( 1, '__badPemEncoding__' );
} }
}, },
'RSAPublicKeyOrCertificate' => { 'RSAPublicKeyOrCertificate' => {
'test' => sub { 'test' => sub {
@ -176,37 +176,37 @@ m[^(?:(?:\-+\s*BEGIN\s+PUBLIC\s+KEY\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\
m[^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+)?[\r\n]*)?$]s m[^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\n]+={0,2}(?:\r?\n\-+\s*END\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+)?[\r\n]*)?$]s
? 1 ? 1
: ( 1, '__badPemEncoding__' ); : ( 1, '__badPemEncoding__' );
} }
}, },
'rule' => { 'rule' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'samlAssertion' => { 'samlAssertion' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'samlAttribute' => { 'samlAttribute' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'samlIDPMetaDataNode' => { 'samlIDPMetaDataNode' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'samlService' => { 'samlService' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'samlSPMetaDataNode' => { 'samlSPMetaDataNode' => {
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'select' => { 'select' => {
'test' => sub { 'test' => sub {
@ -216,19 +216,19 @@ m[^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9/\+\r\
return $test return $test
? 1 ? 1
: ( 1, "Invalid value '$_[0]' for this select" ); : ( 1, "Invalid value '$_[0]' for this select" );
} }
}, },
'subContainer' => { 'subContainer' => {
'keyTest' => qr/\w/, 'keyTest' => qr/\w/,
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'text' => { 'text' => {
'msgFail' => '__malformedValue__', 'msgFail' => '__malformedValue__',
'test' => sub { 'test' => sub {
1; 1;
} }
}, },
'trool' => { 'trool' => {
'msgFail' => '__authorizedValues__: -1, 0, 1', 'msgFail' => '__authorizedValues__: -1, 0, 1',
@ -1054,7 +1054,7 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
split( /\n/, $@, 0 ) ) split( /\n/, $@, 0 ) )
); );
return $err ? ( 1, "__badExpression__: $err" ) : 1; return $err ? ( 1, "__badExpression__: $err" ) : 1;
} }
}, },
'type' => 'keyTextContainer' 'type' => 'keyTextContainer'
}, },
@ -1227,7 +1227,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
and defined $conf->{$_}{$val}; and defined $conf->{$_}{$val};
} }
return 1, "__unknownAttrOrMacro__: $val"; return 1, "__unknownAttrOrMacro__: $val";
} }
}, },
'type' => 'doubleHash' 'type' => 'doubleHash'
}, },
@ -1510,7 +1510,7 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
split( /\n/, $@, 0 ) ) split( /\n/, $@, 0 ) )
); );
return $err ? ( 1, "__badExpression__: $err" ) : 1; return $err ? ( 1, "__badExpression__: $err" ) : 1;
} }
}, },
'type' => 'ruleContainer' 'type' => 'ruleContainer'
}, },
@ -2367,6 +2367,10 @@ qr/^(?:\*\.)?(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][
'default' => 'http://auth.example.com/register', 'default' => 'http://auth.example.com/register',
'type' => 'text' 'type' => 'text'
}, },
'reloadTimeout' => {
'default' => 5,
'type' => 'int'
},
'reloadUrls' => { 'reloadUrls' => {
'keyTest' => 'keyTest' =>
qr/^(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+))(?::\d+)?$/, qr/^(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+))(?::\d+)?$/,

View File

@ -366,6 +366,12 @@ sub attributes {
default => 'get', default => 'get',
documentation => 'HTTP method for redirect page form', documentation => 'HTTP method for redirect page form',
}, },
reloadTimeout => {
type => 'int',
default => 5,
documentation => 'Configuration reload timeout',
flags => 'm',
},
reloadUrls => { reloadUrls => {
type => 'keyTextContainer', type => 'keyTextContainer',
help => 'configlocation.html#configuration_reload', help => 'configlocation.html#configuration_reload',
@ -404,13 +410,13 @@ sub attributes {
default => 0, default => 0,
documentation => 'Enable CheckState plugin', documentation => 'Enable CheckState plugin',
}, },
checkStateSecret => { checkStateSecret => {
type => 'text', type => 'text',
documentation => 'Secret token for CheckState plugin', documentation => 'Secret token for CheckState plugin',
}, },
skipRenewConfirmation => { skipRenewConfirmation => {
type => 'bool', type => 'bool',
default => 0, default => 0,
documentation => documentation =>
'Avoid asking confirmation when an Issuer asks to renew auth', 'Avoid asking confirmation when an Issuer asks to renew auth',
}, },
@ -625,9 +631,10 @@ sub attributes {
documentation => 'Default value for Content-Security-Policy', documentation => 'Default value for Content-Security-Policy',
}, },
cspFormAction => { cspFormAction => {
type => 'text', type => 'text',
default => "'self'", default => "'self'",
documentation => 'Form action destination for Content-Security-Policy', documentation =>
'Form action destination for Content-Security-Policy',
}, },
cspImg => { cspImg => {
type => 'text', type => 'text',

View File

@ -544,7 +544,10 @@ sub tree {
} }
] ]
}, },
'reloadUrls', {
title => 'reloadParams',
nodes => [ 'reloadUrls', 'reloadTimeout', ]
},
{ {
title => 'plugins', title => 'plugins',
help => 'start.html#plugins', help => 'start.html#plugins',

View File

@ -332,7 +332,7 @@ sub applyConf {
} }
return {} unless (%reloadUrls); return {} unless (%reloadUrls);
$self->ua->timeout(3); $self->ua->timeout( $newConf->{reloadTimeout} );
# Parse apply values # Parse apply values
while ( my ( $host, $request ) = each %reloadUrls ) { while ( my ( $host, $request ) = each %reloadUrls ) {

View File

@ -635,7 +635,9 @@
"registerDoneSubject":"عنوان البريد الذي تم القيام به", "registerDoneSubject":"عنوان البريد الذي تم القيام به",
"registerTimeout":"مدة صلاحية طلب التسجيل", "registerTimeout":"مدة صلاحية طلب التسجيل",
"registerUrl":"Page URL", "registerUrl":"Page URL",
"reloadUrls":"إعادة تحميل الإعدادات", "reloadParams":"إعادة تحميل الإعدادات",
"reloadTimeout":"Reload timeout",
"reloadUrls":"Reload URLs",
"remoteCookieName":"اسم ملف تعريف الارتباط", "remoteCookieName":"اسم ملف تعريف الارتباط",
"remoteGlobalStorage":"وحدة الجلسات", "remoteGlobalStorage":"وحدة الجلسات",
"remoteGlobalStorageOptions":"خيارات وحدة الجلسات", "remoteGlobalStorageOptions":"خيارات وحدة الجلسات",

View File

@ -635,7 +635,9 @@
"registerDoneSubject":"Subject for done mail", "registerDoneSubject":"Subject for done mail",
"registerTimeout":"Validity time of a register request", "registerTimeout":"Validity time of a register request",
"registerUrl":"Page URL", "registerUrl":"Page URL",
"reloadUrls":"Configuration reload", "reloadParams":"Configuration reload",
"reloadTimeout":"Reload timeout",
"reloadUrls":"Reload URLs",
"remoteCookieName":"Cookie name", "remoteCookieName":"Cookie name",
"remoteGlobalStorage":"Sessions module", "remoteGlobalStorage":"Sessions module",
"remoteGlobalStorageOptions":"Sessions module options", "remoteGlobalStorageOptions":"Sessions module options",

View File

@ -635,7 +635,9 @@
"registerDoneSubject":"Sujet du mail de prise en compte", "registerDoneSubject":"Sujet du mail de prise en compte",
"registerTimeout":"Durée de validité de la requête", "registerTimeout":"Durée de validité de la requête",
"registerUrl":"URL de la page", "registerUrl":"URL de la page",
"reloadUrls":"Mise à jour de la configuration", "reloadParams":"Mise à jour de la configuration",
"reloadTimeout":"Délai de mise à jour",
"reloadUrls":"URLs de mise à jour",
"remoteCookieName":"Nom du cookie", "remoteCookieName":"Nom du cookie",
"remoteGlobalStorage":"Module des sessions", "remoteGlobalStorage":"Module des sessions",
"remoteGlobalStorageOptions":"Options du module des sessions", "remoteGlobalStorageOptions":"Options du module des sessions",

View File

@ -635,7 +635,9 @@
"registerDoneSubject":"Oggetto per la mail inviata", "registerDoneSubject":"Oggetto per la mail inviata",
"registerTimeout":"Tempo di validità di una richiesta di registrazione", "registerTimeout":"Tempo di validità di una richiesta di registrazione",
"registerUrl":"Page URL", "registerUrl":"Page URL",
"reloadUrls":"Ricarica di configurazione", "reloadParams":"Ricarica di configurazione",
"reloadTimeout":"Reload timeout",
"reloadUrls":"Reload URLs",
"remoteCookieName":"Nome del cookie", "remoteCookieName":"Nome del cookie",
"remoteGlobalStorage":"Modulo di sessioni", "remoteGlobalStorage":"Modulo di sessioni",
"remoteGlobalStorageOptions":"Opzioni del modulo Sessioni", "remoteGlobalStorageOptions":"Opzioni del modulo Sessioni",

View File

@ -635,7 +635,9 @@
"registerDoneSubject":"Tiêu đề cho thư đã hoàn tất", "registerDoneSubject":"Tiêu đề cho thư đã hoàn tất",
"registerTimeout":"Thời hạn hiệu lực của yêu cầu đăng ký", "registerTimeout":"Thời hạn hiệu lực của yêu cầu đăng ký",
"registerUrl":"Page URL", "registerUrl":"Page URL",
"reloadUrls":"Tải lại cấu hình", "reloadParams":"Tải lại cấu hình",
"reloadTimeout":"Reload timeout",
"reloadUrls":"Reload URLs",
"remoteCookieName":"Tên cookie", "remoteCookieName":"Tên cookie",
"remoteGlobalStorage":"Mô-đun phiên", "remoteGlobalStorage":"Mô-đun phiên",
"remoteGlobalStorageOptions":"Tùy chọn mô-đun phiên", "remoteGlobalStorageOptions":"Tùy chọn mô-đun phiên",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long