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

nftables formula #61

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

nftables formula #61

wants to merge 12 commits into from

Conversation

tacerus
Copy link
Member

@tacerus tacerus commented Sep 10, 2023

New formula for managing nftables. Work in progress.

@tacerus tacerus force-pushed the new/nftables branch 4 times, most recently from daaabc5 to 2959736 Compare September 10, 2023 17:49
First concept idea.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
- use Jinja instead of Mako template (additional Python logic is no longer needed)
- split into active and passive configurations for includes which shouldn't happen on the top-level
- add file header
- support sets

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
- Allows the same loops to be used both in the top-level as well as in lower contexts.
- Expand includes to their file path if they match a passive configuration.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
No longer used in favor of the Jinja one.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
- ct state established, related accept
sets:
mode: passive
sets:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there needs to be a layer for inet/ip/ip6 here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate, do you mean some abstraction which will generate sets for the different families? Currently I just build sets the same way as natively in nftables (see the macros file https://github.com/openSUSE/salt-formulas/pull/61/files/730c44859d4d76bb02a4c3b17dc371161695382f), which intends specifying the family as part of the set type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you decide if a set should go into

table ip6 nat {
}
table ip nat {
}

which is might be needed if you want to use sets in nat rules . those can not live in table inet ...

Copy link
Member Author

@tacerus tacerus Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That depends on where you include the file you define the set in. In the example pillar, a configuration file sets.conf is placed in /etc/nftables.conf.d/salt/passive/, which is then included in the nat table via line 34.

Edit: Maybe I should make it more clear that the key names underneath config are just example file names. The example has sets in a file called sets, but it could just as well be multiple files mysets1, mysets2, .. all containing sets, which can then be included in different tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants