Next is to limit the number of disk writes, as this is only a single node (not running a Proxmox cluster) HA services which are heavy on the disk writes can be turned off. To disable the HA services using the cli:
systemctl stop pve-ha-lrm
systemctl disable pve-ha-lrm
systemctl stop pve-ha-crm
systemctl disable pve-ha-crm
systemctl stop corosync.service
systemctl disable corosync.service
Disable logging to disk by adding the following two settings to the end of /etc/systemd/journalctl.conf:
Storage=volatile
ForwardToSyslog=no
You can monitor the write utilisation of the disk using:
smartctl -a /dev/nvme0
Look for 'percentage used' if available and see if it's increasing rapidly - eg it shouldn't increase more than say 1% a month, preferably less. You may need to use the TB written and calculate it from the manufacturer's specification.
Upload the OPNsense ISO to proxmox and mounted the image to the new virtual machines 'DVD' drive.
Given that this is a passively cooled device sitting in a closet, I wanted to monitor the CPU temperatures. Proxmox doesn't provide this however you can use the a script from
https://github.com/Meliox/PVE-mods to provide CPU and NVMe temperatures on the Proxmox node summary.
apt-get install lm-sensors
wget https://raw.githubusercontent.com/Meliox/PVE-mods/main/pve-mod-gui-sensors.sh
bash pve-mod-gui-sensors.sh install
I have found that Linux's '
Split Lock Detection' causes intermittent issues with OPNsense in my particular setup so I disabled it by setting the following in /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet split_lock_detect=off"
The issues I found was that persistent connections would be reset, for example DNS over HTTPS (DoH) sessions would reset and have to be reestablished. Moreover, Proxmox would crash requiring a power cycle.
OPNsense Installation
As mentioned I would like to add OPNsense as a transparent firewall so as to minimise changes to my network while keeping the attack surface to a minimum as the firewall itself can come under attack or end up with its own vulnerabilities that I need to manage.
Transparent Firewall (Bridge)
I suggest using floating firewall rules with their state set to either 'sloppy' or 'none', in my case I only required a handful to ensure all traffic was allowed, including the firewalls traffic via the management network. The existing firewall on the router will handle the layer 4 filtering.
If using IPv6, make sure to enable 'Link-local Address' when configuring the bridge interface. Otherwise strange behaviour will occur.
The only other tweak I made was to set the State Type of the floating rules to 'sloppy state' - likely not needed however I was finding a few persistent connections from IoT devices that would continuously trip up the invalid state block until I set this.
General
A handful of configuration items needed, primarily enabling the RAM disks and sending logs to the NAS.
- Set up configuration backups - 3 revisions
- Configure DNS - I use a pihole running as a container on the NAS
- Update to the latest firmware version
- Logging - set up remote logging to the NAS
- Enable RAM drives for /var and /tmp - use 10% of memory each.
NetFlow/Insight
I like the traffic insights provided by OPNsense so I enable NetFlow and collect the flows for the on-box Insights reports.
- Add the WAN and LAN interfaces as NetFlow listening interfaces.
- Set the WAN interface as the... WAN interface
- Tick the 'Capture Local' box to begin to inform the local Insights
Zenarmor
Zenarmor provides extra-firewall intelligence feeds in the form of curated categorised lists.
Configuration options are limited under the free version. Much of it is self explanatory - I set the monitored interface to 'LAN' and I enabled all the 'Essential Security' items except DNS over HTTPS as I use that.
CrowdSec
CrowdSec is similar to Zenarmor is that it provides extra-firewall intelligence however it also monitors the local firewall logs for malicious activity and executes scenarios to defeat it.
I use the following blocklists:
- Firehol cybercrime tracker list
- Firehol greensnow.co list
- Free proxies list
Intrusion Detection
OPNsense comes with
Suricata IDS. I enabled the service and set the monitored interface to 'WAN' so as to not conflict with Zenarmor, which is monitoring 'LAN'.
I enabled various rulesets from abuse.ch and ET Open and set the update schedule to occur daily. I then created a policy to drop any traffic that had a rule signature of 'major' or 'critical'. I find this provides a reasonable amount of protection with little administration overhead.
QEMU Plugin
As OPNsense is running on a Promox hypervisor, it's wise to install the QEMU Agent to allow the hypervisor to better manage this guest.
- Install the QEMU Guest Agent plugin and set 'virtio_console_load' = yes tunable
- In Proxmox, enable the QEMU Guest Agent within the OPNsense VM's options and reboot
Conclusion
With a small investment in hardware I have added smart network security controls to my home network that require little ongoing maintenance and management due to the automatic updating of the threat feeds.
Resource wise OPNsense is peaked at 7 - 8GB memory and settled at 3 - 4GB and CPU occasionally spiking to 50% (I suspect a single core or two might be spiking to 100%). Disk usage is sitting at 25% after a week.
Compared to my experiences with Fortinet, Cisco (ASA & FTD), Checkpoint, Sophos and Sonicwall firewalls - OPNsense offers a reasonable level of security coverage and features when combined with CrowdSec and Zenarmor, while still being easy to use and intuitive.
Follow up
I have added a fan to sit on top of the mini-PC as my closet gets warm
with the other equipment - a 120mm case fan connected to the screw
terminal directly behind the 12V DC socket has brought CPU temperatures
down to 40°C from 60°C.