OPNsense Forum

English Forums => 25.7, 25.10 Series => Topic started by: narubby_star on October 04, 2025, 01:54:38 PM

Title: Current limitations of Dnsmasq > Firewall Alias (IPset) design in OPNsense
Post by: narubby_star on October 04, 2025, 01:54:38 PM
First of all thanks a lot for taking this feature (https://docs.opnsense.org/manual/dnsmasq.html#firewall-alias-ipset) directly into OPNsense user interface!

The general limitation I am seeing with current design in

Services > Dnsmasq DNS & DHCP > Domains 

is, that IPSet/"Firewall alias" is artificially bound to forwarded DNS servers/"IP address". In Dnsmasq IPsets are just tied to domain names.
Here is an example:


screenshot.png

creates following config in /usr/local/etc/dnsmasq.conf:

server=/*/127.0.0.1#5335
rebind-domain-ok=/*/
server=/example.org/127.0.0.1#5335
ipset=/example.org/dns_resolved_ips
rebind-domain-ok=/example.org/
server=/example.org/1.1.1.1
ipset=/example.org/dns_resolved_ips
rebind-domain-ok=/example.org/
server=/example.org/1.1.1.1
ipset=/example.org/my_orga_unit
rebind-domain-ok=/example.org/


Suggestion
What about ditching "Firewall alias" in "Domains" and creating an additional tab "IPSet", which takes a domain (optional autocomplete from values in "Domains" tab) and a firewall alias name? This change would solve above issues and comes closer to the config model Dnsmasq has.

If you managed to read till here: Let know what you think!
Title: Re: Current limitations of Dnsmasq > Firewall Alias (IPset) design in OPNsense
Post by: Monviech (Cedrik) on October 04, 2025, 02:19:11 PM
The way it works right now is intentional, since it guides the user implicitly that domains that are entered must be resolvable by dnsmasq. This is because most users also run unbound.

Allowing a wildcard (#) to flush all resolved domains into an alias seems like its unecessary. The use case is clearly stated in the documentation, for allowlists regarding things like *.example.com or the like. It is just an extension of the other Alias types that exist for hostnames, not a solution for full alias management.

Work can be repetitive in most GUIs, a larger set can be imported via the API for example.

If you want full control, you can import a custom dnsmasq configuration file.
Title: Re: Current limitations of Dnsmasq > Firewall Alias (IPset) design in OPNsense
Post by: narubby_star on October 04, 2025, 03:21:50 PM
Quote from: Monviech (Cedrik) on October 04, 2025, 02:19:11 PMThe way it works right now is intentional, since it guides the user implicitly that domains that are entered must be resolvable by dnsmasq. This is because most users also run unbound.

Yes, I am using Unbound as upstream.
Not quite sure about your point. If using IPset feature, then Unbound as upstream recursive resolver seems to be the preferred solution by docs - otherwise an additional external resolver would be needed to prevent loops.
In this case all queries are forwarded via wildcard / `*`. If a domain is resolvable will be determined by upstream. IPSet feature picks up those domains from the wildcard forwarding, that are interesting to be stored for firewall rules.
Or did you primarily have the case Unbound -> Dnmasq in mind?

QuoteAllowing a wildcard (#) to flush all resolved domains into an alias seems like its unecessary. The use case is clearly stated in the documentation, for allowlists regarding things like *.example.com or the like. It is just an extension of the other Alias types that exist for hostnames, not a solution for full alias management.

That wildcard is indeed intended for allowlists:
Allow everything, that explicitly has been resolved by primary DNS resolver of OPNsense. This enables whitelisting solely by domains, not static IPs.

QuoteIf you want full control, you can import a custom dnsmasq configuration file.

Yeah, that's what I am doing now. But I hoped to finally get all settings smoothly integrated in OPNsense GUI for better maintainability, now Dnsmasq is the standard DNS/DHCP server.                                                                                                         
Title: Re: Current limitations of Dnsmasq > Firewall Alias (IPset) design in OPNsense
Post by: Monviech (Cedrik) on October 04, 2025, 03:51:15 PM
Getting all settings included in all combinations is very hard.

The man page has quite some directives, some features will be limited in some way.

The scope in which the features work right now is pretty clear. A new grid just for ipset will not be created.

What could be a possibility though is to improve the validation so that a domain must not necessarily have an IP address or port defined. Such a scope would be managable to solve.

The issue sounds mostly input validation related.

Create a clear scoped ticket here and we can probably solve that:

https://github.com/opnsense/core
Title: Re: Current limitations of Dnsmasq > Firewall Alias (IPset) design in OPNsense
Post by: narubby_star on October 05, 2025, 04:21:17 PM
Done:
https://github.com/opnsense/core/issues/9262
https://github.com/opnsense/core/issues/9263
https://github.com/opnsense/core/issues/9264

Thanks for your work.