dotfiles/script/wgdown

16 lines
297 B
Plaintext
Raw Normal View History

2021-03-31 21:34:50 +02:00
#!/usr/bin/env bash
#
# deactivate all wireguard interfaces; requires sudo
set -e
2021-04-02 21:52:43 +02:00
if [[ $EUID > 0 ]]; then
2021-03-31 21:34:50 +02:00
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