blob: 81eca85dec9ea5e57e172961bcbac7e510932d4a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env bash
set -eu
set -o pipefail
script_path="$(realpath "$(dirname "$0")")"
secrets_bin="${script_path}/secrets"
config_path="$(echo /mnt/algo/algo/configs/*/wireguard)"
"$secrets_bin" open
trap '"$secrets_bin" close' EXIT
if [ -z "${VIRTUAL_ENV:-}" ]; then
# shellcheck disable=SC1090
. "${script_path}/helpers/algo-virtualenv"
:
fi
# hush
sudo cp "$config_path"/hush.conf /etc/wireguard/algo-captive.conf
sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/hush.conf" > "$config_path/hush-not-captive.conf"
sudo cp "$config_path/hush-not-captive.conf" /etc/wireguard/algo.conf
# tozt
sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/tozt.conf" > "$config_path/tozt-not-captive.conf"
scp "$config_path/tozt-not-captive.conf" root@tozt.net:/etc/wireguard/algo.conf
cp "$config_path/tozt-not-captive.conf" /mnt/puppet/tozt/wireguard
# partofme
sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/partofme.conf" > "$config_path/partofme-not-captive.conf"
scp "$config_path/partofme-not-captive.conf" root@partofme:/etc/wireguard/algo.conf
cp "$config_path/partofme-not-captive.conf" /mnt/puppet/partofme/wireguard
# mail
sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/mail.conf" > "$config_path/mail-not-captive.conf"
scp "$config_path/mail-not-captive.conf" root@mail.tozt.net:/etc/wireguard/algo.conf
# phone
echo "algo-captive"
sxiv "$config_path/phone.png"
echo "algo"
segno --scale=5 --output="$config_path/phone-not-captive.png" "$(sed 's|^AllowedIPs.*|AllowedIPs = 10.19.49.0/24, fd9d:bc11:4021::/48, 172.16.0.1/32|' "$config_path/phone.conf")"
sxiv "$config_path/phone-not-captive.png"
# bishamon
# XXX todo
# mail
# XXX todo
|