dotfiles/script/wgdown

16 lines
297 B
Bash
Executable File

#!/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