mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-10-30 17:43:44 +00:00
Use an ssh-style format for logging login failures
This commit is contained in:
1 parent
4d849f33a8
commit
bb4afef15f
1 file changed
+7
-2
@@ -245,7 +245,12 @@ def recordLoginFailure(baseDir: str, ipAddress: str,
|
||||
currTime = datetime.datetime.utcnow()
|
||||
try:
|
||||
with open(failureLog, writeType) as fp:
|
||||
fp.write(currTime.strftime("%Y-%m-%d %H:%M:%SZ") +
|
||||
' ' + ipAddress + '\n')
|
||||
# here we use a similar format to an ssh log, so that
|
||||
# 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:
|
||||
pass
|
||||
Reference in new issue
Block a user