-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fail2ban vs firewall #22
Comments
Hello @TJM, please take a look at firewallchain. I can not provide a specific code snippet, but it should be possible to prevent the firewall module from purging existing fail2ban rules. Kind regards, |
OK, I was hoping I just missed it in the code (the github search facility is a bit janky sometimes). We had started messing with that, but ended up having to turn purge off (which is not where I want to be). I was hoping you had solved it. |
You can address this by setting up a separate firewallchain, having firewall jump to that chain at the very beginning of INPUT and back to INPUT at the end of that chain, and then instructing Fail2ban to put all of its jump rules in that new chain. |
The solution I am aware of is to use the Something like this should work when using Fail2ban with the firewallchain { 'INPUT:filter:IPv4':
ignore => '-j f2b-sshd',
}
firewallchain { 'f2b-sshd:filter:IPv4':
ignore => '-A f2b-sshd',
} There is a known issue where setting resources { 'firewall':
purge => true,
} overrides the Firewallchain <| |> {
purge => true,
} This has the same general effect but still allows for the use of More information about the |
To make this more flexible, we started by pulling the list of jails from hiera and looping through it: # Ignore fail2ban chains:
$chains = hiera('firewall::purge_ignore', [])
$input_ignore = $chains.map |$chain| { "-j ${chain}" }
#ensure input rules are cleaned out, but ignore fail2ban
firewallchain { 'INPUT:filter:IPv4':
ensure => present,
ignore => $input_ignore,
purge => true,
}
$chains.each |$chain| {
firewallchain { "${chain}:filter:IPv4":
ignore => "-A ${chain}",
}
} I am now looking for a way to populate the |
Can you pull the information from a variable in the fail2ban module? That has been a favorite of mine to pull out "port" or whatever from the target module for things like SSH. I have not actually messed with fail2ban in a while tho. |
Hi,
We have a few servers that have fail2ban pre-installed (thanks Rackspace), and have had issues with puppetlabs-firewall removing the rules that fail2ban creates. Do you have any examples of a working setup with a puppet "managed" firewall and fail2ban coexisting properly?
Thanks,
Tommy
The text was updated successfully, but these errors were encountered: