mirror of https://gitlab.com/bashrc2/epicyon
Use an ssh-style format for logging login failures
parent
4d849f33a8
commit
bb4afef15f
9
auth.py
9
auth.py
|
|
@ -245,7 +245,12 @@ def recordLoginFailure(baseDir: str, ipAddress: str,
|
||||||
currTime = datetime.datetime.utcnow()
|
currTime = datetime.datetime.utcnow()
|
||||||
try:
|
try:
|
||||||
with open(failureLog, writeType) as fp:
|
with open(failureLog, writeType) as fp:
|
||||||
fp.write(currTime.strftime("%Y-%m-%d %H:%M:%SZ") +
|
# here we use a similar format to an ssh log, so that
|
||||||
' ' + ipAddress + '\n')
|
# systems such as fail2ban can parse it
|
||||||
|
fp.write(currTime.strftime("%Y-%m-%d %H:%M:%SZ") + ' ' +
|
||||||
|
'ip-127-0-0-1 sshd[20710]: ' +
|
||||||
|
'Disconnecting invalid user epicyon ' +
|
||||||
|
ipAddress + ' port 443: ' +
|
||||||
|
'Too many authentication failures [preauth]\n')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue