Skip to content

Instantly share code, notes, and snippets.

@karlwilbur
Last active May 25, 2019 21:46
Show Gist options
  • Save karlwilbur/3b18ccc99561c40fc5d10501b1a7cd4c to your computer and use it in GitHub Desktop.
Save karlwilbur/3b18ccc99561c40fc5d10501b1a7cd4c to your computer and use it in GitHub Desktop.
Fail2Ban: Custom configuration files
# Fail2Ban configuration file
# /etc/fail2ban/filter.d/apache-404-php.conf
#
# Author: Karl Wilbur
#
# Description:
# filter for blocking IPs that generate 'File does not exist'
# entries in Apache's error log, from attempts to access non-existent
# PHP files.
#
[INCLUDES]
before = apache-common.conf
[Definition]
failregex = [[]client (?P<host>S*)[]] File does not exist: .*.php
ignoreregex =
# Fail2Ban configuration file
# /etc/fail2ban/filter.d/apache-client-denied.conf
#
# Author: Karl Wilbur
#
# Description:
# filter for blocking IPs that are explicitly denied by APache
# host configuation yet are still attempting to access pages.
#
[INCLUDES]
before = apache-common.conf
[Definition]
failregex = [[]client <HOST>[]] client denied by server configuration:
ignoreregex =
# Fail2Ban configuration file
#
# Author: Yaroslav Halchenko
#
# $Revision$
#
[Definition]
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
# host must be matched by a group named "host". The tag "<HOST>" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = sshd(?:\[\d+\])?: Did not receive identification string from <HOST>$
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
@karlwilbur
Copy link
Author

I added sshd-ddos.conf here because it was missing on one of my server installations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment