December 23, 2018

OpenBSD: (Open)VPN client

Install lz4

# pkg_add lz4

Make a directory where the conf file will be hosted

# mkdir /etc/openvpn/

Get the conf file there

# cd /etc/openvpn/ && wget http://awesome-address.com/my-file.ovpn

Create an interface for it.

cat > /etc/hostname.tun0 <<-__EOF__ up !/usr/local/sbin/openvpn --daemon --config /etc/openvpn/my-file.ovpn __EOF__

This is not windows, no need to reboot

# /usr/local/sbin/openvpn --daemon --config /etc/openvpn/my-file.ovpn

Check it's there, up and running

# ifconfig tun0

Check you're where you are supposed to be with a "check my ip map".

To disconnect "gracefully" (sic)

# pkill -SIGTERM -f 'openvpn --daemon --conf $OPENVPNCONFFILE'

Although probably it is better to not have it start on boot and run it without a daemon

/usr/local/sbin/openvpn --config /etc/openvpn/my-file.ovpn

So that you can stop it with a CTRL+C