(͠≖ ͜ʖ͠≖)👌
1 parent 6f5e5cf commit 0d96da8ed2fb402da472f240f3a253137befdd2c
root authored on 13 Jun 2022
Showing 1 changed file
View
32
RS/0FA.sh 0 → 100644
#!/bin/bash
#--- store google authenticator secret ---
#╰» secret-tool store --label=GA_Name rshell secret
#Password:
#--- read GA secret ---
#╰» secret-tool lookup rshell secret
#--- how to use ---
# 1. put the following in ~/.bashrc
# 2. open a new terminal
# 3. $> vpn2
function vpn2 {
D="$( date +%S )"
P="0000" # *CHANGE THIS* to match your pin (goes before OTP)
U="00000000-0000-0000-0000-000000000000" # *CHANGE THIS* to match your uuid (find with seahorse)
X=$( secret-tool lookup username secret ) # https://manpages.ubuntu.com/manpages/xenial/man1/secret-tool.1.html
Y=$( oathtool --totp -b "$X" ) # https://www.nongnu.org/oath-toolkit/man-oathtool.html
active_con=$(nmcli con show --active | grep "Name" | wc -l) # if "Name" not currently connected
if [ "${active_con}" = "0" ]; then
# update the password in system keyring
$( echo -n "$P$Y" | secret-tool store --label='VPN password secret for Name/org.freedesktop.NetworkManager.openvpn/vpn' setting-name vpn connection-uuid $U setting-key password )
nmcli con up id RootShell2
else
if [ "${active_con}" = "1" ]; then
printf "connected: $D: $P$Y\n"
fi
}
Buy Me A Coffee