I’ve been using a Sophos UTM virtual appliance as my main firewall / threat manager appliance for about two years now. I’ve had some strange issues with this solution off and on but for the most part it worked. The number of odd issues has begun to build, though.
Recently it decided to randomly drop some connections even though logs showed no dropped packets. The partial connections spanned across various networks and devices. I never did figure out what was wrong. After two days of furiously investigating (including disconnecting all devices from the network), the problem went away completely on its own with no action on my part. It was maddening – enough to drive me to pfSense.
As of version 2.2 pfSense can be fully virtualized in Xen, thanks to FreeBSD 10.1. This allowed me the option to migrate. Below are the initial steps I’ve taken to move to pfSense.
Features checklist
I am currently using the following functions in Sophos UTM. My goal is to move these functions to equivalents in pfSense:
- Network firewall
- Web Application Firewall, also known as a reverse proxy.
- NTP server
- PPPOE client
- DHCP server
- DNS server
- Transparent proxy for content filtering and reporting
- E-mail server / SPAM protection
- Intrusion Detection system
- Anti-virus
- SOCKS proxy
- Remote access portal (for downloading VPN configurations, etc)
- Citrix Xenserver support (for live migration etc)
- Log all events to a syslog server
- VPN server
- Daily / weekly / monthly e-mail reports on bandwidth usage, CPU, most visited sites, etc.
I haven’t migrated all of these function over to pfSense which is why this article is only Part 1. Here is what I have done so far.
Xenserver support
Installing xen tools is fairly straightforward thanks to this article. It’s simply a matter of dropping to a shell on your pfSense VM to install and enable xen tools
pkg install xe-guest-utilities echo "xenguest_enable=\"YES\"" >> /etc/rc.conf.local ln -s /usr/local/etc/rc.d/xenguest /usr/local/etc/rc.d/xenguest.sh service xenguest start
PPPoE client
The wizard works fine for configuring PPPOE, however I experienced some very strange issues with internet speed. Downstream would be fine but upstream would be incredibly slow. Another symptom was NAT / port forwarding appearing not to work at all.
It turns out the issue was pfSense’s virtualized status. There is a bug in the virtio driver that handles virtualized networking. You have to disable all hardware offloading on both the xenserver hypervisor and the pfSense VM to work around the bug. Details on how to do this can be found here. After that fix was implemented, speed and performance went back to normal.
DNS server
To get this working like it did in Sophos you have to disable the default DNS resolver service and enable the DNS forwarder service instead. Once DNS forwarder is enabled, check the box “register DHCP leases in DNS” so that DHCP hostnames come through to clients.
Syslog
Navigate to Status / system logs / settings tab and tick “Send log messages to remote syslog server” and fill out the appropriate settings.
Note for Splunk users: the Technology Add-on for parsing pfsense logs expects the sourcetype to equal pfsense (not syslog). Create a manual input for logs coming from pfsense so it’s tagged as pfsense and not syslog (thanks to this post for the solution on how to get the TA to work properly.)
VPN
OpenVPN – wizard ran fine. Install OpenVPN Client Export utility package for easy exporting to clients. Once package is installed go to VPN / OpenVPN and you will see a new tab – Client Export.
Note you will need to create a user and check the “create certificate” checkbox or add a user certificate to existing user by going to System / User manager, Editing the user and clicking the plus next to User Certificates. The export utility will only show users that have valid certificates attached to them. If no users have valid certificates the Client Export tab will be blank.
Firewall
One useful setting to note is to enable NAT reflection. This allows you to access NATed resources as if you were outside the network, even though you are inside it. Do this by going to System / Advanced and clicking on the Firewall / NAT tab. Scroll halfway down to find the Network Address Translation section. Change NAT reflection mode for port forwards to Enable (Pure NAT)
It’s also very helpful to configure host and port aliases by going to Firewall / Aliases. This is roughly equivalent to creating Network and Host definitions in Sophos. When you write firewall rules you can simply use the alias instead of writing out hosts IPs and ports.
So far so good
This is the end of part 1. I’ve successfully moved the following services from Sophos UTM to pfSense:
- Network firewall
- PPPOE client
- Log all events to a syslog server
- VPN server
- NTP server
- DHCP server
- DNS server
- Xenserver support
I’m still working on moving the other services over. I’ve yet to find a viable alternative to the web application firewall but I haven’t given up yet.