Fail2ban работал, но я пошел проверить свой сервер на пентест, и по какой-то причине тюрьмы Apache2 не работают. Я проверил IPTables с помощью iptables -S, и есть 9 записей для -A input -p tcp -m multiport --dports 22 -j f2b-default
, хотя у меня есть порты, указанные как http и https в jails.conf
Я попытался снова зайти в jails.conf и изменить http, https на 80 443, и произошло то же самое. Я понятия не имею, почему fail2ban добавляет записи iptables для порта 22 во все типы тюрем, но я ничего не делаю, чтобы исправить это.
I ' m на debian 9, если это важно для всех, кто пытается мне помочь.
РЕДАКТИРОВАТЬ: файл конфигурации
[INCLUDES]
before = paths-debian.conf
[DEFAULT]
ignoreip = 127.0.0.1/8
ignorecommand =
bantime = 600
findtime = 600
maxretry = 5
backend = auto
usedns = warn
logencoding = auto
#enabled = true
filter = %(__name__)s
destemail = root@localhost
sender = fail2ban@localhost
mta = sendmail
protocol = tcp
chain = INPUT
port = 0:65535
fail2ban_agent = Fail2Ban/%(fail2ban_version)s
banaction = iptables-multiport
banaction_allports = iptables-allports
action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
action_mw = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
%(mta)s-whois[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]
action_mwl = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
%(mta)s-whois-lines[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
action_xarf = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath=%(logpath)s, port="%(port)s"]
action_cf_mwl = cloudflare[cfuser="%(cfemail)s", cftoken="%(cfapikey)s"]
%(mta)s-whois-lines[name=%(__name__)s, sender="%(sender)s", dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
action_blocklist_de = blocklist_de[email="%(sender)s", service=%(filter)s, apikey="%(blocklist_de_apikey)s", agent="%(fail2ban_agent)s"]
action_badips = badips.py[category="%(__name__)s", banaction="%(banaction)s", agent="%(fail2ban_agent)s"]
action_badips_report = badips[category="%(__name__)s", agent="%(fail2ban_agent)s"]
action = %(action_)s
[sshd]
enabled = true
port = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
action = iptables-multiport
cloudflare
[sshd-ddos]
# This jail corresponds to the standard configuration in Fail2ban.
# The mail-whois action send a notification e-mail with a whois request
# in the body.
port = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
action = iptables-multiport
cloudflare
[apache-auth]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
action = iptables-multiport
cloudflare
[apache-badbots]
enabled = true
port = 80,443
logpath = %(apache_access_log)s
bantime = 172800
maxretry = 1
action = iptables-multiport
cloudflare
[apache-noscript]
port = http,https
logpath = %(apache_error_log)s
action = iptables-multiport
cloudflare
[apache-overflows]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
maxretry = 2
action = iptables-multiport
cloudflare
[apache-nohome]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
maxretry = 2
action = iptables-multiport
cloudflare
[apache-botsearch]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
maxretry = 2
action = iptables-multiport
cloudflare
[apache-fakegooglebot]
enabled = true
port = 80,443
logpath = %(apache_access_log)s
maxretry = 1
ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot <ip>
action = iptables-multiport
cloudflare
[apache-modsecurity]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
maxretry = 2
action = iptables-multiport
cloudflare
[apache-shellshock]
enabled = true
port = 80,443
logpath = %(apache_error_log)s
maxretry = 1
action = iptables-multiport
cloudflare
Порт 22 предназначен для SSH. Для Fail2ban нормально запрещать повторные попытки подключения к этому порту. В этой картине нет ничего плохого; он работает правильно.