|
|
|
@ -10,15 +10,17 @@ if [ "$(whoami)" != "root" ]; then
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prior_ovpn_path="$(readlink "${current_ovpn_path}")"
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Add the ability to pass arbitrary ovpn files.
|
|
|
|
# TODO: Add the ability to pass arbitrary ovpn files.
|
|
|
|
# TODO: Remove the current config from the list of choices.
|
|
|
|
# TODO: Remove the current config from the list of choices.
|
|
|
|
# Choose a random VPN configuration inside /etc/openvpn/ovpn-enabled
|
|
|
|
# Choose a random VPN configuration inside /etc/openvpn/ovpn-enabled
|
|
|
|
ovpn_file=$(shuf -n1 -e ${ovpn_directory}/*)
|
|
|
|
new_ovpn_path=$(shuf -n1 -e ${ovpn_directory}/*)
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Also echo previous configuration's name.
|
|
|
|
echo "OpenVPN is currently connected to $(basename "${prior_ovpn_path}" .ovpn)"
|
|
|
|
echo "Using OpenVPN configuration $(basename "${ovpn_file}" .ovpn)"
|
|
|
|
echo "Switching to OpenVPN configuration $(basename "${new_ovpn_path}" .ovpn)"
|
|
|
|
|
|
|
|
|
|
|
|
ln -fs "${ovpn_file}" "${current_ovpn_path}"
|
|
|
|
ln -fs "${new_ovpn_path}" "${current_ovpn_path}"
|
|
|
|
|
|
|
|
|
|
|
|
echo "Restarting OpenVPN service."
|
|
|
|
echo "Restarting OpenVPN service."
|
|
|
|
systemctl restart openvpn
|
|
|
|
systemctl restart openvpn
|
|
|
|
|