I built an image from master just now and created this firewall rule to deny WAN access to a particular client. The rule is active yet I can still get out to the WAN from that client. Under a pure fw3 image built from a few days ago, the rule worked as expected. How can I debug?
config rule
option src 'lan'
option target 'REJECT'
option name 'Deny WAN access'
option dest 'wan'
list proto 'all'
list src_ip '10.9.8.100'
list src_ip '10.9.8.112'
copy the fw3 working tables entries related to this rule, save to file, use iptables-restore-translate on the resulting file to create a nft tables rule and compare with that generated by fw4 (nft list | grep "Deny")?
just a thought - haven't done this yet, but i need to start thinking about it.
That gave no output. I would try the other suggestions, but I flashed an older image to the device which uses fw3 and that does work. I don't know what else isn't working and need to control access to devices here. Will have to get a spare RPi4 to use for development testing with this.
@jow - Build from master just now did give the expected behavior, but the rule was not active when the device booted. I had to manually start it.
# /etc/init.d/firewall status
inactive
# /etc/init.d/firewall stop
Command failed: Not found
# /etc/init.d/firewall start
# /etc/init.d/firewall status
active with no instances
Is this to be expected?
It is symlinked to start:
# ls -l /etc/rc.d|grep fire
lrwxrwxrwx 1 root root 18 Feb 7 11:05 S19firewall -> ../init.d/firewall
I am happy to. I think the log will disclose my public IP which I will sanitize. Are there any other piece of data that might be a privacy breach you can think of in the log? I do not believe it will include my wireguard interface client keys.
Before I try that, I should clarify. I think the reboot is a distraction.
I have this existing rule:
config rule
option src 'lan'
option target 'REJECT'
option name 'Deny WAN access'
option dest 'wan'
list proto 'all'
list src_ip '10.9.8.100'
I want to test the fw4, so I did this:
Luci>Network>Firewall>Traffic Rules
Edit my blocking WAN rule to add the IP address 10.9.8.112 to the rule
Hit save then hit save and apply
Upon doing that, I can still access the WAN from 10.9.8.112. I therefore concluded that fw4 (or the luci interface) was broken somehow.
In order to have the rule take effect I need to reload the firewall.
/etc/init.d/firewall reload
The same is true if I delete the 10.9.8.112 IP and hit save then save and apply. LuCi updated to show that IP was removed, but WAN access is still denied on that device. Again, I had to reload the firewall.
This is because the firewall service is not properly registered on boot, so the reload actions do not work until you stopped/started the init script at least once. The sed fix above should solve that.
You are correct. Running that sed onliner, then rebooting causes fw4 to behave as expected. I further tested by editing the rule to remove 10.9.8.112, save, then save and apply behave as expected. Did you edit the affected upstream code? I assume the issue will affect other users as well.