Add host to logs for use with fail2ban

This commit is contained in:
Baptiste Pecatte 2020-06-26 21:44:06 +02:00
parent f78b2bfa16
commit 068370a893
2 changed files with 7 additions and 4 deletions

View File

@ -144,7 +144,8 @@ sub getUser {
return PE_BADCREDENTIALS;
}
unless ( $req->data->{ldapentry} = $mesg->entry(0) ) {
$self->userLogger->warn("$req->{user} was not found in LDAP directory");
my $ipAddr = $req->address;
$self->userLogger->warn("$req->{user} was not found in LDAP directory ($ipAddr)");
eval { $self->p->_authentication->setSecurity($req) };
return PE_BADCREDENTIALS;
}
@ -178,4 +179,4 @@ sub bind {
return 1;
}
1;
1;

View File

@ -180,7 +180,8 @@ sub userBind {
# Return direct unless control resonse
unless ( defined $resp ) {
if ( $mesg->code == 49 ) {
$self->{portal}->userLogger->warn("Bad password");
my $ipAddr = $req->address;
$self->{portal}->userLogger->warn("Bad password for $req->{user} ($ipAddr)");
return PE_BADCREDENTIALS;
}
elsif ( $mesg->code == 0 ) {
@ -262,7 +263,8 @@ sub userBind {
$req->data->{ldapError} = $mesg->error;
}
}
$self->{portal}->userLogger->warn("Bad password for $req->{user}");
my $ipAddr = $req->address;
$self->{portal}->userLogger->warn("Bad password for $req->{user} ($ipAddr)");
return PE_BADCREDENTIALS;
}