Add firewall configuration reset option #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One (hopefully, for the time being) last PR for this playbook: Since
ansible.posix.firewalld
provides no way to reset network or service lists to empty, the playbook fatally ends up only ever adding permissions, not revoking them. E.g. just removing a serivce name from the whitelist for some zone and re-running the playbook will not block access to that service (the playbook has no way to set a value for the entire list, it can only add or remove entries viaansible.posix.firewalld
).To remedy this, a new playbook variable
firewall_reset_configuration
has been added, that, when set totrue
(the default is, of course,false
) causes the playbook to runfirewall-cmd --reset-to-defaults
viaansible.builtin.command
before applying its own changes.As use of this option is potentially dangerous, a stern warning regarding it has been added to the README.
Apart from a possibe future implementation for Debian-based systems (which is not on the cards right now), this playbook should now hopefully be feature-complete.