Skip to content

Instantly share code, notes, and snippets.

@wujku
Forked from acundari/traefik-auth.conf
Created March 6, 2021 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wujku/89897fa009552bbc87e62b5590ea859d to your computer and use it in GitHub Desktop.
Save wujku/89897fa009552bbc87e62b5590ea859d to your computer and use it in GitHub Desktop.
Traefik fail2ban
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
# /etc/fail2ban/filter.d/traefik-botsearch.conf
[INCLUDES]
before = botsearch-common.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) \/<block> \S+\" 404 .+$
# /etc/fail2ban/jail.d/traefik.conf
[traefik-auth]
enabled = true
logpath = %(traefik_access_log)s
port = http,https
[traefik-botsearch]
enabled = true
logpath = %(traefik_access_log)s
maxretry = 1
port = http,https
[traefik-badbots]
enabled = true
filter = apache-badbots
logpath = %(traefik_access_log)s
maxretry = 1
port = http,https
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment