From 76ec6dd2c3a56fac5f09943a9f7af9f4e2d17682 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Fri, 5 Jan 2024 12:10:17 +0100
Subject: Update vpn-wireguard playbook
---
data.d/vpn-wireguard/caeghi.tyil.net | 4 ----
data.d/vpn-wireguard/hooks/post-up | 10 ++++++++++
data.d/vpn-wireguard/peers/caeghi.tyil.net | 4 ++++
data.d/vpn-wireguard/peers/qohrei.tyil.net | 10 ++++++++++
data.d/vpn-wireguard/qohrei.tyil.net | 10 ----------
5 files changed, 24 insertions(+), 14 deletions(-)
delete mode 100644 data.d/vpn-wireguard/caeghi.tyil.net
create mode 100755 data.d/vpn-wireguard/hooks/post-up
create mode 100644 data.d/vpn-wireguard/peers/caeghi.tyil.net
create mode 100644 data.d/vpn-wireguard/peers/qohrei.tyil.net
delete mode 100644 data.d/vpn-wireguard/qohrei.tyil.net
(limited to 'data.d')
diff --git a/data.d/vpn-wireguard/caeghi.tyil.net b/data.d/vpn-wireguard/caeghi.tyil.net
deleted file mode 100644
index 2838c02..0000000
--- a/data.d/vpn-wireguard/caeghi.tyil.net
+++ /dev/null
@@ -1,4 +0,0 @@
-[Peer]
-AllowedIPs = fd68:1e45:bc6c:4c7b::57:20:2/128
-Endpoint = [2a01:4f8:c010:ca5::1]:51820
-PublicKey = pD5smiNb4NmNVwAJholXYZ5BnxHKyN8nb3mmLAD0BEY=
diff --git a/data.d/vpn-wireguard/hooks/post-up b/data.d/vpn-wireguard/hooks/post-up
new file mode 100755
index 0000000..948a9a8
--- /dev/null
+++ b/data.d/vpn-wireguard/hooks/post-up
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+# Ping all known hosts, as it seems that the wireguard interface comes up when
+# only after it gets used on the machine itself.
+while read -r addr;
+do
+ ping -c 1 -q -w 1 "$addr" &
+done < <(awk -F= '/vpn-wireguard.ip/ { print $NF }' /etc/bashtard/hosts.d/*)
+
+wait
diff --git a/data.d/vpn-wireguard/peers/caeghi.tyil.net b/data.d/vpn-wireguard/peers/caeghi.tyil.net
new file mode 100644
index 0000000..2838c02
--- /dev/null
+++ b/data.d/vpn-wireguard/peers/caeghi.tyil.net
@@ -0,0 +1,4 @@
+[Peer]
+AllowedIPs = fd68:1e45:bc6c:4c7b::57:20:2/128
+Endpoint = [2a01:4f8:c010:ca5::1]:51820
+PublicKey = pD5smiNb4NmNVwAJholXYZ5BnxHKyN8nb3mmLAD0BEY=
diff --git a/data.d/vpn-wireguard/peers/qohrei.tyil.net b/data.d/vpn-wireguard/peers/qohrei.tyil.net
new file mode 100644
index 0000000..a0a2224
--- /dev/null
+++ b/data.d/vpn-wireguard/peers/qohrei.tyil.net
@@ -0,0 +1,10 @@
+[Peer]
+<<<<<<< Updated upstream
+AllowedIPs = fd68:1e45:bc6c:4c7b::57:50:1/128
+Endpoint = [2a01:4f9:c012:6273::1]:51820
+PublicKey = 4BGxVjgNlFKOlomQSfxfsQs7y7hLbcK7iQyBs7Cf5mk=
+=======
+AllowedIPs = fd68:1e45:bc6c:4c7b::/64
+Endpoint = [2a01:4f9:c012:6273::1]:52345
+PublicKey = LY+L8jGdQwn545m71oBazey1QdJliibz1ejf3wpMgy0=
+>>>>>>> Stashed changes
diff --git a/data.d/vpn-wireguard/qohrei.tyil.net b/data.d/vpn-wireguard/qohrei.tyil.net
deleted file mode 100644
index a0a2224..0000000
--- a/data.d/vpn-wireguard/qohrei.tyil.net
+++ /dev/null
@@ -1,10 +0,0 @@
-[Peer]
-<<<<<<< Updated upstream
-AllowedIPs = fd68:1e45:bc6c:4c7b::57:50:1/128
-Endpoint = [2a01:4f9:c012:6273::1]:51820
-PublicKey = 4BGxVjgNlFKOlomQSfxfsQs7y7hLbcK7iQyBs7Cf5mk=
-=======
-AllowedIPs = fd68:1e45:bc6c:4c7b::/64
-Endpoint = [2a01:4f9:c012:6273::1]:52345
-PublicKey = LY+L8jGdQwn545m71oBazey1QdJliibz1ejf3wpMgy0=
->>>>>>> Stashed changes
--
cgit v1.1