Add configuration script for PIA, downloading and modifying configs on startup

This commit is contained in:
Kristian Haugene
2020-10-11 21:29:52 +02:00
parent 889c760ebc
commit 803fb1970c
3 changed files with 46 additions and 6 deletions

View File

@@ -1,6 +1,12 @@
#!/bin/bash
echo "Modify chosen OpenVPN config for best behaviour in this container"
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
exit 1
fi
CONFIG=$1
[[ "${DEBUG}" == "true" ]] && echo "Modifying $CONFIG for best behaviour in this container"
# Every config modification have its own environemnt variable that can configure the behaviour.
# Different users, providers or host systems might have specific preferences.
@@ -11,6 +17,6 @@ CONFIG_MOD_USERPASS=${CONFIG_MOD_USERPASS:-"1"}
## Option 1 - Change the auth-user-pass line to point to credentials file
if [[ $CONFIG_MOD_USERPASS == "1" ]]; then
echo "Point auth-user-pass option to the username/password file"
sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" "$CHOSEN_OPENVPN_CONFIG"
[[ "${DEBUG}" == "true" ]] && echo "Point auth-user-pass option to the username/password file"
sed -i "s/auth-user-pass/auth-user-pass \/config\/openvpn-credentials.txt/" "$CONFIG"
fi