Merge branch 'fail2ban-logs' into 'master'

Add host to logs for use with fail2ban

See merge request lemonldap-ng/lemonldap-ng!154
This commit is contained in:
Clément OUDOT 2020-07-05 13:10:43 +02:00
commit 986a3974b0
3 changed files with 11 additions and 4 deletions

View File

@ -65,6 +65,13 @@ Authentication:
[notice] User clement.oudot.com successfully authenticated at level 2
[notice] clement.oudot connected
Failed authentication:
::
[warn] foo.bar was not found in LDAP directory (81.20.13.21)
[warn] Bad password for clement.oudot (81.20.13.21)
Logout:
::

View File

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

View File

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