From 8259b1455f4d225004d6ddc1d6d3f1ccd8b872fa Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 1 Jun 2021 11:37:59 +0200 Subject: [PATCH] mulvad: Do not unlock pass when disabling tunnel --- modules/mullvad/mullvad.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/mullvad/mullvad.sh b/modules/mullvad/mullvad.sh index 934d3cb..37ec422 100755 --- a/modules/mullvad/mullvad.sh +++ b/modules/mullvad/mullvad.sh @@ -25,16 +25,16 @@ cmd() { sudo "$@" } -# Make sure gpg-agent is unlocked so the period where the interface exists but -# no private key is set is minised. -pass web/mullvad.net/wireguard >/dev/null - for interface in /sys/class/net/*; do interface="${interface#/sys/class/net/}" [[ $interface =~ ^mullvad-(v6-)?[a-z]{2}[0-9]*$ ]] && cmd wg-quick down "$interface" done if [ "$1" != "off" ]; then + # Make sure gpg-agent is unlocked so the period where the interface exists but + # no private key is set is minised. + pass web/mullvad.net/wireguard >/dev/null + cmd wg-quick up "$INTERFACE" pass web/mullvad.net/wireguard | while read -r line; do key="${line%%: *}"