path: root/src/tests/netns.sh
diff options
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-11 16:34:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-11 17:21:54 +0200
commitfffe613427d70a7470d34b6dedcab9ffb8b6b667 (patch)
tree43c296d2fe6e5955a7964e7fe0640de9e7f795db /src/tests/netns.sh
parentnetlink: enforce that unused bits of flags are zero (diff)
noise: immediately rekey all peers after changing device private key
Reported-by: Derrick Pallas <derrick@pallas.us>
Diffstat (limited to '')
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/netns.sh b/src/tests/netns.sh
index 7cbbfce..9edf12b 100755
--- a/src/tests/netns.sh
+++ b/src/tests/netns.sh
@@ -76,8 +76,10 @@ ip0 link add dev wg0 type wireguard
ip0 link set wg0 netns $netns2
key1="$(pp wg genkey)"
key2="$(pp wg genkey)"
+key3="$(pp wg genkey)"
pub1="$(pp wg pubkey <<<"$key1")"
pub2="$(pp wg pubkey <<<"$key2")"
+pub3="$(pp wg pubkey <<<"$key3")"
psk="$(pp wg genpsk)"
[[ -n $key1 && -n $key2 && -n $psk ]]
@@ -221,6 +223,14 @@ kill $ncat_pid
n1 wg set wg0 peer "$more_specific_key" remove
[[ $(n1 wg show wg0 endpoints) == "$pub2 [::1]:9997" ]]
+# Test that we can change private keys keys and immediately handshake
+n1 wg set wg0 private-key <(echo "$key1") peer "$pub2" preshared-key <(echo "$psk") allowed-ips endpoint
+n2 wg set wg0 private-key <(echo "$key2") listen-port 2 peer "$pub1" preshared-key <(echo "$psk") allowed-ips
+n1 ping -W 1 -c 1
+n1 wg set wg0 private-key <(echo "$key3")
+n2 wg set wg0 peer "$pub3" preshared-key <(echo "$psk") allowed-ips peer "$pub1" remove
+n1 ping -W 1 -c 1
ip1 link del wg0
ip2 link del wg0