Add wgup and wgdown scripts
This commit is contained in:
parent
679986a1af
commit
c18520d423
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# deactivate all wireguard interfaces; requires sudo
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $euid > 0 ]]; then
|
||||||
|
echo "requires administrative privileges"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
wg | grep interface: | grep -oP '([-\w]+)$' | while read -r iface ; do
|
||||||
|
echo "iface $iface down..."
|
||||||
|
wg-quick down "$iface"
|
||||||
|
done
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# select and active wireguard interface; requires sudo
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $euid > 0 ]]; then
|
||||||
|
echo "requires administrative privileges"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
defaultquery="es1"
|
||||||
|
conffile=$(find /etc/wireguard -type f -name '*.conf' | sort | fzf -q "$defaultquery")
|
||||||
|
config=$(basename "$conffile" ".conf")
|
||||||
|
wg-quick up "$config"
|
3
zshrc
3
zshrc
|
@ -75,6 +75,9 @@ alias pk="pkill -fc"
|
||||||
alias rez="source $HOME/.zshenv && source $ZDOTDIR/.zshrc"
|
alias rez="source $HOME/.zshenv && source $ZDOTDIR/.zshrc"
|
||||||
alias sc="systemctl"
|
alias sc="systemctl"
|
||||||
alias sysc="systemctl"
|
alias sysc="systemctl"
|
||||||
|
alias wg="sudo wg"
|
||||||
|
alias wgdown="sudo wgdown"
|
||||||
|
alias wgup="sudo wgup"
|
||||||
alias zzz="sudo systemctl hibernate"
|
alias zzz="sudo systemctl hibernate"
|
||||||
|
|
||||||
# recursive grep with line numbers and colour, ignoring binary files:
|
# recursive grep with line numbers and colour, ignoring binary files:
|
||||||
|
|
Loading…
Reference in New Issue