Se um estiver comprometido com o vetor terminal openvpn
, coloque um script bash chamado ~/bin/m0vpn
(para uma VPN chamada m0
), então conecto simplesmente abrindo um terminal e digitando:
m0vpn
Aqui está o script:
#!/bin/bash
OVPNFILE="$HOME/.config/vpn/m0/client.ovpn"
TEMPRESOLV="nameserver 10.0.0.2\ndomain prd1.m0\n"
# The next two lines create a temporary /etc/resolv.conf which includes the original.
# For extra security you may modify this behavior (to use Only your own DNS server)
# ^ But then, you must connect to an IP address (no hostname) from your .ovpn file!
sudo printf "$TEMPRESOLV" | cat - /run/resolvconf/resolv.conf > /tmp/resolv.conf
sudo mv /tmp/resolv.conf /etc/resolv.conf
printf "Temporary /etc/resolv.conf:\n$TEMPRESOLV"
sudo openvpn $OVPNFILE
sudo ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
echo "Reset resolv.conf"
E talvez um dia NetworkManager
simplesmente possa usar o arquivo .ovpn
.