saltstack-formulas / ufw-formula

Manages your firewall using ufw with pillar configured rules
Apache License 2.0
7 stars 37 forks source link

feat(state): Allow deny rules to not be forced to the top #27

Open pjbakker opened 3 years ago

pjbakker commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Currently every deny rule is forced to be at the top (with insert 1) There are use cases (like the new example in README) where you allow all traffic from a private interface, but want to explicitly deny access to a port (save for 1 IP).

on the cmdline you would first allow the IP access to the service, then deny the service. In the current state, the deny is forced as first line and thus negates the order in the pillar.

This feature introduces the 'force_first' that when set to False and used with 'deny', does not use deny insert 1 but deny.

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context