[Sécurité] fail2ban
bob031
Messages postés
8228
Statut
Membre
-
bob031 Messages postés 8228 Statut Membre -
bob031 Messages postés 8228 Statut Membre -
Bonjour,
j'ai une question d'ordre général sur fail2ban :
il y a 2 ou 3 jours j'ai installé fail2ban sur mes distributions Linux (à savoir debian, fedora, gentoo et mandriva). pas de problème apparent pour l'installer et le configurer.
Une question me tarabusque néanmoins : sachant que fail2ban est composée d'une partie serveur et d'une partie client.
Au démarrage de la machine :
redfox@localhost ~ $ ps -ef | grep fail2ban
root 4726 1 0 14:43 ? 00:00:02 /usr/bin/python /usr/bin/fail2ban-server -b -s /tmp/fail2ban.sock
redfox 5137 5067 0 15:08 pts/0 00:00:00 grep --colour=auto fail2ban
redfox@localhost ~ $
c'est fail2ban-server qui est lancé !
or, d'après mes lectures des différents liens (post<30>) et notament le tuto avec la debian, il faudrait lancer fail2ban-client.
..et si je lance :
redfox@localhost ~ $ fail2ban-client start
2008-01-28 14:57:20,313 fail2ban.server : INFO Starting Fail2ban
ERROR Could not start server. Maybe an old socket file is still present. Try to remove /tmp/fail2ban.sock. If you used fail2ban-client to start the server, adding the -x option will do it
redfox@localhost ~ $
normal, me direz-vous ? et là n'est pas la question.
alors je comprend pas bien, c'est server ou client que je dois lancer ????
:-))
--
Un Linux, c'est bien ...........plein de Linux, c'est mieux !
Debian Etch // Fedora 8 // Gentoo 2007-rc3 // Mandriva 2007.1 Spring...
j'ai une question d'ordre général sur fail2ban :
il y a 2 ou 3 jours j'ai installé fail2ban sur mes distributions Linux (à savoir debian, fedora, gentoo et mandriva). pas de problème apparent pour l'installer et le configurer.
Une question me tarabusque néanmoins : sachant que fail2ban est composée d'une partie serveur et d'une partie client.
Au démarrage de la machine :
redfox@localhost ~ $ ps -ef | grep fail2ban
root 4726 1 0 14:43 ? 00:00:02 /usr/bin/python /usr/bin/fail2ban-server -b -s /tmp/fail2ban.sock
redfox 5137 5067 0 15:08 pts/0 00:00:00 grep --colour=auto fail2ban
redfox@localhost ~ $
c'est fail2ban-server qui est lancé !
or, d'après mes lectures des différents liens (post<30>) et notament le tuto avec la debian, il faudrait lancer fail2ban-client.
..et si je lance :
redfox@localhost ~ $ fail2ban-client start
2008-01-28 14:57:20,313 fail2ban.server : INFO Starting Fail2ban
ERROR Could not start server. Maybe an old socket file is still present. Try to remove /tmp/fail2ban.sock. If you used fail2ban-client to start the server, adding the -x option will do it
redfox@localhost ~ $
normal, me direz-vous ? et là n'est pas la question.
alors je comprend pas bien, c'est server ou client que je dois lancer ????
:-))
--
Un Linux, c'est bien ...........plein de Linux, c'est mieux !
Debian Etch // Fedora 8 // Gentoo 2007-rc3 // Mandriva 2007.1 Spring...
Configuration: Linux Firefox 3.0
12 réponses
-
En temps normal, c'est le serveur qui protège la machine.
Le client n'est utile que pour contacter l'état du serveur, débloquer manuellement une IP, etc.
Autrement dit: En utilisation quotidienne, on ne lance jamais le client. -
Salut sebsauvage,
Arffff ! j'ai mal interprété un "passage" ...
Merci.
:-))
-
De rien :-)
-
bonjour,
mon "problème" :
je ne comprenais pas pourquoi je ne recevais pas les notifications par mail sur la Mandriva !
autre élément à prendre en compte, j'utilise Postfix sur la Mandriva.
la solution :Copiez /etc/fail2ban/action.d/mail-whois.conf vers /etc/fail2ban/action.d/mail-whois.local, modifiez ce fichier et remplacez mail par sendmail.
source : http://www.fail2ban.org/...
je n'ai pas eu besoin de modifier le fichier mail-whois.local !
[root@mandriva ~]# rpm -qa | grep sendmail [root@mandriva ~]# /etc/init.d/fail2ban restart Arrêt de fail2ban : [ÉCHEC ] Lancement de fail2ban : 2008-04-13 20:38:53,868 fail2ban.server : INFO Starting Fail2ban ERROR Could not start server. Maybe an old socket file is still present. Try to remove /tmp/fail2ban.sock. If you used fail2ban-client to start the server, adding the -x option will do it [ÉCHEC ] [root@mandriva ~]# [root@mandriva ~]# rm /tmp/fail2ban.sock rm: détruire socket `/tmp/fail2ban.sock'? y [root@mandriva ~]# /etc/init.d/fail2ban status fail2ban-server est arrêté [root@mandriva ~]# /etc/init.d/fail2ban start Lancement de fail2ban : 2008-04-13 20:40:13,762 fail2ban.server : INFO Starting Fail2ban [ OK ] [root@mandriva ~]#
[redfox@mandriva ~]$ mail Heirloom mailx version 12.2 01/07/07. Type ? for help. "/var/spool/mail/redfox": 2 messages >O 1 root@localhost.loc Sun Apr 13 20:40 25/707 [Fail2Ban] SSH: started O 2 root@localhost.loc Sun Apr 13 20:40 25/715 [Fail2Ban] Postfix: start ? ? ? At EOF ? At EOF ? q Held 2 messages in /var/spool/mail/redfox [redfox@mandriva ~]$
-
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
j'ai des soucis avec fail2ban. voir :
http://www.commentcamarche.net/forum/affich 6374535 mandriva sshd ne demarre plus au boot
j'ai donc réinstallé fail2ban
urpme fail2ban
urpmi fail2ban
je n'ai plus de messages d'erreur suivants :
2008-05-13 13:38:27,671 fail2ban.actions.action: ERROR rm -f <tmpfile> returned 200
2008-05-13 13:38:32,464 fail2ban.actions.action: ERROR echo -en "Hi,\n
2008-05-13 13:38:32,651 fail2ban.actions.action: ERROR touch <tmpfile> returned 200
2008-05-13 13:38:32,662 fail2ban.actions.action: ERROR echo -en "Hi,\n
2008-05-13 13:46:27,156 fail2ban.actions.action: ERROR rm -f <tmpfile> returned 200
2008-05-13 13:46:27,167 fail2ban.actions.action: ERROR echo -en "Hi,\n
2008-05-13 13:46:28,331 fail2ban.actions.action: ERROR echo -en "Hi,\n
2008-05-13 13:46:32,640 fail2ban.actions.action: ERROR touch <tmpfile> returned 200
2008-05-13 16:32:04,085 fail2ban.actions.action: ERROR rm -f <tmpfile> returned 200
2008-05-13 16:32:09,837 fail2ban.actions.action: ERROR touch <tmpfile> returned 200
2008-05-13 16:58:44,397 fail2ban.actions.action: ERROR rm -f <tmpfile> returned 200
reste à voir pourquoi mon attaquant n'a as été banni ??????
May 11 21:04:24 mandriva sshd[7212]: Invalid user admin from 88.33.202.155
May 11 21:04:36 mandriva sshd[7216]: Invalid user stud from 88.33.202.155
May 11 21:04:42 mandriva sshd[7218]: Invalid user trash from 88.33.202.155
May 11 21:04:52 mandriva sshd[7220]: Invalid user aaron from 88.33.202.155
May 11 21:04:58 mandriva sshd[7222]: Invalid user gt05 from 88.33.202.155
May 11 21:05:04 mandriva sshd[7224]: Invalid user william from 88.33.202.155
May 11 21:05:11 mandriva sshd[7226]: Invalid user stephanie from 88.33.202.155
May 11 21:05:49 mandriva sshd[7238]: Invalid user gary from 88.33.202.155
May 11 21:06:02 mandriva sshd[7243]: Invalid user guest from 88.33.202.155
May 11 21:06:08 mandriva sshd[7245]: Invalid user test from 88.33.202.155
May 11 21:06:14 mandriva sshd[7247]: Invalid user oracle from 88.33.202.155
May 11 21:09:01 mandriva sshd[7398]: Invalid user lab from 88.33.202.155
May 11 21:09:14 mandriva sshd[7413]: Invalid user oracle from 88.33.202.155
May 11 21:09:20 mandriva sshd[7415]: Invalid user svn from 88.33.202.155
May 11 21:09:26 mandriva sshd[7418]: Invalid user iraf from 88.33.202.155
May 11 21:09:33 mandriva sshd[7420]: Invalid user swsoft from 88.33.202.155
May 11 21:09:39 mandriva sshd[7422]: Invalid user production from 88.33.202.155
May 11 21:09:45 mandriva sshd[7424]: Invalid user guest from 88.33.202.155
May 11 21:09:51 mandriva sshd[7426]: Invalid user gast from 88.33.202.155
May 11 21:09:58 mandriva sshd[7428]: Invalid user gast from 88.33.202.155
May 11 21:10:04 mandriva sshd[7430]: Invalid user oliver from 88.33.202.155
May 11 21:10:10 mandriva sshd[7432]: Invalid user sirsi from 88.33.202.155
May 11 21:10:16 mandriva sshd[7434]: Invalid user nagios from 88.33.202.155
May 11 21:10:26 mandriva sshd[7436]: Invalid user nagios from 88.33.202.155
May 11 21:10:32 mandriva sshd[7438]: Invalid user nagios from 88.33.202.155
May 11 21:10:38 mandriva sshd[7440]: Invalid user nagios from 88.33.202.155
May 11 21:10:45 mandriva sshd[7443]: Invalid user backuppc from 88.33.202.155
May 11 21:10:51 mandriva sshd[7445]: Invalid user wolfgang from 88.33.202.155
May 11 21:10:57 mandriva sshd[7448]: Invalid user vmware from 88.33.202.155
May 11 21:11:03 mandriva sshd[7450]: Invalid user stats from 88.33.202.155
May 11 21:11:10 mandriva sshd[7452]: Invalid user kor from 88.33.202.155
-
un fichier intéressant (dans Mandriva) est le fichier /var/log/btmp. Il contient une trace de toutes les connections échouées.
on peut bien sûr taper la commande suivante :
cat /var/log/btmp
......mais le fichier n'est pas très lisible.
on peut taper alors la commande suivante :[root@mandriva log]# lastb kor ssh:notty host155-202-stat Sun May 11 21:11 - 21:11 (00:00) stats ssh:notty host155-202-stat Sun May 11 21:11 - 21:11 (00:00) vmware ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) wolfgang ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) backuppc ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) nagios ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) nagios ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) nagios ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) nagios ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) sirsi ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) oliver ssh:notty host155-202-stat Sun May 11 21:10 - 21:10 (00:00) gast ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) gast ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) guest ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) producti ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) swsoft ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) iraf ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) svn ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) oracle ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) lab ssh:notty host155-202-stat Sun May 11 21:09 - 21:09 (00:00) oracle ssh:notty host155-202-stat Sun May 11 21:06 - 21:06 (00:00) test ssh:notty host155-202-stat Sun May 11 21:06 - 21:06 (00:00) guest ssh:notty host155-202-stat Sun May 11 21:06 - 21:06 (00:00) gary ssh:notty host155-202-stat Sun May 11 21:05 - 21:05 (00:00) stephani ssh:notty host155-202-stat Sun May 11 21:05 - 21:05 (00:00) william ssh:notty host155-202-stat Sun May 11 21:05 - 21:05 (00:00) gt05 ssh:notty host155-202-stat Sun May 11 21:04 - 21:04 (00:00) aaron ssh:notty host155-202-stat Sun May 11 21:04 - 21:04 (00:00) trash ssh:notty host155-202-stat Sun May 11 21:04 - 21:04 (00:00) stud ssh:notty host155-202-stat Sun May 11 21:04 - 21:04 (00:00) admin ssh:notty host155-202-stat Sun May 11 21:04 - 21:04 (00:00) btmp begins Sun May 11 21:04:24 2008 [root@mandriva log]# lastb
...ce qui est quand même beaucoup mieux ! -
Sinon, il y a "denyhost", que je trouve plus simple a installer, paramétrer et utiliser.
-
ha oui ! "denyhost" que je retrouve souvent sur les forums !
fail2ban marche bien et n'est pas compliqué à paramétrer et à utiliser !
le truc c'est que sur la mandriva, c'est parfois plus laborieux que pour sur autres distributions. -
Ah.. parce qu'au vu des posts ça me paraissait laborieux, fail2ban
ça c'est parce que je ne suis pas très doué ! :-)
en fait, disons que je veux à tout prix que tout soit correctement configuré (alerte mails, etc .....), sinon l'installation basique est enfantine et se fait en 5 mns .....même sur la mandriva :-)
-
Quand je veux voir qui m'a attaqué je fais "tail /var/mail/mon_login" ce qui est, je te l'accorde, du paramétrage à la hache.
idem ! je regarde dans /var/log/mail/mail .....mais on peut trouver des traces dans d'autres fichiers.
le seul hic encore c'est que mon gars ne s'est pas fait bannir sur la mandriva ! ....et je voudrai bien savoir pourquoi ....
:-)) -
bonjour,
des soucis avec fail2ban sur ma debian !
debian:/var/log# /etc/init.d/fail2ban status Status of authentication failure monitor:fail2ban is running. debian:/var/log#
de plus la règle fail2ban n'apparaît pas lors de la commande iptables -L -nv
à suivre ... -
doc à re-lire :
Blocking a DNS DDOS using the fail2ban package
Posted by vlm on Sat 31 Jan 2009 at 14:20
http://web.archive.org/web/*/https://debian-administration.org/article/623/Blocking_a_DNS_DDOS_using_the_fail2ban_package