Ufw kill switch with openhab + pivpn

So my server is principally an OH server with a ufw based firewall, running a openssh server instance . I ringfence this with OpenVPN server.

But, I would like to enforce a killswitch on the server. So I turned here:
https://www.codeproject.com/Articles/1266552/Create-a-VPN-killswitch-with-UFW , However, it requires three pieces of info:

  • The public IP address of the VPN server you connect to
  • The port and protocol your server uses to communicate
  • The subnet of your local network

This leads me to two questions, please:

  1. In terms of the Puplic IP , i use a DDNS from no-ip and my publiic server address will change (as confirmed by my Open VPN client) , so …?

  2. The subnet, well my LAN nodes are on subnet 192.168.1.0/24 , however my VPN client reports my private IP to be on a different subnet , for example as I write this it is 10.8.0.2.

So in openhabian, 2.5, how do I configure this all, and what files to I change - another confusing topic because openhabian has “config” files in /etc/openhab2/…, /etc/default/…, */usr/share and so on.

I’m useless at networking btw so thank you in advance.

Ping your DDNS URL and parse out the IP address from the results.

The VPN is always on a different subnet. With the information provided I’d guess it wants your 192 subnet. That’s the local one.

No clue. You need to ask over on CodeProject. None of this has anything to do with OH nor openHABian. openHABian is just generic Raspbian so anything that applies to Raspbian will apply to it too.

ah, ok ritch thanks
wasnt aware it was raspbian,
ive run raspbian for years on other Pis, which i not the 100% same as debian nor is openhabian 100% same as raspbian or debian. some tweaks always required. that’s why i posed the OP
.but your the guy who knows on here, so I’ll treat it like raspbian then…
and come back when it’s not tbe same :+1::grin:

Well, in that case there is no such thing as Raspbian beyond the static image that you download. All that openHABian does is install and configure some software. It’s not a custom Linux distro. It doesn’t change anything core to the OS. It only really adds to it.