Pages : 1
#1 Le 26/12/2007, à 18:24
- zip80
[RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Bonjour,
J'utilise fail2ban pour protéger mon serveur. J'utilise également sendmail et postfix.
J'ai donc suivi les explications de la FAQ de fail2ban ici :
http://www.fail2ban.org/wiki/index.php/FAQ_french#J.27utilise_Postfix_sur_mon_syst.C3.A8me_mais_je_n.27ai_pas_de_commande_.22mail.22._Comment_recevoir_les_notifications_par_mail.3F
J'ai configuré dans un premier temps :
/etc/fail2ban/jail.local :
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = utilisateur@mon_domaine.com
/etc/fail2ban/action.d/mail.local
# Destination/Addressee of the mail
#
dest = utilisateur@mon_domaine.com
/etc/fail2ban/action.d/mail-whois.local
# Destination/Addressee of the mail
#
dest = utilisateur@mon_domaine.com
Puis dans un deuxième temps car ça ne fonctionnait pas :
/etc/fail2ban/jail.conf :
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = utilisateur@mon_domaine.com
/etc/fail2ban/action.d/mail.conf
# Destination/Addressee of the mail
#
dest = utilisateur@mon_domaine.com
/etc/fail2ban/action.d/mail-whois.conf
# Destination/Addressee of the mail
#
dest = utilisateur@mon_domaine.com
Le problème qui se pose, c'est que je ne reçois pas de mail lors d'un ban.
J'ai essayé de trouver dans les logs une trace d'erreur mais rien... Ni même la trace de l'envoi d'un mail.
Peut-être que je ne regarde pas o๠il faut ?
Avez-vous déjà réussi à faire marcher cette fonctionnalité de fail2ban ?
Merci,
ZiP
Dernière modification par zip80 (Le 30/12/2007, à 17:28)
Hors ligne
#2 Le 29/12/2007, à 00:37
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
1- Quel serveur de mail as tu installé ? Postfix ? Sendmail ??
2- As tu configuré ton serveur de mail ?
3- Les logs sont généralement dans le /var/log/mail.log
Hors ligne
#3 Le 29/12/2007, à 00:56
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Bonjour,
Alors :
1- Postfix via le tutorial ici : http://doc.ubuntu-fr.org/serveur/postfix_mysql_tls_sasl
2- Mon serveur de mail est configuré comme expliqué dans le tutorial cité ci-dessus
3- Je ne vois pas de trace de ces mails dans les logs
J'ai configuré fail2ban pour sendmail avec postfix comme expliqué ici :
http://www.fail2ban.org/wiki/index.php/FAQ_french#J.27utilise_Postfix_sur_mon_syst.C3.A8me_mais_je_n.27ai_pas_de_commande_.22mail.22._Comment_recevoir_les_notifications_par_mail.3F
Merci,
ZiP
Dernière modification par zip80 (Le 29/12/2007, à 00:57)
Hors ligne
#4 Le 29/12/2007, à 01:14
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Est ce que tu recois les mails (envoyés autrement qu'avec fail2ban) ?
sudo apt-get install mailx
echo toto | mail utilisateur@mon_domaine.com
Hors ligne
#5 Le 29/12/2007, à 01:36
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Je reçois bien les mails.
J'ai installé mailx et exécuté la commande, je reçois bien le mail dont voici les logs :
Dec 29 07:09:05 mon_serveur postfix/pickup[14854]: E586C401A0: uid=1000 from=<utilisateur_linux>
Dec 29 07:09:05 mon_serveur postfix/cleanup[15564]: E586C401A0: message-id=<20071229060905.E586C401A0@mon_serveur.dedibox.fr>
Dec 29 07:09:05 mon_serveur postfix/qmgr[14071]: E586C401A0: from=<utilisateur_linux@mon_serveur.dedibox.fr>, size=291, nrcpt=1 (queue active)
Dec 29 07:09:06 mon_serveur postfix/smtpd[15568]: connect from localhost[127.0.0.1]
Dec 29 07:09:06 mon_serveur postfix/smtpd[15568]: 1A99340193: client=localhost[127.0.0.1]
Dec 29 07:09:06 mon_serveur postfix/cleanup[15564]: 1A99340193: message-id=<20071229060905.E586C401A0@mon_serveur.dedibox.fr>
Dec 29 07:09:06 mon_serveur postfix/qmgr[14071]: 1A99340193: from=<utilisateur_linux@mon_serveur.dedibox.fr>, size=679, nrcpt=1 (queue active)
Dec 29 07:09:06 mon_serveur amavis[11113]: (11113-04) Passed CLEAN, <utilisateur_linux@mon_serveur.dedibox.fr> -> <utilisateur@mon_domaine.com>, Message-ID: <20071229060905.E586C401A0@mon_serveur.dedibox.fr>, mail_id: eOx7dwQz1+Fp, Hits: -, queued_as: 1A99340193, 199 ms
Dec 29 07:09:06 mon_serveur postfix/smtp[15566]: E586C401A0: to=<utilisateur@mon_domaine.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.26, delays=0.05/0.01/0.01/0.2, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=11113-04, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 1A99340193)
Dec 29 07:09:06 mon_serveur postfix/qmgr[14071]: E586C401A0: removed
Dec 29 07:09:06 mon_serveur postfix/smtpd[15568]: disconnect from localhost[127.0.0.1]
Dec 29 07:09:06 mon_serveur postfix/virtual[15569]: 1A99340193: to=<utilisateur@mon_domaine.com>, relay=virtual, delay=0.1, delays=0.06/0.04/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Dec 29 07:09:06 mon_serveur postfix/qmgr[14071]: 1A99340193: removed
J'ai laissé passer la nuit, j'ai eu des attaques et je n'ai reçu aucun mail.
Que dois je faire d'autres ?
Remettre la configuration de base de fail2ban ?
Merci,
ZiP
Dernière modification par zip80 (Le 29/12/2007, à 08:16)
Hors ligne
#6 Le 29/12/2007, à 14:16
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Ok donc c'est un problème fail2ban (pas Postfix)
Je pige pas ta conf...
Quel est le contenu par défaut de "/etc/fail2ban/action.d/mail-whois.conf" ?
Pourquoi tu n'as pas les lignes indiqués dans le lien que tu as suivi ?
Remet les trucs par defaut.. essaye.. si ca marche pas donne le contenu des fichiers...
(Je connais pas fail2ban)
Hors ligne
#7 Le 29/12/2007, à 14:38
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Le fichier par defaut : /etc/fail2ban/jail.conf
# Fail2Ban configuration file.
#
# This file was composed for Debian systems from the original one
# provided now under /usr/share/doc/fail2ban/examples/jail.conf
# for additional examples.
#
# To avoid merges during upgrades DO NOT MODIFY THIS FILE
# and rather provide your changes in /etc/fail2ban/jail.local
#
# Author: Yaroslav O. Halchenko <debian@onerussian.com>
#
# $Revision: 281 $
#
# The DEFAULT allows a global definition of the options. They can be override
# in each jail afterwards.
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1
bantime = 600
maxretry = 3
# "backend" specifies the backend used to get files modification. Available
# options are "gamin", "polling" and "auto".
# yoh: For some reason Debian shipped python-gamin didn't work as expected
# This issue left ToDo, so polling is default backend for now
backend = polling
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = root@localhost
#
# ACTIONS
#
# Default banning action (e.g. iptables, iptables-new,
# iptables-multiport, shorewall, etc) It is used to define
# action_* variables. Can be overriden globally or per
# section within jail.local file
banaction = iptables-multiport
#
# Action shortcuts. To be used to define action parameter
# The simplest action to take: ban only
action_ = %(banaction)s[name=%(__name__)s, port="%(port)s"]
# ban & send an e-mail with whois report to the destemail.
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s"]
mail-whois[name=%(__name__)s, dest="%(destemail)s"]
# ban & send an e-mail with whois report and relevant log lines
# to the destemail.
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s"]
mail-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s]
# Choose default action. To change, just override value of 'action' with the
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
# globally (section [DEFAULT]) or per specific section
action = %(action_)s
#
# JAILS
#
# Next jails corresponds to the standard configuration in Fail2ban 0.6 which
# was shipped in Debian. Please enable any defined here jail by including
#
# [SECTION_NAME]
# enabled = true
#
# in /etc/fail2ban/jail.local.
#
# Optionally you may override any other parameter (e.g. banaction,
# action, port, logpath, etc) in that section within jail.local
[ssh]
enabled = true
port = ssh,sftp
filter = sshd
logpath = /var/log/auth.log
maxretry = 6
[ssh-ddos]
enabled = false
port = ssh,sftp
filter = sshd-ddos
logpath = /var/log/auth.log
maxretry = 6
#
# HTTP servers
#
[apache]
enabled = false
port = http,https
filter = apache-auth
logpath = /var/log/apache*/*access.log
maxretry = 6
# default action is now multiport, so apache-multiport jail was left
# for compatibility with previous (<0.7.6-2) releases
[apache-multiport]
enabled = false
port = http,https
filter = apache-auth
logpath = /var/log/apache*/*access.log
maxretry = 6
[apache-noscript]
enabled = false
port = http,https
filter = apache-noscript
logpath = /var/log/apache*/*error.log
maxretry = 6
#
# FTP servers
#
[vsftpd]
enabled = false
port = ftp,ftp-data,ftps,ftps-data
filter = vsftpd
logpath = /var/log/vsftpd.log
# or overwrite it in jails.local to be
# logpath = /var/log/auth.log
# if you want to rely on PAM failed login attempts
# vsftpd's failregex should match both of those formats
maxretry = 6
[proftpd]
enabled = false
port = ftp,ftp-data,ftps,ftps-data
filter = proftpd
logpath = /var/log/proftpd/proftpd.log
maxretry = 6
[wuftpd]
enabled = false
port = ftp,ftp-data,ftps,ftps-data
filter = wuftpd
logpath = /var/log/auth.log
maxretry = 6
#
# Mail servers
#
[postfix]
enabled = false
port = smtp,ssmtp
filter = postfix
logpath = /var/log/mail.log
[couriersmtp]
enabled = false
port = smtp,ssmtp
filter = couriersmtp
logpath = /var/log/mail.log
#
# Mail servers authenticators: might be used for smtp,ftp,imap servers, so
# all relevant ports get banned
#
[courierauth]
enabled = false
port = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter = courierlogin
logpath = /var/log/mail.log
[sasl]
enabled = false
port = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter = sasl
logpath = /var/log/mail.log
Le fichier par defaut : /etc/fail2ban/action.d/mail-whois.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 510 $
#
[Definition]
# Option: actionstart
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
The jail <name> has been started successfuly.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: started" <dest>
# Option: actionend
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
# Option: actioncheck
# Notes.: command executed once before each actionban command
# Values: CMD
#
actioncheck =
# Option: actionban
# Notes.: command executed when banning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: <ip> IP address
# <failures> number of failures
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n\n
Here are more information about <ip>:\n
`whois <ip>`\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip>" <dest>
# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: <ip> IP address
# <failures> number of failures
# <time> unix timestamp of the ban time
# Values: CMD
#
actionunban =
[Init]
# Defaut name of the chain
#
name = default
# Destination/Addressee of the mail
#
dest = root
Le fichier par defaut : /etc/fail2ban/action.d/mail.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 510 $
#
[Definition]
# Option: actionstart
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = echo -en "Hi,\n
The jail <name> has been started successfuly.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: started" <dest>
# Option: actionend
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = echo -en "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped" <dest>
# Option: actioncheck
# Notes.: command executed once before each actionban command
# Values: CMD
#
actioncheck =
# Option: actionban
# Notes.: command executed when banning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: <ip> IP address
# <failures> number of failures
# <time> unix timestamp of the ban time
# Values: CMD
#
actionban = echo -en "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n
Regards,\n
Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip>" <dest>
# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: <ip> IP address
# <failures> number of failures
# <time> unix timestamp of the ban time
# Values: CMD
#
actionunban =
[Init]
# Defaut name of the chain
#
name = default
# Destination/Addressee of the mail
#
dest = root
Pourquoi tu n'as pas les lignes indiqués dans le lien que tu as suivi ?
Les lignes de la FAQ? Tu es bien d'accord que dans la FAQ ils disent qu'il faut recopier le fichier et travailler dans le .local ?
D'après le fichier /etc/fail2ban/jail.conf :
# To avoid merges during upgrades DO NOT MODIFY THIS FILE
# and rather provide your changes in /etc/fail2ban/jail.local[...]
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = root@localhost
J'ai fais un sudo apt-get remove --purge fail2ban puis un sudo apt-get install fail2ban. J'ai donc une config de base là .
ZiP
Dernière modification par zip80 (Le 29/12/2007, à 14:53)
Hors ligne
#8 Le 29/12/2007, à 16:26
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
T'as mis la bonne action dans "banaction"
# Default banning action (e.g. iptables, iptables-new,
# iptables-multiport, shorewall, etc) It is used to define
# action_* variables. Can be overriden globally or per
# section within jail.local file
banaction = iptables-multiport
C'est pas la qu'il faut rajouter aussi "mail-whois" par exemple ??
Hors ligne
#9 Le 29/12/2007, à 18:42
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Haaaa, en effet! Je viens de rajouter ça :
banaction = iptables-multiport,mail
J'ai ça en config :
/etc/fail2ban/jail.local => destemail = utilisateur@mon_domaine.com
/etc/fail2ban/action.d/mail.local => dest = utilisateur@mon_domaine.com
J'attends la prochaine attaque...
Merci,
ZiP
Dernière modification par zip80 (Le 29/12/2007, à 18:42)
Hors ligne
#10 Le 29/12/2007, à 21:45
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Alors, lorsque je mets ça :
banaction = iptables-multiport, mail
En fait, il ne démarre plus, je pouvais attendre longtemps...
Je l'ai enlevé, il démarre...
Je ne reçois toujours pas les e-mails...
Je ne sais vraiment plus quoi faire là
ZiP
Hors ligne
#11 Le 29/12/2007, à 23:55
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Bon je l'ai installé juste pour toi...
- Vire toutes tes modifs (desinstalle/reinstalle si besoin)
- sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
- Edite /etc/fail2ban/jail.local avec
action = %(action_mwl)s
et
destemail = tonadress@tondomaine.com
- Lance un tail -f /var/log/mail.log
- Restart sudo /etc/init.d/fail2ban restart
- Tu devrrais deja voir l'envoi d'un mail.
Hors ligne
#12 Le 30/12/2007, à 13:18
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Tout d'abord merci pour votre patience!
J'ai donc effacé tous mes .local et j'ai recréé mon jail.local avec les modifications conseillées.
J'ai bien reçu 4 mails quand je l'ai lancé :
-en Hi,
The jail ssh has been started successfuly.
Regards,
Fail2Ban
Je vais voir pourquoi les mails commencent toujours avec "-en" je pense qu'il y a un problème, ainsi que changé l'adresse d'envoi.
J'ai recopié le fichier mail-whois.conf en mail-whois.local puis redémarré le service et il ne le prend pas en compte...
Encore merci,
ZiP
Dernière modification par zip80 (Le 30/12/2007, à 13:25)
Hors ligne
#13 Le 30/12/2007, à 13:50
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Je ne modifiais pas dans le bon fichier, c'est celui-là :
/etc/fail2ban/action.d/mail-whois-lines.local
J'arrive à enlever le "-en" et à changer le contenu des mails cependant je n'arrive pas à changer l'expéditeur du mail.
Je voudrais que ça soit marqué : Robot <robot@mon_domaine.com> au lieu de root <root@xx.dedibox.fr>
Merci,
ZiP
Hors ligne
#14 Le 30/12/2007, à 15:01
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
zgrep -B1 sender /usr/share/doc/fail2ban/examples/jail.conf.gz
Hors ligne
#15 Le 30/12/2007, à 15:18
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Que fait cette commande ?
Hors ligne
#16 Le 30/12/2007, à 15:27
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
man zgrep
man man
Hors ligne
#17 Le 30/12/2007, à 15:31
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
J'ai fais un déjà fais un : man zgrep
Mais ça me dit pas ce que veut dire -B1 et sender.
Je pense que mon dernier problème est plus lié à la commande mail qu'à fail2ban.
Je vais chercher de ce côté...
Merci quand même pour tout.
ZiP
Hors ligne
#18 Le 30/12/2007, à 16:05
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
zgrep -B1 sender /usr/share/doc/fail2ban/examples/jail.conf.gz
man grep pour les options
Recherche la ligne avec "sender" + 1 ligne avant dans le fichier de conf d'exemple non modifié par Debian.
Hors ligne
#19 Le 30/12/2007, à 16:06
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Je pense que mon dernier problème est plus lié à la commande mail qu'à fail2ban.
Non.
Lance ma commande... regarde le fichier de conf d'exemple et test en ajoutant la ligne "sender" en exemple..
Hors ligne
#20 Le 30/12/2007, à 16:14
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
J'ai trouvé l'explication avec : man grep
Je suis vraiment pas de mauvaise fois :
utilisateur@machine:/$ zgrep -B1 sender /usr/share/doc/fail2ban/examples/jail.conf.gz
utilisateur@machine:/$
Le fichier existe mais ne contient pas ce que l'on recherche.
Qu'avez-vous dans le votre ?
Edition :
En fouillant sur Google, j'ai trouvé des informations :
[ssh-iptables]
enabled = true
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]
logpath = /var/log/messages
maxretry = 5
Mais dans la nouvelle version de fail2ban, il n'y a plus ça :
# ban & send an e-mail with whois report and relevant log lines
# to the destemail.
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s"]
mail-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s]
Il ne gère plus le sender, ou alors plus de cette manière.
Ma version :
Setting up fail2ban (0.7.6-3ubuntu1) ...
News sur le site :
2007/08/14 0.8.1 is now available and fixes some security issues in the default configuration files and includes new filters and actions. The "mail" actions are now deprecated and should be replaced with "sendmail" actions. fail2ban-regex now accepts "ignoreregex".
http://packages.ubuntu.com/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=fail2ban
J'ai une feisty. Je suis donc avec une version intermédiaire de fail2ban...
Merci,
ZiP
Dernière modification par zip80 (Le 30/12/2007, à 16:35)
Hors ligne
#21 Le 30/12/2007, à 17:28
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
J'ai donc installé la dernière version :
fail2ban_0.8.1-3_all.deb
J'ai reconfiguré mes fichiers en *.local, dans les /etc/fail2ban/action.d/*.local, il faut enlever le -en juste après le echo et tout fonctionne à merveille avec sendmail !
Encore merci pour ta patience et ton aide Uggy !
ZiP
Hors ligne
#22 Le 30/12/2007, à 20:32
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Je suis en Gutsy effectivement:
$ zgrep -B1 sender /usr/share/doc/fail2ban/examples/jail.conf.gz
action = iptables[name=SSH, port=ssh, protocol=tcp]
sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]
$
C'est bon je peux désinstaller fail2ban ?
Dernière modification par Uggy (Le 30/12/2007, à 20:33)
Hors ligne
#23 Le 30/12/2007, à 21:12
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
Oui!
Voilà le résultat :
Bonjour,
L'adresse 59.120.211.142 (59-120-211-142.HINET-IP.hinet.net) vient d'être bannie par Fail2Ban après 6 tentatives d'accès échouées sur ssh.
Ci-dessous les lignes qui contiennent l'adresse : 59.120.211.142 dans /var/log/auth.log :
Dec 30 17:01:58 machine sshd[24315]: Did not receive identification string from 59.120.211.142
Dec 30 17:25:30 machine sshd[25128]: Invalid user t1na from 59.120.211.142
Dec 30 17:25:33 machine sshd[25132]: Invalid user t1na from 59.120.211.142
Dec 30 17:25:35 machine sshd[25136]: Invalid user logic from 59.120.211.142
Dec 30 17:25:38 machine sshd[25140]: Invalid user diablo from 59.120.211.142
Dec 30 17:25:40 machine sshd[25152]: Invalid user b1ablo from 59.120.211.142
Dec 30 17:25:42 machine sshd[25156]: Invalid user paradise from 59.120.211.142
Dec 30 17:27:43 machine sshd[25161]: fatal: Timeout before authentication for 59.120.211.142
Dec 30 19:59:13 machine sshd[28086]: Invalid user alexis from 59.120.211.142
Dec 30 19:59:15 machine sshd[28090]: Invalid user art from 59.120.211.142
Dec 30 19:59:18 machine sshd[28094]: Invalid user desiree from 59.120.211.142
Dec 30 19:59:20 machine sshd[28098]: Invalid user abel from 59.120.211.142
Dec 30 19:59:23 machine sshd[28102]: Invalid user doris from 59.120.211.142
Dec 30 19:59:25 machine sshd[28106]: Invalid user damian from 59.120.211.142
Dec 30 20:01:23 machine sshd[28106]: fatal: Timeout before authentication for 59.120.211.142Voici plus d'informations concernant l'adresse 59.120.211.142 :
% [whois.apnic.net node-2]
% Whois data copyright terms http://www.apnic.net/db/dbcopyright.htmlinetnum: 59.112.0.0 - 59.123.255.255
netname: HINET-NET
country: TW
descr: CHTD, Chunghwa Telecom Co.,Ltd.
descr: Data-Bldg.6F, No.21, Sec.21, Hsin-Yi Rd.
descr: Taipei Taiwan 100
admin-c: HN27-AP
tech-c: HN28-AP
status: ALLOCATED PORTABLE
mnt-by: MAINT-TW-TWNIC
mnt-lower: MAINT-TW-TWNIC
changed: hm-changed@apnic.net 20040909
source: APNICperson: HINET Network-Adm
address: CHTD, Chunghwa Telecom Co., Ltd.
address: Data-Bldg. 6F, No. 21, Sec. 21, Hsin-Yi Rd.,
address: Taipei Taiwan 100
country: TW
phone: +886 2 2322 3495
phone: +886 2 2322 3442
phone: +886 2 2344 3007
fax-no: +886 2 2344 2513
fax-no: +886 2 2395 5671
e-mail: network-adm@hinet.net
nic-hdl: HN27-AP
remarks: same as TWNIC nic-handle HN184-TW
mnt-by: MAINT-TW-TWNIC
changed: hostmaster@twnic.net 20000721
source: APNICperson: HINET Network-Center
address: CHTD, Chunghwa Telecom Co., Ltd.
address: Data-Bldg. 6F, No. 21, Sec. 21, Hsin-Yi Rd.,
address: Taipei Taiwan 100
country: TW
phone: +886 2 2322 3495
phone: +886 2 2322 3442
phone: +886 2 2344 3007
fax-no: +886 2 2344 2513
fax-no: +886 2 2395 5671
e-mail: network-center@hinet.net
nic-hdl: HN28-AP
remarks: same as TWNIC nic-handle HN185-TW
mnt-by: MAINT-TW-TWNIC
changed: hostmaster@twnic.net 20000721
source: APNICinetnum: 59.120.211.128 - 59.120.211.143
netname: HAN-TONG-TP-TW
descr: Han Tong Co., Ltd.
descr: Taiepi City Taiwan
country: TW
admin-c: WZ291-TW
tech-c: WZ291-TW
mnt-by: MAINT-TW-TWNIC
remarks: This information has been partially mirrored by APNIC from
remarks: TWNIC. To obtain more specific information, please use the
remarks: TWNIC whois server at whois.twnic.net.
changed: fkchung@ms1.hinet.net 20050711
status: ASSIGNED NON-PORTABLE
source: TWNICperson: Long Zheng Cai
address: Han Tong Co., Ltd.
address: Taiepi City Taiwan
e-mail: hn88750873@hn.hinet.net
nic-hdl: WZ291-TW
changed: hostmaster@twnic.net.tw20050916
source: TWNICCordialement,
Fail2Ban
Merci,
ZiP
Hors ligne
#24 Le 30/12/2007, à 23:10
- Uggy
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
ok cool..
Pour info, si c'est l'acces SSH que tu veux sécuriser, il suffit de changer la conf sshd pour n'authoriser que les acces SSH par clé. (et plus par mot de passe) De cette manière aucune des tentatives de bruteForce ne pourra aboutir... donc plus besoin de les bannir...
Hors ligne
#25 Le 30/12/2007, à 23:21
- zip80
Re : [RESOLU] fail2ban : envoi d'un mail lors d'un ban ?
En fait, c'est déjà le cas pour SSH.
Je penssai qu'il était utile de bannir en plus.
ZiP
Hors ligne
Pages : 1