initial import
This commit is contained in:
42
fail2ban/fail2ban.initd
Normal file
42
fail2ban/fail2ban.initd
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2016 Fail2Ban
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
extra_started_commands="reload showlog"
|
||||
|
||||
FAIL2BAN="/usr/bin/fail2ban-client ${FAIL2BAN_OPTIONS}"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
need logger
|
||||
after nftables
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting fail2ban"
|
||||
mkdir -p /var/run/fail2ban || return 1
|
||||
# remove stalled sock file after system crash
|
||||
# bug 347477
|
||||
rm -f /var/run/fail2ban/fail2ban.sock || return 1
|
||||
start-stop-daemon --start --pidfile /var/run/fail2ban/fail2ban.pid \
|
||||
-- ${FAIL2BAN} start
|
||||
eend $? "Failed to start fail2ban"
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping fail2ban"
|
||||
start-stop-daemon --stop --pidfile /var/run/fail2ban/fail2ban.pid \
|
||||
-- ${FAIL2BAN} stop
|
||||
eend $? "Failed to stop fail2ban"
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading fail2ban"
|
||||
${FAIL2BAN} reload
|
||||
eend $? "Failed to reload fail2ban"
|
||||
}
|
||||
|
||||
showlog(){
|
||||
less /var/log/fail2ban.log
|
||||
}
|
||||
Reference in New Issue
Block a user