At my workplace we are using VPN to connect to our servers.
Our VPN system is configured that way that it accepts as a password 8 digits generated by OTP and 4 persistent digits (e.g. 1111) = 12 digits in total. I'm using Debian 10 and OpenVPN.
In the very beginning I was using openvpn
command directly: specifying all parameters to it to perform the connection.
Then I decided to make a life a little bit easier and created aliases in my .zshrc
file:
# For connecting and checking status after thatalias ovpnc="sudo openvpn --config ~/OpenVPN/config/ovpn-client.ovpn --log /var/log/openvpn/ovpn-client.log --daemon | ovpns"# For checking logsalias ovpnl="sudo cat /var/log/openvpn/ovpn-client.log"# For checking status of connectionalias ovpns="curl -I --silent <GitLab project URL's> | grep -q 'location: <GitLab project URL>'&& (tput setaf 2 && echo 'Connected') || (tput setaf 1; echo 'Not connected')"# For closing connectionalias ovpnd="sudo pkill openvpn"
Because I am highly new to bash syntax, any suggestions are also welcome!
As time goes by, this is getting very annoying to specify login (it is not short too) and password to just connect to the work VPN, sometimes I need to reconnect to different VPNs or disconnect from it and in one day it can be up to 20-40 reconnections.
My questions are:
- Is there any way to simplify a process of connection (if it will remember at least login name it will be excellent)?
- Is there an easy way to configure console OTP client? If there is then is there a way to pass its output to OpenVPN client?