I am configuring my nixos firewall to allow port 5000 to be accepted because i am using flask to make a simple web server on my LAN. And yes, i configured flask to use 0.0.0.0.
It works for my phones to connect on my lan ip + port 5000. However, my windows computer is unable to connect. If i disable the firewall by setting networking.firewall.enable = false it works, however I do not find this acceptable because it isn’t good in terms of security. pingworks on the mobile devices (using termux), but it does not work on windows. If I disable the firewall, it works on windows.
My nixos computer running the sever is connected via ethernet to my network. My phones and windows computer are conencted to that network via the same WiFi network. I’m not sure what windows is doing that causes it to be rejected by my server (i presume). If i reboot the windows machine into linux (nixos), and use ping or curl with http & port 5000, it works. It seems to be a windows problem.
My main pain is the lack of feedback from my computer. it either works or it doesn’t. I tried enabling logging but my http requests did not seem to correspond to anything in the logs (no new logs appeared)
dmesg -w will give you kernel logs. Since the firewall is part of the kernel, and rejects requests before the http layer, blocked requests are logged there, not by your http server.
I’m not actually sure. It’s been a day and now my windows computer can access my server, but my brother’s windows computer cannot. In the kernel logs it says that a connection (from my brother’s pc afaik) has been blocked. It should be allowed under the 192.168.0.0/24 tcp dport 5000 accept since its ip starts with 192.168.0. This issue is really hard to debug because it sometimes works and sometimes doesn’t, even with the same config :\. All of a sudden now, after disabling firewall and reenabling it, my brother can access the server, which is annoying
AFAIK that is the case. There is networking.firewall.interfaces.<name>.allowedTCPPorts which obviously is not enabling the port for all interfaces but at this point I just write custom rules.
And yes you can use # for comments because it will act as a comment in the resulting nft config (which also uses # for comments)