Prevent Certain LAN ips from accessing WAN when OpenVPN goes down
-
So, if you put in a rule immediately after the pass 192.168.1.5 to olive rule and you made it a block 192.168.1.5 to anywhere rule, I wonder what that would do?
Second what is the subnet the VPN is using? I have 1 last question after this…
-
Like so ?
Still lets traffic go though ISP.![Screen Shot 2013-08-09 at 7.40.15 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.40.15 PM.png)
![Screen Shot 2013-08-09 at 7.40.15 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.40.15 PM.png_thumb) -
If none of this works, I'm thinking this.
Traffic should go from 192.168.1.5 > some VPN subnet > WAN > VPN
(my understanding could be bad)
But, if you put a rule on the WAN to block any traffic that is source 192.168.1.5 and destination * that should block 192.168.1.5 when its not using VPN for sure. Not sure if it will also block it when inside VPN also. Never tried it. Its easy to do, try and undo if needed. Maybe try it.
If blocking 192.168.1.5 at the wan doesn't work or if it completely breaks 192.168.1.5 then I'm fresh out of unique and amazing ideas.
-
Like so?
You would think this would work ;) So did I, I think this was the first think i tried.anyway tried it again same thing.
![Screen Shot 2013-08-09 at 7.49.51 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.49.51 PM.png)
![Screen Shot 2013-08-09 at 7.49.51 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.49.51 PM.png_thumb) -
Just an idle question? Do you have a floating rule that says pass anything to anything because this is getting strange?
And are you sure the computer in question's IP is actually 192.168.1.5? -
hehe..
no but I have block source 192.168.1.5 to anywhere. Doesnt work either. -
So, its going to the VPN as a gateway and then that gateway is sending to the openweb when the vpn fails.
Maybe make a rule on the WAN that blocks anything from source interface BOLEVPN that isn't on that one port that openvpn needs.
This isn't multi-public-IP system right? Just 1 WAN?
-
I really hoped that would work but no :(
It seems the rules are being bypassed and traffic just jumps to VPN gateway. -
Did you apply some rules to the firewall outside the gui using command line?
-
No I don't. I haven't gotten that desperate yet :D I am hoping someone who made pfSense would be able to shed some light on this.
-
What does this mean: (from the docs)
Policy Route Negation
When a firewall rule directs traffic into the gateway, it bypasses the firewall's normal routing table. Policy route negation is just a rule that passes traffic to other local or VPN-connected networks that does not have a gateway set. By not setting a gateway on that rule it will bypass the gateway group and use the firewall's routing table. These rules should be at the top of the ruleset – or at least above any rules using gateways. -
It just means that when you send LAN traffic to VPN as gateway it does an end run around the rest of pfsense rules and that if no gateway is stipulated it will use a default gateway. Also says these rules belong at the top, which is where you have them.
Doesn't explain to me how to get a down VPN to cease and desist passing traffic.
BLOCK TRAFFIC WHEN VPN IS DOWN would be a great option to add to client VPN settings…
-
Well I specified option in vpn client not to route traffic by default. Because by default it would add a rule to force stuff into vpn. That's why policy based routing works. I can throw stuff at vpn as needed.
Is there another way to mark packets to go to that gateway?
-
I don't know that that would fix your problems. No matter how the traffic arrives at the VPN gateway it seems it might get to the WEB unless the VPN blocks traffic when down. An easy fix would be to run those devices off a second small device that acts as a VPN client, like a small DD-WRT router instead of using pfsense as VPN client. Then you could easily block any traffic not on a VPN port. Short of that, I guess we have to wait for answer from ubber genius more than us…
-
ok….. so I feel stupid now :)
I may have some progress now.
I have reread the other post over an over so it seems to somewhat work...
I still forward packets to VPN GW but also added DO NOT NAT rule for 192.168.1.5 on WAN. This seems to do the trick but I don't think it's right packets should theoretically go out. How do I drop them?Status now if VPN is up olive goes through VPN properly.
If VPN is down Olive cannot ping google.![Screen Shot 2013-08-10 at 9.57.53 AM.png](/public/imported_attachments/1/Screen Shot 2013-08-10 at 9.57.53 AM.png)
![Screen Shot 2013-08-10 at 9.57.53 AM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-10 at 9.57.53 AM.png_thumb)
![Screen Shot 2013-08-10 at 9.56.43 AM.png](/public/imported_attachments/1/Screen Shot 2013-08-10 at 9.56.43 AM.png)
![Screen Shot 2013-08-10 at 9.56.43 AM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-10 at 9.56.43 AM.png_thumb) -
I wouldn't feel stupid - I didn't think to try killing it there in outbound NAT. Nice.
-
:) Yeah but stuff still goes out and isp still dropping it I assume. I have to drop it at the firewall.
I wish there was a book on pfsense with some diagram on how packets traverse the firewall. -
the rule I used was…
Anything on WAN interface, Direction OUT,coming from 192.168.1.5 - to Anywhere BLOCK <--- this didnt work.
I also tried same as above going to WAN Subnet. that didnt work either.I've setup the following rule, works perfectly:
Firewall: Rules –> Floating tabIMPORTANT: it's NOT a quick rule!
Action: Block
Interface: WAN
Direction: any <-- (if set to OUT, it doesn't work!)
Source : any [here you need to enter 192.168.1.5]
Destination: any
[_/] Log packets that are handled by this rule
Description: FLOAT01_NO_INTERNET_IF_AIRVPN_IS_DOWN -
To my surprise I just tested this and can confirm the problem on 2.1 RC1. I also use policy routing, not default gateway, to route the VPN traffic, and I have nothing else that passes traffic for packets coming from "VPN subnet". It's seems clear to me that the "pass" on the LAN rule is a match for "pass" and thus no further rules are processed and no more consideration is made to whether that packet should be allowed. What I don't understand is why pfSense fall back to the routing table when the policy routing doesn't work. I can see that this could be wanted behaviour in some cases, but certainly not in all (it could for example route bandwith intensive traffic down an expensive link when the cheap link went down). I disagree that this should be an option in the VPN client, I'd rather have the chance to decide this on a per (policy routing) rule basis.
I havent tested with a floating block rule like panz suggests, but if that indeed works it makes me even more interested to get a detailed explanation to how and when firewall rules are processed. Are the floating rules processed before or after the interface rules, and are they processed several times for a single packet (that is for each interface it passes)? I've yet to find a detailed explanation for this, but I'm sure it must exist here somewhere? It's hard to design rules when you're not sure how they are processed.
-
Are the floating rules processed before or after the interface rules, and are they processed several times for a single packet (that is for each interface it passes)? I've yet to find a detailed explanation for this, but I'm sure it must exist here somewhere? It's hard to design rules when you're not sure how they are processed.
Floating rules are processed before the others.
All others interface rules are processed top –> down with the condition: first match = stop processing (so, if a packet matches the rules it encountered, further processing is halted).
One thing to consider is stateful inspection: if a packet is a reply to a legitimate one (= reply packet is matching the table) then it is allowed.
See "Firewalling with OpenBSD's PF packet filter" http://home.nuug.no/~peter/pf/en/