Is it possible to set fail2ban to direct banned ips to a webpage instead of breaking connection and getting the timed out errors?


In your jail file you specify the action that Fail2Ban performs when it "bans" a host. You can create an action file so it does something other than ban the ip address if you wish. For example you could add a redirection rule rather than dropping the traffic.

  • This is correct. But what is the benefit? If you want to block a SSH login attack, will you redirect to another SSH host? Or a HTTP site? Blocking should be done carefully so that innocent people are not affected. If they are affected you were too restrictive. – mailq Aug 7 '11 at 20:57
  • The user does not specify the how he is using fail2ban. There are scenarios in which it would be helpful to redirect banned users to a site explaining why they have been blocked. – dkwiebe Aug 7 '11 at 21:22
  • Sure. Was a little bit or rhetorical from me. This is why a gave this short and harsh answer to the question. – mailq Aug 7 '11 at 21:25

No. It is the intention of fail2ban to block the connection. Otherwise one had probably called it fail2redirect.

  • Yeah I guess I will have to live with being updated by email. I dont want it to ban innocent users and them not be aware they have even been banned. Most users would just presume there was a problem with the user, which looks bad. – John Magnolia Aug 7 '11 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.