Basic working code that is capable of establishing the Wireguard tunnel given that there is properly configured `.psk` file for at least one known wifi network (see README.md for more details)
40 lines
799 B
Bash
Executable File
40 lines
799 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
FILES_IN_VAULT='./src/wifi-password.txt
|
|
./src/repository-builder/packager.rsa
|
|
./src/repository-builder/packager.rsa.pub
|
|
./src/wireguard.private.key
|
|
./src/wireguard.public.key
|
|
./src/authorized_keys'
|
|
|
|
age_encrypt() {
|
|
local input="$1"
|
|
local output="$1.tmp"
|
|
local AGE_PASSPHRASE=`cat ./.vault_password_file`
|
|
|
|
./cache/age/age --encrypt --passphrase --armor --output $output $input && rm $input && mv $output $input
|
|
}
|
|
|
|
age_decrypt() {
|
|
local input="$1"
|
|
local output="$1.tmp"
|
|
local AGE_PASSPHRASE=`cat ./.vault_password_file`
|
|
|
|
./cache/age/age --decrypt --output $output $input && rm $input && mv $output $input
|
|
}
|
|
|
|
encrypt() {
|
|
for FILE in $FILES_IN_VAULT; do
|
|
age_encrypt $FILE
|
|
done
|
|
}
|
|
|
|
decrypt() {
|
|
for FILE in $FILES_IN_VAULT; do
|
|
age_decrypt $FILE
|
|
done
|
|
}
|
|
|
|
$1
|