Une question qui a en réalité plus à voir avec le système qu'avec
fail2ban…
Comme ça se produit dans fail2ban, je me lance quand même ici sans
HS ;-)
J'ai un paquet de lignes qui ne servent à rien dans mes logs :
# cat fail2ban.log
2015-02-08 06:28:58,509 fail2ban.server : INFO Changed logging
target to /var/log/fail2ban.log for Fail2ban v0.8.6
2015-02-08 06:29:04,215 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,263 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/access.log
2015-02-08 06:29:04,293 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
2015-02-08 06:29:04,296 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/error.log
2015-02-08 06:29:04,451 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,548 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
2015-02-08 06:29:04,569 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
2015-02-08 06:29:04,681 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
2015-02-08 06:29:04,720 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,751 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,844 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,896 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:04,957 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:27,477 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:38,540 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:29:38,717 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:29:38,722 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:29:39,720 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:29:39,725 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:29:39,994 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:29:40,544 fail2ban.filter : INFO Log rotation
detected for /var/log/mail.log
2015-02-08 06:31:16,397 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/access.log
2015-02-08 06:31:16,435 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/error.log
2015-02-08 06:33:25,121 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:33:25,976 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:33:26,022 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:33:53,507 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 06:33:54,193 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.access.log
2015-02-08 07:06:44,456 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
2015-02-08 07:06:44,880 fail2ban.filter : INFO Log rotation
detected for /var/log/nginx/$log*.error.log
==
J'ai un certain nombre de fichiers de logs HTTP différents que j'ai
renommés $log*, ça ne vous étonne pas.
Ces lignes d'info ne servent à rien et sont redondantes, la question
a été posée et résolue sur Internet :
https://github.com/fail2ban/fail2ban/issues/129
On a un lien vers le correctif dans le tropique du GitHub, et j'ai
comparé avec ce que j'ai chez moi :
# locate filter.py
/usr/lib/python2.7/lib2to3/fixes/fix_filter.py
/usr/lib/python2.7/lib2to3/fixes/fix_filter.pyc
/usr/share/fail2ban/server/filter.py
# vi /usr/share/fail2ban/server/filter.py
class FileContainer:
def __init__(self, filename, tail = False):
self.__filename = filename
self.__tail = tail
self.__handler = None
# Try to open the file. Raises an exception if an
error occured.
handler = open(filename)
stats = os.fstat(handler.fileno())
self.__ino = stats.st_ino
try:
firstLine = handler.readline()
# Computes the MD5 of the first line.
self.__hash = md5sum(firstLine).digest()
# Start at the beginning of file if tail
mode is off.
if tail:
handler.seek(0, 2)
self.__pos =