Manager: fix SSLVarIf syntax (#2082)

This commit is contained in:
Maxime Besson 2020-01-31 17:43:49 +01:00
parent f997a26e41
commit e40568a330
3 changed files with 16 additions and 7 deletions

View File

@ -3648,7 +3648,10 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
},
'SSLVarIf' => {
'default' => {},
'type' => 'keyTextContainer'
'keyTest' => sub {
1;
},
'type' => 'keyTextContainer'
},
'staticPrefix' => {
'type' => 'text'

View File

@ -358,7 +358,7 @@ sub attributes {
msgFail => '__badUrl__',
},
portalCustomCss => {
type => 'text',
type => 'text',
documentation => 'Path to custom CSS file',
},
portalStatus => {
@ -3147,6 +3147,7 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
},
SSLVarIf => {
type => 'keyTextContainer',
keyTest => sub { 1 },
default => {}
},
sslByAjax => {

View File

@ -32,12 +32,17 @@ sub init {
sub extractFormInfo {
my ( $self, $req ) = @_;
my $field = $self->conf->{SSLVar};
if ( $req->env->{SSL_CLIENT_I_DN}
and my $tmp =
$self->conf->{SSLVarIf}->{ $req->env->{SSL_CLIENT_I_DN} } )
{
$field = $tmp;
if ( $req->env->{SSL_CLIENT_I_DN} ) {
$self->logger->debug(
'Received SSL issuer ' . $req->env->{SSL_CLIENT_I_DN} );
if ( my $tmp =
$self->conf->{SSLVarIf}->{ $req->env->{SSL_CLIENT_I_DN} } )
{
$field = $tmp;
}
}
$self->logger->debug("Using SSL environment variable $field");
if ( $req->user( $req->env->{$field} ) ) {
$self->userLogger->notice( "GoodSSL authentication for " . $req->user );
return PE_OK;