Bug 1370682 - Fail2Ban can't ban IPs when FirewallD is running in Fedora 24
Summary: Fail2Ban can't ban IPs when FirewallD is running in Fedora 24
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: firewalld
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Rashid Khan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-27 00:51 UTC by Benjamin Xiao
Modified: 2017-08-08 16:51 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 16:51:00 UTC
Type: Bug


Attachments (Terms of Use)
Output of journalctl -f when restarting Fail2Ban (3.89 KB, text/plain)
2016-08-27 00:51 UTC, Benjamin Xiao
no flags Details

Description Benjamin Xiao 2016-08-27 00:51:01 UTC
Created attachment 1194562 [details]
Output of journalctl -f when restarting Fail2Ban

Description of problem:
Fail2Ban tries to set firewall rules to ban IP addresses, but FirewallD fails with ERROR: COMMAND_FAILED

Version-Release number of selected component (if applicable):
firewalld-0.4.3.3-1.fc24
fail2ban 0.9.3-3.fc24

How reproducible:
Every time

Steps to Reproduce:
1. Install owncloud
2. Configure fail2ban to block owncloud invalid logins
3. Purposely fail login until IP is banned.
4. Verify that IP is banned with "fail2ban-client status <owncloud_jail>"
5. Verify that site is still accessible because IP hasn't been blocked by firewalld

Actual results:
Banned IPs aren't blocked by Firewalld

Expected results:
Banned IPs can no longer connect

Additional info:

Comment 1 Benjamin Xiao 2016-08-27 00:52:35 UTC
Easier way to reproduce would probably be to purposely ban an ip using "fail2ban-client set <jail> banip <ip>"

Comment 2 dan 2016-08-27 16:15:36 UTC
Could this be related?  I am investigating similar behavior and decided to disable both firewalld and fail2ban services, then reboot and first enable firewalld.  I see that iptables commands are failing at startup.  The commands seem to be from direct.xml which correspond to the jail.local configured bans.


ug 27 12:00:49 zzz.private systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 27 12:00:50 zzz.private systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 27 12:00:50 zzz.private audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=firewalld comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Aug 27 12:00:52 zzz.private /firewalld[2664]: WARNING: '/usr/sbin/iptables -w -I INPUT_direct 1 -p tcp -m multiport --dports ssh -m set --match-set fail2ban-sshd src -j REJECT --reject-with icmp-port-unreachable' failed:
Aug 27 12:00:52 zzz.private /firewalld[2664]: WARNING: '/usr/sbin/iptables -w -I INPUT_direct 2 -p tcp -m multiport --dports ftp,ftp-data,ftps,ftps-data -m set --match-set fail2ban-vsftpd src -j REJECT --reject-with icmp-port-unreachable' failed:
Aug 27 12:00:52 zzz.private /firewalld[2664]: WARNING: '/usr/sbin/iptables -w -I INPUT_direct 3 -p tcp -m multiport --dports imaps,pop3s -m set --match-set fail2ban-dovecot src -j REJECT --reject-with icmp-port-unreachable' failed:
Aug 27 12:00:52 zzz.private /firewalld[2664]: WARNING: '/usr/sbin/iptables -w -I INPUT_direct 4 -p tcp -m multiport --dports 25,465 -m set --match-set fail2ban-sendmail src -j REJECT --reject-with icmp-port-unreachable' failed:

~                                                                               
~                                                                               
7 substitutions on 7 lines

Comment 3 dan 2016-08-27 16:27:31 UTC
I was able to eliminate the errors above and to get a clean start on firewalld (and on fail2ban) by stopping both services and then removing the fail2ban related rules from direct.xml.  It seems that they must have been put there at some point when I used the firewalld GUI to make a runtime configuration permanent.

Comment 4 Benjamin Xiao 2016-08-28 23:03:28 UTC
Brilliant! That worked! Thanks so much!

Comment 5 dan 2016-08-29 01:29:39 UTC
Don't understand why closed...I presented a workaround but this issue will reoccur whenever someone is running fail2ban and chooses to make a runtime fw config permanent.

I suggest that a better way to address is to have firewalld ignore any fail2ban added direct rules when making a runtime config permanent.

Comments?

Comment 6 Benjamin Xiao 2016-08-29 02:10:35 UTC
Sorry, I thought it was just a config issue on my end, but yes I think if this problem will reoccur then it should be fixed.

Comment 7 Fedora End Of Life 2017-07-25 22:41:12 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2017-08-08 16:51:00 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.