@bmeeks said in I am confusion...IDS inline on single WAN running an OpenVPN server which is LAN:
Go Googe "FreeBSD netmap device" and that should begin to answer your questions. You can also research in detail how OpenVPN creates its hooks into the FreeBSD networking kernel stack.
pfSense is your "origination" and "endpoint" for VPN connections to/from your LAN. Traffic flowing in and out of the physical LAN interface is unencrypted, so the IDS can inspect it.
@NollipfSense said in I am confusion...IDS inline on single WAN running an OpenVPN server which is LAN:
https://www.unix.com/man-page/freebsd/4/netmap/
thank you guys so much for pointing me towards the right direction, netmap is what I needed to dig a bit into to really understand this.
I did not understand what it was doing in the system and you guys sent me through a very very interesting rabbit hole.
let me add a couple of links in this thread (which is already popping in my google bubble for the search "freebsd netmap device openvpn"), this is the original paper from the guy who wrote netmap, Luigi Rizzo, an Italian IT professor, it goes into details about how it works and how it does it's pipes and answered a lot of my questions.
netmap: a novel framework for fast packet I/O
At a very high level, when a program requests to put an interface in netmap mode, the NIC is partially dis-connected (see Figure 3) from the host protocol stack.The program gains the ability to exchange packets withthe NIC and (separately) with the host stack, through circular queues of buffers (netmap rings) implemented in shared memory.
figure 3
[image: figure%2B1.png]
so specifically about suricata it does support netmap devices. So out of the box in inline mode, if your network device has netmap capabilities packets are gonna get from the NIC to suricata via the netmap magic (TX and RX rings, operating in shared memory).
Am I getting this right?
Specifically about OpenVPN another chapter should be opened because it comes with it's own way to implement things, it should be noted here that OpenVPN does stuff in user-mode and has its own hooks to get the encrypted packets coming in from the stack, authenticate/decrypt/(de)compress and then give em back to the stack, I haven't dug deep into it (yet), so thank you for clearing the air for me and allowing me to go further, much appreciated.
If we were to consider the other main VPN implementation, IPsec/IKE then IPsec is already happening in kernel and only IKE is happening in user mode, so it's got different piping to encrypt/decrypt the packets while talking with the stack/netmap, so the two probably will end up having the packets follow very different routes in a netmap system.
I'm also a linux guy and the tools to observe your own system are slightly different so doing this on BSD is extremely difficult for me, I've got an added learning curve, but exactly the learning experience I want because I'm really liking pfsense.
plus, my VPS pfsese box deployed in the wild is working like a charm, the IDS rules are easier to tackle than I expected, given my setup I only really block scans and known bad hosts since all my potentially vulnerable services are accessible only via VPN, so that's probably why, monitoring an actual active webserver is probably a very different task.