fail2ban/0.10.2
2023-03-16 10:04:56 +01:00
..
action.d Use helpers-common.conf from repository 'deb http://ncomputers.org/debian stretch main'. 2018-11-24 02:20:11 +01:00
filter.d adjust wordpress filter.. 2023-03-16 10:04:56 +01:00
ip64tables Initial commit 2017-11-27 04:23:54 +01:00
jail.local chanfe default for roundcube-auth filter to 'disable'. 2019-08-23 17:03:01 +02:00
README.apt-install README.apt-install: correct dokumentaion. 2018-04-15 18:13:16 +02:00
README.logrotate Update README.logrotate v. 0.10.2 2023-02-23 02:44:06 +01:00
README.src-install Update documentation. 2017-11-28 04:31:05 +01:00
README.sytemd Update documentation. 2017-11-28 04:31:05 +01:00

# - Configure  fail2ban as systemd service
# -

cat << EOF > /etc/systemd/system/fail2ban.service
[Unit]
Description=Fail2Ban Service
Documentation=man:fail2ban(1)
After=network.target iptables.service firewalld.service ip6tables.service ipset.service ipt-firewall.service ip6t-firewall.service
PartOf=iptables.service firewalld.service ip6tables.service ipset.service ipt-firewall.service ip6t-firewall.service

[Service]
Type=simple
ExecStartPre=/bin/mkdir -p /var/run/fail2ban
ExecStart=/usr/local/bin/fail2ban-server -xf start
# if should be logged in systemd journal, use following line or set logtarget to sysout in fail2ban.local
# ExecStart=/usr/local/bin/fail2ban-server -xf --logtarget=sysout start
ExecStop=/usr/local/bin/fail2ban-client stop
ExecReload=/usr/local/bin/fail2ban-client reload
PIDFile=/var/run/fail2ban/fail2ban.pid
Restart=on-failure
RestartPreventExitStatus=0 255

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable fail2ban.service

# - An alternative systemd configuration
# -
cat << EOF > /etc/systemd/system/fail2ban.service
[Unit]
Description=Fail2Ban Service
Documentation=man:fail2ban(1)
After=network.target iptables.service firewalld.service ipt-firewall.service ip6t-firewall.service
PartOf=iptables.service firewalld.service ipt-firewall.service ip6t-firewall.service

[Service]
Type=forking
ExecStart=/usr/bin/fail2ban-client -x start
ExecStop=/usr/bin/fail2ban-client stop
ExecReload=/usr/bin/fail2ban-client reload
PIDFile=/var/run/fail2ban/fail2ban.pid
Restart=always

[Install]
WantedBy=multi-user.target
EOF