Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # CC-BY-SA 2015 Malte Jan Kaffenberger <malte@maltejk.de>
- set -e
- rc=0
- load_rules()
- {
- echo 'restarting fail2ban.'
- service fail2ban restart
- }
- save_rules()
- {
- echo 'nothing to do from here.'
- }
- flush_rules()
- {
- echo 'restarting fail2ban.'
- service fail2ban restart
- }
- case "$1" in
- start|restart|reload|force-reload)
- load_rules
- ;;
- save)
- save_rules
- ;;
- stop)
- # Why? because if stop is used, the firewall gets flushed for a variable
- # amount of time during package upgrades, leaving the machine vulnerable
- # It's also not always desirable to flush during purge
- echo "Automatic flushing disabled, use \"flush\" instead of \"stop\""
- ;;
- flush)
- flush_rules
- ;;
- *)
- echo "Usage: $0 {start|restart|reload|force-reload|save|flush}" >&2
- exit 1
- ;;
- esac
- exit $rc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement