Skip to content

Instantly share code, notes, and snippets.

@getsueineko
Last active February 18, 2022 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save getsueineko/37ec7348561fa7f1842f648edf94001c to your computer and use it in GitHub Desktop.
Save getsueineko/37ec7348561fa7f1842f648edf94001c to your computer and use it in GitHub Desktop.
# 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 username@contoso.com -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