Skip to content
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

Flush rules for INPUT chain only (for compatibility with docker) #106

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vitabaks
Copy link

@vitabaks vitabaks commented Jul 19, 2023

This pull request refactors the firewall playbook to introduce the ability to flush only the INPUT chains, while leaving other chains (such as DOCKER chains) untouched. This change is made to ensure compatibility with Docker configurations.

The following changes have been made:

  1. Added new variables:
  • firewall_flush_rules_input_nat: Indicates whether to flush the INPUT chain in the 'nat' table.
  • firewall_flush_rules_input_mangle: Indicates whether to flush the INPUT chain in the 'mangle' table.
  • firewall_flush_rules_input_filter: Indicates whether to flush the INPUT chain in the 'filter' table.
  1. Updated the playbook logic:
  • The flush rules for the INPUT chain are now conditioned based on the new variables mentioned above.
  • This change allows selective flushing of the INPUT chains, leaving other chains untouched.

These changes ensure compatibility with Docker configurations and provide more flexibility in managing firewall rules.

Do not clear all chains (if 'firewall_flush_rules_and_chains' is 'false') to leave DOCKER chains without changes.
Instead, the ability to clear only INPUT chains has been added, as well as the ability to specify which tables to clean (nat, mangle, filter).

New variables:
- firewall_flush_rules_input_nat
- firewall_flush_rules_input_mangle
- firewall_flush_rules_input_filter
This task is not necessary because when the firewall service starts, the filter table will be cleared (iptables -F or iptables -t filter -F INPUT).
Copy link

This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@github-actions github-actions bot added the stale label Nov 19, 2023
@etoosamoe
Copy link

This works pretty well! 👍

@kare
Copy link

kare commented Dec 13, 2023

This PR should fix issues #80 and #82.

@kare
Copy link

kare commented Dec 13, 2023

@etoosamoe Do you think this PR is ready for a merge?

@etoosamoe
Copy link

@etoosamoe Do you think this PR is ready for a merge?

Definitely. It does exactly what it supposed to do - add controls if we want to flush some another chains.

Copy link

This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@github-actions github-actions bot added the stale label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants