ajout de {.ini}
This commit is contained in:
parent
106390b4c9
commit
caca0a61c2
|
@ -180,7 +180,7 @@ On pourra mettre à jour les paramètres d'une jail à chaud avec `set`. Ça év
|
|||
|
||||
On peut bien sûr ajouter ses propres _jails_ en ajoutant dans le fichier `jail.local`, un exemple :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[custom-1234]
|
||||
|
||||
enabled = true
|
||||
|
@ -214,7 +214,7 @@ On peut écrire ses propres règles de filtrage en s'appuyant sur [les expressio
|
|||
|
||||
Exemple d'une règle :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = warning: \[<HOST>\]: authentication failed:
|
||||
ignoreregex =
|
||||
|
@ -261,13 +261,13 @@ dummy.conf iptables-blocktype.conf iptables-new.conf
|
|||
|
||||
Si l'on ne précise pas d'action, l'action sera par défaut _iptables-multiport_ (définie dans `jail.conf`) :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
banaction = iptables-multiport
|
||||
~~~
|
||||
|
||||
Exemple pour bannir et déclencher l'envoi d'un email :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
action = iptables-multiport
|
||||
sendmail[dest=jdoe@example.com]
|
||||
~~~
|
||||
|
@ -281,7 +281,7 @@ Le but de cette règle est de bannir immédiatement si une connexion SSH a lieu
|
|||
|
||||
On ajoute la règle `filter.d/sshd-invaliduser.conf` :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
|
||||
|
@ -297,7 +297,7 @@ journalmatch = _SYSTEMD_UNIT=sshd.service + _COMM=sshd
|
|||
|
||||
> **Note** : Par fois la regex ne matche pas, on pourra mettre une regex moins rigide :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
failregex = (I|i)nvalid user \S+ from <HOST> .*$
|
||||
~~~
|
||||
|
||||
|
@ -318,7 +318,7 @@ backend = %(sshd_backend)s
|
|||
|
||||
On ajoute la règle `filter.d/evolix-dovecot.conf` :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed|Aborted login \(\d+ authentication attempts).*rip=(?P<host>\S*),.*
|
||||
ignoreregex =
|
||||
|
@ -375,7 +375,7 @@ Cela peut être des règles activées en permanence ou des règles spécifiques
|
|||
|
||||
Voici un exemple avec un filtre `/etc/fail2ban/filter.d/dos-http.conf` qui va contrôler l'ensemble des requêtes avec la méthode HTTP GET :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = <HOST> -.*"GET.*HTTP.*
|
||||
~~~
|
||||
|
@ -397,14 +397,14 @@ findtime = 300
|
|||
|
||||
/etc/fail2ban/filter.d/nginx-401.conf :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = <HOST> -.*"GET.*HTTP.* 401 .*
|
||||
~~~
|
||||
|
||||
Jail :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[nginx-401-allvhosts]
|
||||
enabled = true
|
||||
port = http,https
|
||||
|
@ -418,14 +418,14 @@ findtime = 3600
|
|||
|
||||
/etc/fail2ban/filter.d/nginx-403.conf :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = <HOST> -.*"GET.*HTTP.* 403 .*
|
||||
~~~
|
||||
|
||||
Jail :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[nginx-403-allvhosts]
|
||||
enabled = true
|
||||
port = http,https
|
||||
|
@ -443,7 +443,7 @@ L'option la plus simple pour utiliser Fail2Ban avec Wordpress consiste à détec
|
|||
|
||||
On ajoute un filtre dans `/etc/fail2ban/filter.d/apache-wp.conf` :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = <HOST> -.*"POST.*/wp-login.php HTTP.* 200
|
||||
<HOST> -.*"POST.*/xmlrpc.php.*
|
||||
|
@ -707,7 +707,7 @@ findtime = 300
|
|||
|
||||
/etc/fail2ban/filter.d/pm2-auth-failure.conf :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[Definition]
|
||||
failregex = .*Auth failure, WRONG_HASH for IP <HOST> .*
|
||||
[Init]
|
||||
|
@ -716,7 +716,7 @@ datepattern = ^%%Y-%%m-%%d %%H:%%M
|
|||
|
||||
Définition de la jail :
|
||||
|
||||
~~~
|
||||
~~~{.ini}
|
||||
[pm2-auth-failure]
|
||||
enabled = true
|
||||
port = http,https
|
||||
|
|
Loading…
Reference in a new issue