Discussion: OPNsense as sys-net alternative

I was impressed by Fortifying sys-net: A Shift to OpenBSD .

Basic diagram of goal:

So I just check and it very easy to install OPNsense as HVM, it recognize Ethernet without any additional drivers and manipulations, same work should be done to recognize wifi module. also to setup dedicated management qube for OPNsense webui access.

OPNsense qube should replace also vpn qubes and run Suricata as additional security layer for device.

Someone can share the right way to implement networking part between fw-pvh and OPNsense qube?

1 Like

This guide may fit installation of OPNsense as sys-net?
Idea is to get bsd base qube, but with suricada out of the box.

Solution:

But:
“Setback: It looks like R4.1 has broken this, throwing an error complaining of a loop in sys-firewall…” - so need to look for workaround

Installation of OPNsense as full replacement for sys-net still in progress, I share solutions that I found in order to get same feedback and advice.
Don’t follow those steps as guide!

Set your networking as followed:
Set sys-firewall-switch as n/a (no net qube)
Set sys-OPNsense net Qube as sys-firewall-switch
Set sys-firewall-swtich as net Qube for sys-firewall and etc.

Base on: Integrate pfSense/OPNsense VM on QubesOS · Issue #1 · jcholsap/freemod · GitHub
step 10.
For sys-firewall-switch setup,
Edit script in next way:

# Updated for opnsense testing, 4.3.0rc1.
#!/usr/bin/sh
#
# Logging Function
sysidps_log () { echo -e "$(date "+%F %T")" "$1" | tee -a >&1 "$log_file"; }
log_msg_rfail="SKIP!!! Timed out waiting on IDPS router reply."
log_msg_wfail="SKIP!!! Timed out waiting on IDPS WAN gateway reply."
log_msg_rchk="SKIP!!! Checking IDPS router for ICMP echo reply..."
log_msg_wchk="SKIP!!! Checking IDPS WAN gateway for name resolution & ping reply..."
log_msg_rup="SKIP!!! IDPS router replying to ping requests!"
log_msg_wup="SKIP!!! IDPS WAN gateway name resolved and reply received!"
log_msg_fwrtr="IDPS router set as the default route."
log_msg_vifrtr="Connection between sys-manage and OPNsense allowed."
log_msg_ns="IDPS name servers added to routing table."
log_file="/var/log/qubes/sys-idps"
#
#FAQ: https://www.qubes-os.org/doc/firewall/#enabling-networking-between-two-qubes
#Done within sys-firewall-switch
#Allow access to opnsense gui from sys-manage qube behind of sys-fw-switch
sudo nft add rule ip qubes custom-forward ip saddr <IP address of sys-managment> ip daddr <IP address of OPNsense> ct state new,established,related counter accept
sysidps_log "$log_msg_vifrtr"
# Hard code static IP addresses. You need at least one name server.
gw_ip=<IP address of OPNsense> 
ns1_ip=10.137.251.1
ns2_ip=10.137.1.1
#
sysidps_log "$log_msg_rup"
#
# Set idps router ip as default route.
# Running "ip route add" first makes discovering gw_vif easy.
ip route add default via $gw_ip
gw_vif=$(ip route show default | cut -d ' ' -f 5)
sysidps_log "$log_msg_fwrtr"
#
# Add routing to name server resolution. Call Qubes name server script.
rm -f /etc/resolv.conf
if [ "X$ns1_ip" != "X" ] ; then echo "nameserver $ns1_ip" >> /etc/resolv.conf ; fi
if [ "X$ns2_ip" != "X" ] ; then echo "nameserver $ns2_ip" >> /etc/resolv.conf ; fi
/usr/lib/qubes/qubes-setup-dnat-to-ns
sysidps_log "$log_msg_ns"
#
sysidps_log "$log_msg_wup"
#
exit 0

At the moment:

  1. OPNsense GUI reachable from lan.
  2. OPNsense running well as HVM, networking interfaces attacked to it but missing of iwlwifi prevent it from see wifi card.
dmesg | grep wifi

**a lot errors about missing of iwlwifi support**

OPNsense inform about:

xn1: performing interface reset due to feature change 

Source: OPNSense with XEN: Performing interface reset on every reboot and OPNsense as VM in Xen: Network interfaces down after Debian dom0 updates
Solved at the moment by:

  1. Lock LAN interface
  2. Disable hardware checksum offload