Skip to content

Port ipset to BSD pf tables #144

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

Closed
wants to merge 4 commits into from
Closed

Conversation

madroach
Copy link

On OpenBSD packet filter tables provide similar functionality to linux netfilter ipset. The second commit adds support for them.

Since the pf is manipulated by ioctl() on /dev/pf, /dev/pf needs to be opened before privileges are dropped. The first commit renames the modules's init functions to setup and allows modules to implement an init funtion which is run once before privileges are dropped. One unwanted side effect of this change is that now on reload by -HUP signal the ordering of the modules mustn't change.

This is not yet well tested, but feedback on whether the general approach is acceptable is highly welcome.

@wcawijngaards
Copy link
Member

Hi, so your code looks nice. The issue is not the ipset addition, but that I need to talk about the general approach. It modifies the contract API of the modules, so I think it is best if I talk with my colleagues about it. And figure out what it is that we want from it, what you have done could be that (and it looks fine & a lot of work too).
From my initial look, the script API could be impacted to change too; otherwise I am not sure; maybe just extending the API with a priv setup routine or maybe the change to modify the existing init to setup routines in the pull request now. Trying to pick the best architectural solution for module support.

@madroach
Copy link
Author

Ping ?
Have had time to consider how to go forward with privileged setup?

@madroach
Copy link
Author

madroach commented Feb 3, 2021

ping? I just merged again.

@salekseev
Copy link

This functionality would be incredibly useful as a lot of BSD systems that are used as routers/firewalls use Unbound as its primary DNS resolver, for example OPNsense and pfSense. Thanks.

@Jakker
Copy link
Contributor

Jakker commented Jul 1, 2024

FreeBSD provides the ipset functionality by setfib.

@salekseev
Copy link

salekseev commented Jul 1, 2024

FreeBSD provides the ipset functionality by setfib.

Maybe I should have described the use case: making firewall decisions based on domain names (A and AAAA responses) by populating (pf tables or ipset) with resolved IPs.

I can’t figure out how setfib could be of use here.

@wcawijngaards wcawijngaards mentioned this pull request Jul 2, 2024
@wcawijngaards
Copy link
Member

There is a modified version of this patch in #1098 . I tried to remove some of the changes to other parts of the code, but it is nice to keep the startup capability for modules to get privileged items.

wcawijngaards added a commit that referenced this pull request Jul 3, 2024
- Fix #144: Port ipset to BSD pf tables.
@wcawijngaards
Copy link
Member

Thank you for the patch! The modified version has been merged and it is in the code repository.

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.

4 participants