Sometimes you want to verify that a remote host is currently connected to a VPN, before performing an additional action. Here is a script to verify that host is VPN’ed
Verify that Host is VPN’ed
Maybe you use an non-logging VPN service, like EarthVPN, and you want to find out if your host is still on the VPN, prior to initiating a torrent download of a fully legal Linux ISO or other opensource software package.
I found it easiest to see if the VPN is still up, by checking that host’s public IP, from the perspective of an online resource.
REMOTE=$(ssh email@example.com “wget http://ipinfo.io/ip -qO -“)
- curl (on your workstation)
- wget (on the VPN host)
- ssh pubkey auth (to simplify)
Create this script on your workstation or desktop. If you want to avoid typing the SSH password every time you run this script, do an SSH PubKey on the remote VPN host.
Was this helpful?
If you found my posts interesting, or I helped you figure something out, please consider tossing me a tiny gratuity for my time, research, to help offset the web hosting/development costs or to buy me a cup of coffee.
* This post may contain affiliate links. This means that I “might” receive a tiny amount of money, if you make a purchase using one of our links. It does not cost you anything extra, and helps us defray the costs of hosting and maintaining this site.