Last active
February 18, 2022 10:22
-
-
Save getsueineko/37ec7348561fa7f1842f648edf94001c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fix DNS (for Linux) | |
sudo dpkg-reconfigure resolvconf | |
# Find execute command | |
which openconnect | |
/usr/sbin/openconnect | |
# Allow members of group sudo to execute openconnect without passwd | |
sudo visudo | |
Add the follow string | |
Cmnd_Alias KILLVPN = /usr/bin/kill $(cat ~/.vpn-pid) | |
# Allow members of group sudo to execute openconnect without passwd | |
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/openconnect, KILLVPN | |
# Add func to your shell | |
to-evilcorp-vpn () { | |
if [[ $@ == "up" ]]; then | |
sudo openconnect vpn.contoso.com -u [email protected] -b --pid-file ~/.vpn-pid | |
elif | |
[[ $@ == "down" ]]; then | |
sudo kill $(cat ~/.vpn-pid) | |
else | |
echo -n "Error: unknown argument. Use either up or down." | |
fi | |
} | |
# https://habr.com/ru/post/479034/ | |
# https://habr.com/ru/post/547830/ | |
# https://gist.github.com/moklett/3170636 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment