Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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