## Version 2020/05/10 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/jail.local
# This is the custom version of the jail.conf for fail2ban
# Feel free to modify this and add additional filters
# Then you can drop the new filter conf files into the fail2ban-filters
# folder and restart the container
##==============================================================================================
## ##
## Sources utilisées pour personnaliser ce fichier et ceux dans les sous-dossiers ##
## https://www.linode.com/docs/guides/using-fail2ban-to-secure-your-server-a-tutorial/ ##
## ##
## https://www.linuxtricks.fr/wiki/print.php?id=40 ##
## ##
##==============================================================================================
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8 ::1 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
banaction = iptables-allports
# "bantime.increment" allows to use database for searching of previously banned ip's to increase a
# default ban time
bantime.increment = true
# "bantime.maxtime" is the max number of seconds using the ban time can reach (doesn't grow further)
bantime.maxtime = 5w
# "bantime.factor" is a coefficient to calculate exponent growing of the formula or common multiplier
bantime.factor = 24
# "bantime" is the number of seconds that a host is banned.
bantime = 600
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
# "maxretry" is the number of failures before a host get banned.
maxretry = 5
destemail = admin@mon-server.tld
dest = admin@mon-server.tld
sender = admin@mon-server.tld
sendername = Fail2Ban-Docker
action = gotifyEmbed
%(action_mwl)s
chain = FORWARD
actionstart_on_demand = false
backend = auto
allowipv6 = no
[nginx-http-auth]
enabled = true
filter = nginx-http-auth
port = http,https
logpath = /config/log/nginx/error.log
[nginx-badbots]
enabled = true
port = http,https
filter = nginx-badbots
logpath = /config/log/nginx/access.log
maxretry = 2
[nginx-botsearch]
enabled = true
port = http,https
filter = nginx-botsearch
logpath = /config/log/nginx/access.log
[nginx-deny]
enabled = false
port = http,https
filter = nginx-deny
logpath = /config/log/nginx/error.log
[nginx-unauthorized]
enabled = true
port = http,https
filter = nginx-unauthorized
logpath = /config/log/nginx/unauthorized.log
jail.d/gitea-auth.local
:## /volume1/docker/fail2ban/jail.d/gitea-auth.local
## See : https://docs.gitea.io/en-us/fail2ban-setup/
## Version 2022/08/06
# Fail2Ban jail configuration for emby
# Requires modification to Giteas settings
# https://docs.gitea.io/en-us/fail2ban-setup/
# Enabling, and depending on Giteas built in SSH server
# [server]
# [DISABLE_SSH = false
# [SSH_PORT = 22
# [SSH_LISTEN_PORT = 822
# [START_SSH_SERVER = true
# Enabling logs
# [log]
# ROOT_PATH = /data/gitea/log
# ENABLE_SSH_LOG = true
# LEVEL = Info
# MODE = file
[INCLUDES]
include = jail.d/jail-common.local
[gitea]
enabled = true
filter = gitea-auth
logpath = /log/gitea.log
maxretry = 3
banaction = iptables-allports
[gitea-docker]
enabled = true
filter = gitea-auth
logpath = /log/gitea.log
maxretry = 3
banaction = iptables-allports[chain="FORWARD"]
jail.d/common. Local
:[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8 ::1 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
# banaction = %(banaction_allports)s
banaction = iptables-allports
action = gotifyEmbed
%(action_mwl)s
chain = FORWARD
# "bantime.increment" allows to use database for searching of previously banned ip's to increase a
# default ban time
bantime.increment = true
# "bantime.maxtime" is the max number of seconds using the ban time can reach (doesn't grow further)
bantime.maxtime = 5w
# "bantime.factor" is a coefficient to calculate exponent growing of the formula or common multiplier
bantime.factor = 24
# "bantime" is the number of seconds that a host is banned.
bantime = 600
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
# "maxretry" is the number of failures before a host get banned.
maxretry = 5
destemail = admin@mon-serveur.tld
dest = admin@mon-serveur.tld
sender = admin@mon-serveur.tld
sendername = Fail2Ban-Docker
allowipv6 = no
Il y a la elle chose que dans celui du tuto d’ @EVOTk sur gotify (j’ai pas le lien là )Que contient le fichier$config_dir/action.d/gotifyEmbed.local
Il y a la elle chose que dans celui du tuto d’ @EVOTk sur gotify (j’ai pas le lien là )
iptables-allports.local
donc il faut le vérifier (je n'ai pas réussi à obtenir ce fichier...)iptables(8)
ou docker, je ne peux en dire plus mais une chose m'interpelle (que l'on rencontre aussi avec les jails BSD : ce sont des instances complètement indépendantes du système hôte donc une configuration globale et réseau propre à chacunes d'elles).iptables(8)
mais la passation inverse ne s'effectue pas (blocage de l'IP par iptables(8)
> conteneur docker).Voilà ce que contient ce fichier :Que contient le fichier$config_dir/action.d/gotifyEmbed.local
[Definition]
# Notify on Startup
actionstart = bash /data/Fail2Gotify.sh start <name>
# actionstart = curl -s -S --data '{"message": "'"%(MESSAGE_start)s %(__name__)s"'", "title": "'"%(TITLE)s"'", "priority":'"%(GOTIFY_PRIORITY_SUCCESS)i"', "extras": {"client::display": {"contentType": "text/markdown"}}}' -X POST -H Content-Type:application/json "%(URL)s"
# Notify on Shutdown
actionstop = bash /data/Fail2Gotify.sh stopped <name>
#
actioncheck =
# Notify on Banned
actionban = bash /data/Fail2Gotify.sh ban <name> <ip>
# Notify on Unbanned
actionunban = bash /data/Fail2Gotify.sh unban <name> <ip>
[Init]
# Name of the jail in your jail.local file. default = [your-jail-name]
name = default
Je vais regarder.N'utilisant pasiptables(8)
ou docker, je ne peux en dire plus mais une chose m'interpelle (que l'on rencontre aussi avec les jails BSD : ce sont des instances complètement indépendantes du système hôte donc une configuration globale et réseau propre à chacunes d'elles).
Ce commentaire sur https://github.com/crazy-max/docker-fail2ban/ m'a l'air d'être en lien avec ton problème où les IP externes sont bien transmises à docker pour les y inclure dans les règles d'iptables(8)
mais la passation inverse ne s'effectue pas (blocage de l'IP pariptables(8)
> conteneur docker).
Je vais regarder.
iptables(8)
. Fail2Ban faisant son job.Mais surtout, je vais faire un essai avec le Fail2ban intégré dans SWAG, peut-être que lui bloquera réellement les IP bannies... Mais je perds les notifications emails... faudra que je mette les fichiers pour gotify.