Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

adding ability to run with authfile #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
adding ability to run with authfile
strelok899 committed Aug 20, 2023
commit c18ef69304161a6db7aede4f3aea6174cdfb98d5
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ services:
| --- | --- | --- |
| `ALLOWED_SUBNETS` | | A list of one or more comma-separated subnets (e.g. `192.168.0.0/24,192.168.1.0/24`) to allow outside of the VPN tunnel. |
| `AUTH_SECRET` | | Docker secret that contains the credentials for accessing the VPN. |
| `AUTH_SECRET_FILE` | | file path that contains the credentials for accessing the VPN. |
| `CONFIG_FILE` | | The OpenVPN configuration file or search pattern. If unset, a random `.conf` or `.ovpn` file will be selected. |
| `KILL_SWITCH` | `on` | Whether or not to enable the kill switch. Set to any "truthy" value[1] to enable. |

7 changes: 5 additions & 2 deletions build/entry.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

cleanup() {
@@ -30,7 +29,7 @@ echo "using openvpn configuration file: $config_file"

openvpn_args=(
"--config" "$config_file"
"--cd" "/config"
"--cd" "/"
)

if is_enabled "$KILL_SWITCH"; then
@@ -40,6 +39,10 @@ fi
# Docker secret that contains the credentials for accessing the VPN.
if [[ $AUTH_SECRET ]]; then
openvpn_args+=("--auth-user-pass" "/run/secrets/$AUTH_SECRET")
elif [[ $AUTH_SECRET_FILE ]]; then

openvpn_args+=("--auth-user-pass" "$AUTH_SECRET_FILE")

fi

openvpn "${openvpn_args[@]}" &