I have made a new version for you to test (pbr-1.1.8-r6-egc-1.bash) if you like.
In this version, if you set the wg server on the ignored interfaces list on Advanced tab then PBR should do nothing, so make no escape rule for the WAN.
However I am not convinced this is the best solution.
From earlier versions people are used to place the vpn server (openvpn , wireguard) on the ignored interfaces list, for WireGuard this is no longer necessary as it is ignored already but with my hack the automatic routing out via the WAN which can be very useful is not happening if you place the wg server on the ignored list.
If @stangri still thinks this is a good idea then at least we have to change the accompanying text in Luci app PBR and in the read.me
Hi, I have some confusion regarding the DNS hijack. In the document it was stated that:
Please note that the use of DNS Policies will override local DNS Hijacking (if enabled)
and also will prevent the domain-based policies from working for the local devices
specified in the DNS Policy, as your dnsmasq will not be queried by those local
devices anymore.
This is what I wanted (pbr DNS policy over local DNS hijack), but in reality the local DNS hijack will render DNS policies useless.
Thanks for testing, I will make a PR and will ask @stangri to take a look, as said not sure that this is the best solution but at least we know the problem.
To Be Continued
@egc thanks for PRs with wg server on ignored interfaces! I may have to follow up with you exploring various use cases to make sure that's the desired behaviour in all scenarios.
For the DNS hijack, I feel that pbr dns policies taking over the DNS hijack (as described in the README) is a preferable scenario, so can you please confirm that just moving the nft file as per note 2 in https://github.com/egc112/OpenWRT-egc-add-on/blob/main/stop-dns-leak/README.md#pbr-dns-policies in the package is enough to achieve that, wherever the hijack is set thru procd firewall entries (like adblock-fast, https-dns-proxy) or manually thru firewall config?
I feel that your earlier PR and the moving the nft file from post-chain to pre-chain are significant enough fixes to warrant 1.1.10 release.
Yes that is a sound plan, we are dealing with an edge case (user not wanted to routed out the WG listen port via the WAN port ) so no hurry in dealing with this.
But if you decide to go ahead then it is important that the help text is adapted (see my PR for luci-app-pbr) and maybe some explanation in the read.me is useful.
But I think the basics are covered with my PR added, this is my take on the wg_server situation:
A wg_servers is a wg interface with a listen_port which is not disabled.
By default there is no routing table / fwmark made for a wg_server.
To be able to use the wg_server for rotuing ( in case of a site-to-site setup), the wg_server can be added to the "Supported interfaces" so that a routing table/fwmark are made
By default the listen_port is routed out via the WAN. New (my PR) if the wg_server is added to the "Ignored Interfaces" then this route out of the listen port via the WAN is not made
These mechanisms are independent of each other
I just checked again and my hack will move the DNS policy up so that it is hit before other DNS hijacking rules
Current:
It is no guarantee, other packages can also use this to get on top so it also depends on when the packages are executed relative to each other but at least it gives a better chance
Hi. Installed PBR 2 days ago and domain-based policy to redirect some traffic to vpn from wan aren't working at all for me. DNS has been flushed at 2 devices several times + reboot after that. Can someone help? Logs are attached below. Thanks in advance
I have switched to Openwrt x86 with ext4 image and pbr is having problem to start on boot. I suppose this is related to pbr nft rule files are somehow persistent.
When I disable pbr in config and reboot, the old rules are still loaded. pbr.lock and pbr.nft are in /var/run, pbr status is reporting as running but table inet fw4 is empty.
What is actually going on?
P.S. Well I found that just editing option enabled in /etc/config/pbr does not actually enables or disables service on boot. I have to run /etc/init.d/pbr enable/disble, stop/start manually after changing config. But still why previously running nft rules are persistent?
And /etc/init.d/pbr status is always running!
/etc/init.d/pbr stop
Command failed: Not found
/etc/init.d/pbr status
pbr - environment
pbr 1.1.8-r6 running on OpenWrt 24.10.0.
I think it works like this:
All changes regarding this 1.1.8 branch start at:
After internal testing a package is made which is then available in stangri's repo and which you can use to upgrade if you set stangri's repo as update source in your routers feeds, see the How to Use section in the PBR guide
Usually within days after commits are made the new build is available in stangri's repo for you to upgrade.
At this moment 1.1.8-r10 is available for you to test
After more testing and after feedback from users a build which is deemed good enough is added to the official OpenWRT master repo
See the Makefile for the version.
Master and 24.10 are on 1.1.8-r6.
23.05 is on 1.1.6-r22
Usually only Master is updated, sometimes a backport is done in case of serious bugs.
But as described above you can add stangr's repo in your feeds and update from his own repo.
Out of curiosity, when was the option procd_boot_delay removed from the config?
I updated to Version 1.1.8-r10 and diff-ing the bundled config against mine showed that the option wasn't in the bundled config.