Using synproxy in pf? reddit / freebsd ---------------------------------------------------------------------- l008com · 2020-11-19 21:15 I am trying to set up synproxy inside my pf firewall. I know there are other methods for fighting synfloods but for now I'm focusing on synproxy. The docs make it sound easy enough to use, just switch `keep state` to `synproxy state` and you're good to go. But alas, I am not good to go. When I set up a synproxy rule like this, I can see in the state counts ( `pfctl -si` ) that the new connection attempts are being proxied. The synproxy counter starts ticking away when I try to load a web page through this rule. But the connection is never made, no data is ever transferred, and the browser eventually stops trying with an unreachable server type of error. I've been searching high and low with very little luck. All I can find over and over again, is just adding the state keyword `synproxy`. Here is an example rule:`pass in quick proto tcp to [actual ip address] port { 80 443 } synproxy state` Simple enough, but nothing I do is able to make this work, to a point where a browser can complete a connection. I'm wondering if there is some other component to this I'm missing? A specific rule you need to add to allow the extra connection from the `synproxy` to go through? I can post my whole .conf if wanted. It's a pretty simple config. Basically just a `block all` then some specific `pass in quick`'s for specific services I'm running. ​ Edit: Here is my ruleset. This is on my dummy server at home so it uses LAN IPs, and I have subdomains pointing to that local IP to test loading web pages locally. `set skip on lo0` `table const {` [`172.16.5.1/24`](https://172.16.5.1/24) `}` `table persist` `table persist` `block in quick from to any` `block in quick from to any` `block in all` `pass in quick proto tcp to` [`172.16.0.130`](https://172.16.0.130) `port { 25 587 993 } keep state` `pass in quick proto tcp to` [`172.16.0.130`](https://172.16.0.130) `port { 80 443 } synproxy state` `pass in quick proto { esp icmp } from any to any keep state` `pass in quick from to any keep state` `pass in quick proto udp from any to any port { 500 1701 4500 } keep state` `pass out proto { tcp, udp, icmp } from any to any keep state` If I change the `synproxy state` keyword above to `keep state`, everything works normally but with no proxying. If I change it back to `synproxy state`, the handshakes to appear to get proxied but data can't seem to traverse this connection. ---------------------------------------------------------------------- gumnos · 2020-11-19 21:54 any rules allowing HTTP/S traffic to flow back *out*? Not that I've ever written any rules that cut my legs out from under me like this. Never. Well, not this week. ---------------------------------------------------------------------- l008com · 2020-11-19 22:00 LOL. And yes, my last rule is: `pass out proto { tcp, udp, icmp } from any to any keep state` To allow unfettered outbound connections so the server itself can make HTTP requests. ---------------------------------------------------------------------- [deleted] · 2020-11-19 23:56 [deleted] ---------------------------------------------------------------------- l008com · 2020-11-20 00:23 This firewall is running directly on the server. I'm not directing anything to any other machines. So if that's what the pf docs mean by bridging, that shouldn't apply to me. ---------------------------------------------------------------------- l008com · 2020-11-20 16:06 I edited my original post to show the full ruleset. It's quite simple. ---------------------------------------------------------------------- gumnos · 2020-11-20 16:31 If you crank up the logging, either on that one `synproxy` line or a first-pass `pass log(all) proto tcp` at the top (beware, this may spew logs depending on the traffic, but you said this is on the LAN for testing so hopefully it's not too voluminous; if it is, adjust the `pass` so that it only logs packets from your dev machine), do you see any differences in your `tcpdump -n -e -ttt -i pflog0` output?