Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just installed fail2ban and the apf firewall. Those 2 seems to be not working together. Fail2ban have added some ipatble rules but they are not working. When I issue "/etc/init.d/iptables status" it says "bash: /etc/init.d/iptables: No such file or directory..."

How can I make it work with apf? I have Ubuntu 11.04 in a VPS!

share|improve this question
    
sudo iptables -vnL instead of your status command. –  jippie Apr 25 '12 at 9:14
    
@jippie That command works but fail2ban is not! –  EApubs Apr 25 '12 at 9:37
add comment

1 Answer

up vote 3 down vote accepted

By default fail2ban is configured to work with iptables; this generates a configuration conflict with APF because fail2ban adds a chain to iptables and when you reload APF it wipes that fail2ban chain each time.

Fortunately you can configure fail2ban to have many different actions, this allows it to be able to work with iptables, shorewall, etc.

To make APF and fail2ban work together we just need to add an apf action to fail2ban: I created the /etc/fail2ban/action.d/apf.conf based on the shorewall.conf and we just need to edit actionban and actionunban to this:

actionban = apf --deny <ip>
actionunban = apf --remove <ip>

Then we have to configure fail2ban to use apf by editing the /etc/fail2ban/jail.conf file.

The line we are looking for is:

banaction = apf
share|improve this answer
add comment

Your Answer

 
discard

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.