summaryrefslogtreecommitdiffstats
path: root/bin/algo-config
diff options
context:
space:
mode:
Diffstat (limited to 'bin/algo-config')
-rwxr-xr-xbin/algo-config59
1 files changed, 0 insertions, 59 deletions
diff --git a/bin/algo-config b/bin/algo-config
deleted file mode 100755
index f9297ab..0000000
--- a/bin/algo-config
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env bash
-set -eu
-set -o pipefail
-
-script_path="$(realpath "$(dirname "$0")")"
-secrets_bin="${script_path}/secrets"
-config_path="$(echo /mnt/algo/configs/*/wireguard)"
-
-"$secrets_bin" open
-trap '"$secrets_bin" close' EXIT
-
-if [ -z "${VIRTUAL_ENV:-}" ]; then
- # shellcheck disable=SC1090
- . "${script_path}/helpers/algo-virtualenv"
- python -m pip install segno
-fi
-
-fixup_configs() {
- name=$1
- shift
-
- sed -i 's/^\(Address.*\) *,.*/\1/' "$config_path"/"${name}".conf
- sed -i '/^DNS/d' "$config_path"/"${name}".conf
- cp "$config_path"/"${name}".conf "$config_path"/"${name}"-not-captive.conf
- sed -i 's|^AllowedIPs.*|AllowedIPs = 0.0.0.0/0|' "$config_path"/"${name}".conf
- sed -i 's|^AllowedIPs.*|AllowedIPs = 10.49.0.0/24|' "$config_path"/"${name}"-not-captive.conf
-}
-
-# hornet
-fixup_configs hornet
-sudo cp "$config_path"/hornet.conf /etc/wireguard/algo-captive.conf
-sudo cp "$config_path"/hornet-not-captive.conf /etc/wireguard/algo.conf
-
-# tozt
-fixup_configs tozt
-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
-$secrets_bin sync tozt
-
-# partofme
-fixup_configs partofme
-scp "$config_path"/partofme-not-captive.conf root@partofme:/etc/wireguard/algo.conf
-cp "$config_path"/partofme-not-captive.conf /mnt/puppet/partofme/wireguard
-$secrets_bin sync partofme
-
-# mail
-fixup_configs mail
-scp "$config_path"/mail-not-captive.conf root@mail.tozt.net:/etc/wireguard/algo.conf
-cp "$config_path"/mail-not-captive.conf /mnt/puppet/mail/wireguard
-$secrets_bin sync mail
-
-# phone
-fixup_configs phone
-echo "algo-captive"
-segno --scale=5 --output="$config_path"/phone.png "$(cat "$config_path"/phone.conf)"
-sxiv "$config_path/phone.png"
-echo "algo"
-segno --scale=5 --output="$config_path"/phone-not-captive.png "$(cat "$config_path"/phone-not-captive.conf)"
-sxiv "$config_path/phone-not-captive.png"