Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root:a17924e746f0:~]# cat /etc/fail2ban/action.d/404.conf
- # Fail2Ban action configuration file for Subzero/Core
- [Definition]
- actionstart =
- actionstop =
- actioncheck =
- actionban = /root/ban_modify.rb ban <ip>
- actionunban = /root/ban_modify.rb unban <ip>
- #!/usr/bin/env ruby
- command = ARGV[0]
- ip_address = ARGV[1]
- blacklist = File.open("/root/blacklist.txt").read.split("n")
- if command == "unban"
- if blacklist.include? "#{ip_address} deny"
- blacklist.delete "#{ip_address} deny"
- end
- elsif command == "ban"
- blacklist << "#{ip_address} deny"
- end
- File.open("/root/blacklist.txt", "w") {|f| f.write(blacklist.join("n"))}
- 2019-08-19 20:56:43,508 fail2ban.utils [16176]: Level 39 7ff7395873f0 -- exec: ban_modify.rb ban <myip>
- 2019-08-19 20:56:43,509 fail2ban.utils [16176]: ERROR 7ff7395873f0 -- stderr: '/bin/sh: 1: ban_modify.rb: not found'
- 2019-08-19 20:56:43,509 fail2ban.utils [16176]: ERROR 7ff7395873f0 -- returned 127
- 2019-08-19 20:56:43,509 fail2ban.utils [16176]: INFO HINT on 127: "Command not found". Make sure that all commands in 'ban_modify.rb ban <myip>' are in the PATH of fail2ban-server process (grep -a PATH= /proc/`pidof -x fail2ban-server`/environ). You may want to start "fail2ban-server -f" separately, initiate it with "fail2ban-client reload" in another shell session and observe if additional informative error messages appear in the terminals.
- 2019-08-19 20:56:43,509 fail2ban.actions [16176]: ERROR Failed to execute ban jail '404' action '404' info 'ActionInfo({'ip': '<myip>', 'family': 'inet4', 'ip-rev': '<myip>.', 'ip-host': '<myip>', 'fid': '<myip>', 'failures': 1, 'time': 1566266203.3465006, 'matches': '', 'restored': 0, 'F-*': {'matches': [], 'failures': 1}, 'ipmatches': '', 'ipjailmatches': '', 'ipfailures': 1, 'ipjailfailures': 1})': Error banning <myip>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement