OVH Community, votre nouvel espace communautaire.

fail2ban


spykeer
18/02/2012, 23h52
Je conseilles aussi Squeeze, je suis aussi utilisateur de cette distro sur mes dédiés!

Un gros +1 Vive debian!

Nowwhat
18/02/2012, 23h43
Euhhh,

"Debian Lenny" sera bientôt 'hors sécurité' car plus maintenu.
Sache que "Squeeze" existe.
a) C'est gratuit.
b) C'est du bon.
c) Il y à un prix à payer: savoir lire les tutos qui explique comment appliquer la mise à jour.
d) Simple, quoi.

Connaître ta version de fail2ban:
# apt-show-versions | grep 'fail2ban'
fail2ban/squeeze uptodate 0.8.4-3

Puis: déinstaller un 'petit truc' comme fail2ban:
Sauvegarde son config qui se trouve dans /etc/fail2ban
Enlève le ..
Réinstalle-le (non, apt-get installl xxxx ne plante pas comme ça - t'as un Debian, rapelle toi - un OS qui ne date pas d'hier)

patmax
18/02/2012, 19h28
Bonsoir,
Merci pour ta réponse, mais je préfère pas désinstaller fail2ban, car si après je ne sais plus l'installer j'ai plus de sécurité.
Quand je vois les attaques que beaucoup ont, je préfère pas prendre de risque.

il n'y a pas d'autres solutions que désinstaller ?

Merci quand même

Edit, j'ai vu un patch "action_executeCmd_locking.diff " mais je ne sais pas comment m'y prendre ?

spykeer
18/02/2012, 17h56
Alors, tentes de le desinstaller par :

apt-get remove --purge fail2ban

ensuite, une install par apt-get install fail2ban

Si marches pas, re-desinstalles par apt-get et tentes un aptitude install fail2ban.

Si toujours pas, ramenes-nous ce que te dis ta debian

patmax
18/02/2012, 11h25
Bonjour,
J'ai lu que avec la dernière version de fail2ban le problème d'erreur est corrigé.
Le problème c'est que je n'arrive pas a mettre fail2ban a jour.
J'ai fais :
apt-get update
apt-get install fail2ban
Et il me dis que c'est déjà la dernière version qui est faut car j'ai la version Fail2ban v0.8.3.
Peut être quelque chose a changé dans sources.list

deb http://ftp.fr.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.fr.debian.org/debian/ lenny main contrib non-free

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
Merci beaucoup pour votre aide.

patmax
13/02/2012, 13h46
Bonjour,
Merci pour ton aide, voici le fichier jail.conf.

[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1
bantime = 6000
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 = admin@domaine

#
# 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

# email action. Since 0.8.1 upstream fail2ban uses sendmail
# MTA for the mailing. Change mta configuration parameter to mail
# if you want to revert to conventional 'mail'.
mta = sendmail

# Default protocol
protocol = tcp

#
# 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", protocol="%(protocol)s]

# ban & send an e-mail with whois report to the destemail.
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s]
%(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)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", protocol="%(protocol)s]
%(mta)s-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. 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
filter = sshd
logpath = /var/log/auth.log
bantime = 600000
maxretry = 3

# Generic filter for pam. Has to be used with action which bans all ports
# such as iptables-allports, shorewall
[pam-generic]

enabled = false
# pam-generic filter can be customized to monitor specific subset of 'tty's
filter = pam-generic
# port actually must be irrelevant but lets leave it all for some possible uses
port = all
banaction = iptables-allports
port = anyport
logpath = /var/log/auth.log
maxretry = 6

[xinetd-fail]

enabled = false
filter = xinetd-fail
port = all
banaction = iptables-multiport-log
logpath = /var/log/daemon.log
maxretry = 2


[ssh-ddos]

enabled = true
port = ssh
filter = sshd-ddos
logpath = /var/log/auth.log
maxretry = 3

#
# HTTP servers
#

[apache]

enabled = true
port = http,https
filter = apache-auth
logpath = /var/log/apache2/error.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 = true
port = http,https
filter = apache-auth
logpath = /var/log/apache2/error.log
maxretry = 6

[apache-noscript]

enabled = false
port = http,https
filter = apache-noscript
logpath = /var/log/apache2/error.log
maxretry = 3

[apache-overflows]

enabled = true
filter = apache-overflows
action = iptables[name=Overflows, port=http, protocol=tcp]
mail-whois[name=Overflows, dest=root@domaine]
logpath = /var/log/apache2/error.log
findtime = 3600
bantime = 86400
maxretry = 1

#
# 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 = 3


[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 = true
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


# DNS Servers


# These jails block attacks against named (bind9). By default, logging is off
# with bind9 installation. You will need something like this:
#
# logging {
# channel security_file {
# file "/var/log/named/security.log" versions 3 size 30m;
# severity dynamic;
# print-time yes;
# };
# category security {
# security_file;
# };
# }
#
# in your named.conf to provide proper logging

# Word of Caution:
# Given filter can lead to DoS attack against your DNS server
# since there is no way to assure that UDP packets come from the
# real source IP
[named-refused-udp]

enabled = true
port = domain,953
protocol = udp
filter = named-refused
logpath = /var/log/named/security.log

[named-refused-tcp]

enabled = true
port = domain,953
protocol = tcp
filter = named-refused
logpath = /var/log/named/security.log

[apache-iptables]

enabled = true
filter = apache-noscript
action = iptables[name=apache, port=80, protocol=tcp]
logpath = /var/log/apache2/error.log
bantime = 6000
maxretry = 3

[shrunk-window]

enabled = true
filter = shrunk-window
logpath = /var/log/kern.log
port = all
banaction = iptables-allports
port = anyport
bantime = 600
maxretry = 3

# AJOUT flood-dns pour attaques flood DNS
[flood-dns]

enabled = true
filter = flood-dns
action = iptables[name=flooddns, port=53, protocol=udp]
logpath = /var/log/syslog
bantime = 6000
maxretry = 3

[apache-404]

enabled = true
filter = apache-404
port = all
banaction = iptables-allports
port = anyport
logpath = /var/log/apache2/error.log
bantime = 600
maxretry = 20

[apache-badbots]

enabled = true
port = http,https
filter = apache-badbots
logpath = /var/log/apache2/access.log
bantime = 86400
maxretry = 3
Fichier apache-404.conf

[Definition]

# Option: failregex
# Notes.: regex to match the 404 failure messages in the logfile. The
# host must be matched by a group named "host". The tag "" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}?(?P[\w\-.^_]+)
# Values: TEXT
#
failregex = ˆ - - .* 404 .* "-" .*

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Fichier apache-noscript.conf

[Definition]

# Option: failregex
# Notes.: regex to match the password failure messages in the logfile. The
# host must be matched by a group named "host". The tag "" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}?(?P\S+)
# Values: TEXT
#
failregex = [[]client []] (File does not exist|script not found or unable to stat): /\S*(\.php|\.asp|\.exe|\.pl)
[[]client []] script '/\S*(\.php|\.asp|\.exe|\.pl)\S*' not found or unable to stat *$
[[]client []] File does not exist: .*(/var/www)

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Fichier shrunk-window.conf

[Definition]
failregex = TCP\: Peer \:.* unexpectedly shrunk window.*repaired+
ignoreregex =
Je vien de voir que j'ai pas de fichier dans filter.d pour [apache], [apache-multiport] et [apache-iptables], c'est peut être la raison des erreurs ?

Merci

Magda
13/02/2012, 11h40
Tu peux poster ta conf de fail2ban stp

spykeer
11/02/2012, 20h30
J'ai vu une erreur similaire quand tu avais des règles fail2ban sur le même port.

Sa concernait les ports apache (80,443), Si sa peut t'aider! =)

patmax
11/02/2012, 18h02
Bonsoir,
Personne peut m'aider sur les erreurs et le pour quoi je ne sais pas mettre fail2ban a jour ?.

Merci

patmax
10/02/2012, 22h40
Bonsoir,
Désoler pour la réponse tardive, rien n'a changé toujours des erreurs dans le log fail2ban et impossible je le mettre a jour.
Avec la commande # dpkg --list fail2ban

Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/H=à garder/besoin Réinstallation/X=les deux (État,Err: majuscule=mauvais)
||/ Nom Version Description
+++-=============================-=============================-================================================== ========================
ii fail2ban 0.8.3-2sid1 bans IPs that cause multiple authentication errors
Le fichier log fail2ban

2012-02-10 22:18:48,690 fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q fail2ban-named-refused-udp returned 100
2012-02-10 22:18:48,691 fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
2012-02-10 22:18:48,695 fail2ban.actions.action: ERROR iptables -D INPUT -p udp -m multiport --dports domain,953 -j fail2ban-named-refused-udp
iptables -F fail2ban-named-refused-udp
iptables -X fail2ban-named-refused-udp returned 100
2012-02-10 22:18:48,702 fail2ban.actions.action: ERROR iptables -D fail2ban-named-refused-udp -s 82.232.54.222 -j DROP returned 100
2012-02-10 22:18:49,320 fail2ban.jail : INFO Jail 'named-refused-udp' stopped
2012-02-10 22:18:50,026 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports smtp,ssmtp -j fail2ban-postfix
iptables -F fail2ban-postfix
iptables -X fail2ban-postfix returned 100
2012-02-10 22:18:50,318 fail2ban.jail : INFO Jail 'postfix' stopped
2012-02-10 22:18:51,012 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports ssh -j fail2ban-ssh-ddos
iptables -F fail2ban-ssh-ddos
iptables -X fail2ban-ssh-ddos returned 100
2012-02-10 22:18:51,013 fail2ban.jail : INFO Jail 'ssh-ddos' stopped
2012-02-10 22:18:51,044 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports http,https -j fail2ban-apache-multiport
iptables -F fail2ban-apache-multiport
iptables -X fail2ban-apache-multiport returned 100
2012-02-10 22:18:51,880 fail2ban.jail : INFO Jail 'apache-multiport' stopped
2012-02-10 22:18:52,009 fail2ban.actions: WARNING [apache-overflows] Unban 94.23.198.112
2012-02-10 22:18:52,012 fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q fail2ban-Overflows returned 100
2012-02-10 22:18:52,012 fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
2012-02-10 22:18:52,015 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp --dport http -j fail2ban-Overflows
iptables -F fail2ban-Overflows
iptables -X fail2ban-Overflows returned 100
2012-02-10 22:18:52,022 fail2ban.actions.action: ERROR iptables -D fail2ban-Overflows -s 94.23.198.112 -j DROP returned 100
2012-02-10 22:18:52,370 fail2ban.jail : INFO Jail 'apache-overflows' stopped
2012-02-10 22:18:52,877 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports ssh -j fail2ban-ssh
iptables -F fail2ban-ssh
iptables -X fail2ban-ssh returned 100
2012-02-10 22:18:52,993 fail2ban.jail : INFO Jail 'ssh' stopped
2012-02-10 22:18:53,392 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp --dport http -j fail2ban-HTTP
iptables -F fail2ban-HTTP
iptables -X fail2ban-HTTP returned 100
2012-02-10 22:18:53,457 fail2ban.jail : INFO Jail 'apache-404' stopped
2012-02-10 22:18:54,407 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports http,https -j fail2ban-apache
iptables -F fail2ban-apache
iptables -X fail2ban-apache returned 100
2012-02-10 22:18:54,407 fail2ban.jail : INFO Jail 'apache' stopped
2012-02-10 22:18:54,869 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -j fail2ban-shrunk-window
iptables -F fail2ban-shrunk-window
iptables -X fail2ban-shrunk-window returned 100
2012-02-10 22:18:55,012 fail2ban.jail : INFO Jail 'shrunk-window' stopped
2012-02-10 22:18:55,872 fail2ban.actions.action: ERROR iptables -D INPUT -p udp --dport 53 -j fail2ban-flooddns
iptables -F fail2ban-flooddns
iptables -X fail2ban-flooddns returned 100
2012-02-10 22:18:55,873 fail2ban.jail : INFO Jail 'flood-dns' stopped
2012-02-10 22:18:56,029 fail2ban.actions: WARNING [apache-iptables] Unban 188.165.215.31
2012-02-10 22:18:56,032 fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q fail2ban-apache returned 100
2012-02-10 22:18:56,032 fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
2012-02-10 22:18:56,035 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp --dport 80 -j fail2ban-apache
iptables -F fail2ban-apache
iptables -X fail2ban-apache returned 100
2012-02-10 22:18:56,042 fail2ban.actions.action: ERROR iptables -D fail2ban-apache -s 188.165.215.31 -j DROP returned 100
2012-02-10 22:18:56,045 fail2ban.jail : INFO Jail 'apache-iptables' stopped
2012-02-10 22:18:56,871 fail2ban.actions: WARNING [named-refused-tcp] Unban 82.232.54.222
2012-02-10 22:18:56,874 fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q fail2ban-named-refused-tcp returned 100
2012-02-10 22:18:56,874 fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
2012-02-10 22:18:56,877 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp -m multiport --dports domain,953 -j fail2ban-named-refused-tcp
iptables -F fail2ban-named-refused-tcp
iptables -X fail2ban-named-refused-tcp returned 100
2012-02-10 22:18:56,884 fail2ban.actions.action: ERROR iptables -D fail2ban-named-refused-tcp -s 82.232.54.222 -j DROP returned 100
2012-02-10 22:18:56,887 fail2ban.jail : INFO Jail 'named-refused-tcp' stopped
2012-02-10 22:19:06,599 fail2ban.server : INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.8.3
2012-02-10 22:19:06,599 fail2ban.jail : INFO Creating new jail 'named-refused-udp'
2012-02-10 22:19:06,599 fail2ban.jail : INFO Jail 'named-refused-udp' uses poller
2012-02-10 22:19:06,608 fail2ban.filter : INFO Added logfile = /var/log/named/security.log
2012-02-10 22:19:06,608 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,610 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,610 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,615 fail2ban.jail : INFO Creating new jail 'apache-404'
2012-02-10 22:19:06,615 fail2ban.jail : INFO Jail 'apache-404' uses poller
2012-02-10 22:19:06,616 fail2ban.filter : INFO Added logfile = /var/log/apache2/error.log
2012-02-10 22:19:06,617 fail2ban.filter : INFO Set maxRetry = 20
2012-02-10 22:19:06,619 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,619 fail2ban.actions: INFO Set banTime = 600
2012-02-10 22:19:06,626 fail2ban.jail : INFO Creating new jail 'ssh-ddos'
2012-02-10 22:19:06,626 fail2ban.jail : INFO Jail 'ssh-ddos' uses poller
2012-02-10 22:19:06,627 fail2ban.filter : INFO Added logfile = /var/log/auth.log
2012-02-10 22:19:06,627 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,629 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,629 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,633 fail2ban.jail : INFO Creating new jail 'apache-multiport'
2012-02-10 22:19:06,633 fail2ban.jail : INFO Jail 'apache-multiport' uses poller
2012-02-10 22:19:06,633 fail2ban.filter : INFO Added logfile = /var/log/apache2/error.log
2012-02-10 22:19:06,634 fail2ban.filter : INFO Set maxRetry = 6
2012-02-10 22:19:06,635 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,635 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,642 fail2ban.jail : INFO Creating new jail 'apache-overflows'
2012-02-10 22:19:06,643 fail2ban.jail : INFO Jail 'apache-overflows' uses poller
2012-02-10 22:19:06,643 fail2ban.filter : INFO Added logfile = /var/log/apache2/error.log
2012-02-10 22:19:06,643 fail2ban.filter : INFO Set maxRetry = 1
2012-02-10 22:19:06,645 fail2ban.filter : INFO Set findtime = 3600
2012-02-10 22:19:06,645 fail2ban.actions: INFO Set banTime = 86400
2012-02-10 22:19:06,649 fail2ban.jail : INFO Creating new jail 'ssh'
2012-02-10 22:19:06,649 fail2ban.jail : INFO Jail 'ssh' uses poller
2012-02-10 22:19:06,650 fail2ban.filter : INFO Added logfile = /var/log/auth.log
2012-02-10 22:19:06,650 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,652 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,652 fail2ban.actions: INFO Set banTime = 600000
2012-02-10 22:19:06,705 fail2ban.jail : INFO Creating new jail 'postfix'
2012-02-10 22:19:06,705 fail2ban.jail : INFO Jail 'postfix' uses poller
2012-02-10 22:19:06,706 fail2ban.filter : INFO Added logfile = /var/log/mail.log
2012-02-10 22:19:06,706 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,707 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,708 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,711 fail2ban.jail : INFO Creating new jail 'apache'
2012-02-10 22:19:06,711 fail2ban.jail : INFO Jail 'apache' uses poller
2012-02-10 22:19:06,712 fail2ban.filter : INFO Added logfile = /var/log/apache2/error.log
2012-02-10 22:19:06,712 fail2ban.filter : INFO Set maxRetry = 6
2012-02-10 22:19:06,714 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,714 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,718 fail2ban.jail : INFO Creating new jail 'shrunk-window'
2012-02-10 22:19:06,718 fail2ban.jail : INFO Jail 'shrunk-window' uses poller
2012-02-10 22:19:06,719 fail2ban.filter : INFO Added logfile = /var/log/kern.log
2012-02-10 22:19:06,719 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,720 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,721 fail2ban.actions: INFO Set banTime = 600
2012-02-10 22:19:06,725 fail2ban.jail : INFO Creating new jail 'flood-dns'
2012-02-10 22:19:06,725 fail2ban.jail : INFO Jail 'flood-dns' uses poller
2012-02-10 22:19:06,725 fail2ban.filter : INFO Added logfile = /var/log/syslog
2012-02-10 22:19:06,726 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,727 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,727 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,731 fail2ban.jail : INFO Creating new jail 'apache-iptables'
2012-02-10 22:19:06,731 fail2ban.jail : INFO Jail 'apache-iptables' uses poller
2012-02-10 22:19:06,732 fail2ban.filter : INFO Added logfile = /var/log/apache2/error.log
2012-02-10 22:19:06,732 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,733 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,734 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,740 fail2ban.jail : INFO Creating new jail 'named-refused-tcp'
2012-02-10 22:19:06,740 fail2ban.jail : INFO Jail 'named-refused-tcp' uses poller
2012-02-10 22:19:06,741 fail2ban.filter : INFO Added logfile = /var/log/named/security.log
2012-02-10 22:19:06,741 fail2ban.filter : INFO Set maxRetry = 3
2012-02-10 22:19:06,743 fail2ban.filter : INFO Set findtime = 600
2012-02-10 22:19:06,743 fail2ban.actions: INFO Set banTime = 6000
2012-02-10 22:19:06,747 fail2ban.jail : INFO Jail 'named-refused-udp' started
2012-02-10 22:19:06,758 fail2ban.jail : INFO Jail 'apache-404' started
2012-02-10 22:19:06,767 fail2ban.jail : INFO Jail 'ssh-ddos' started
2012-02-10 22:19:06,776 fail2ban.jail : INFO Jail 'apache-multiport' started
2012-02-10 22:19:06,785 fail2ban.jail : INFO Jail 'apache-overflows' started
2012-02-10 22:19:06,787 fail2ban.jail : INFO Jail 'ssh' started
2012-02-10 22:19:06,796 fail2ban.jail : INFO Jail 'postfix' started
2012-02-10 22:19:07,265 fail2ban.jail : INFO Jail 'apache' started
2012-02-10 22:19:07,271 fail2ban.jail : INFO Jail 'shrunk-window' started
2012-02-10 22:19:07,276 fail2ban.jail : INFO Jail 'flood-dns' started
2012-02-10 22:19:07,279 fail2ban.jail : INFO Jail 'apache-iptables' started
2012-02-10 22:19:07,285 fail2ban.jail : INFO Jail 'named-refused-tcp' started
Une idée ?

D'avance merci

Magda
09/02/2012, 17h24
tu fous ca dans un fichier texte que tu rends exécutables
#!/bin/bash

IPT=/sbin/iptables

$IPT -F
$IPT -X
$IPT -t nat -F
$IPT -t nat -X

$IPT -P INPUT ACCEPT
$IPT -P OUTPUT ACCEPT
$IPT -P FORWARD ACCEPT

patmax
09/02/2012, 17h11
Citation Envoyé par Magda
Sauvegarde dans un coin ton firewall, flush tout et relance fail2ban
Je lance cette commande iptables -f ?

Magda
09/02/2012, 16h59
Sauvegarde dans un coin ton firewall, flush tout et relance fail2ban

patmax
09/02/2012, 16h48
Nowwhat Tu as une solution ?

Merci

Nowwhat
09/02/2012, 16h43
Citation Envoyé par patmax
pas très bon ca ?
Non, pas top.
Vraiment mieux (car plus lisible- on y voit ce j'ai vu sans autre décodage):
Code:
#dpkg --list fail2ban
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  fail2ban       0.8.4-3        bans IPs that cause multiple authentication
#

patmax
09/02/2012, 16h40
voila.

Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/H=à garder/besoin Réinstallation/X=les deux (État,Err: majuscule=mauvais)
||/ Nom Version Description
+++-=============================-=============================-================================================== ========================
ii fail2ban 0.8.3-2sid1 bans IPs that cause multiple authentication errors
pas très bon ca ?

Magda
09/02/2012, 16h35
normal... jme suis planté... c'est
dpkg --list fail2ban


ca renvoit un truc du genre :
dpkg --list fail2ban ==============================================
ii fail2ban 0.8.4-3

patmax
09/02/2012, 16h31
Voila

dpkg*: erreur de traitement de fail2ban (--install)*:
ne peut pas accéder à l'archive: Aucun fichier ou répertoire de ce type
Des erreurs ont été rencontrées pendant l'exécution*:
fail2ban
Merci pour ton aide

Magda
09/02/2012, 16h12
ben alors c'est que tu as la dernière
qu'est ce que te renvoit : dpkg -i fail2ban

patmax
09/02/2012, 16h03
Pour le depot, sarge, bonne question je ne sais pas une erreur de ma part surement, je vais le supprimer alors.
Quand je fais apt-get install fail2ban, il me dis que j'ai déjà la dernière version.
J'ai aucune erreur.

Merci de ta réponse

Magda
09/02/2012, 15h39
Il ne se met pas à jour?? Sans les messages d'erreurs ça ne nous aidera pas.

Il ne faut pas de depôt spécifique pour fail2ban.

Rien avoir mais pourquoi t'as encore un depot sarge???

patmax
09/02/2012, 15h30
Avec la commande apt-get update et apt-get upgrade fail2ban se met pas ajour.
Pour fail12ban il faut mettre quoi dans "sources.list"
Actuellement j'ai.

deb ftp://mirror.ovh.net/debian/ lenny main contrib non-free
deb-src ftp://mirror.ovh.net/debian/ lenny main contrib non-free

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

deb http://debian.home-dn.net/sarge postfix-vda/
deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
Merci

Magda
09/02/2012, 14h33
si une squeez stable la dernière version est la 0.8.4-3.
Pour mettre à jour, toujours sous debian uip update + upgrade.

Pour ma part je n'ai pas rencontré ces problèmes de doublons, mais bon j'ai seulement deux serveurs...

patmax
09/02/2012, 14h20
Bonjour,
Et merci beaucoup pour ton explication claire, donc en 2 mots c'est normal cela me rassure.
2 petites questions, la dernière version de fail2ban c'est la quelle ?
Mon fail2ban est la version v0.8.3.
Si j'ai pas la dernière version, comment la mettre a jour ? juste avec apt-get update et apt-get upgrade.

D'avance merci

Cybersonic
09/02/2012, 02h12
Sur certaines versions de Fail2ban et sur distrib Gentoo par exemple, quelques fois le restart ou même le stop puis start te fait un doublement des règles

Très fréquent de voir des règles en double mais qui n'ont pas le même compteur d'octet lors du listage et quand Fail2ban redémarre et rencontre des règles qu'il est censé ne pas retrouver ou déjà présente, bien il se mêle un peu les pinceau sur la création, de même que sur l'action Delete d'une IP qui arrive à l'expiration d'une règle fail2ban

La toute dernière version est censée corrigé certains points justement avec Iptables, mais me concernant j'ai toujours constaté les mêmes problèmes, cela sur 2 distributions, Gentoo R2 et Ubuntu

Et je dirais même, si il vous arrive de fréquemment devoir faire une prise en compte d'une règle ou un stop&start de fail2ban, il arrive que certaines des règles ne démarre pas (enfin démarre bien, mais ne s'inscrive pas à la liste d'Iptables) souvent quand le nombre des règles fail2ban est supérieur à 5

Par contre, la ou les anciennes versions arrivait des fois à bouffé quelques % d'usage CPU lors du start et même pendant l'usage d'une action, bien c'est corriger avec l'avant dernière version qui date de fin 2011

Concernant les erreurs indiquées, j'ai déja aussi noté quelques fois les erreurs la, mais sa n'empêche pas la règle de fonctionner convenablement et de retiré le Drop après le délai réglé dans la règle fail2ban-X

patmax
08/02/2012, 23h03
Bonsoir,
Merci pour ton aide, quand je fais iptables -L , j'ai bien la chaine fail2ban-http

Chain fail2ban-HTTP (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

Freemaster
08/02/2012, 22h07
si tu fais iptables -L
la chaine fail2ban-HTTP existe-t-elle ?

si c'est non après un /etc/init.d/fail2ban restart apparait-elle ?

patmax
08/02/2012, 21h50
Bonsoir,
Je viens encore chercher une petite aide que je ne trouve pas la raison sur google.
Peut être un membre du forum peut m'aider à trouver d'ou viens les erreurs que j'ai dans le log fail2ban.

2012-02-08 16:44:57,844 fail2ban.actions.action: ERROR iptables -N fail2ban-HTTP
iptables -A fail2ban-HTTP -j RETURN
iptables -I INPUT -p tcp --dport http -j fail2ban-HTTP returned 200
2012-02-08 17:50:47,992 fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q fail2ban-HTTP returned 100
2012-02-08 17:50:47,993 fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
2012-02-08 17:50:47,996 fail2ban.actions.action: ERROR iptables -D INPUT -p tcp --dport http -j fail2ban-HTTP
iptables -F fail2ban-HTTP
iptables -X fail2ban-HTTP returned 100
D'avance merci