Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using a user-specified configuration #141

Closed
marcov opened this issue Sep 18, 2018 · 1 comment

Comments

@marcov
Copy link

commented Sep 18, 2018

Hey,
it would be great if you can support the use case of user specifying its own config.
That's because most of the VPN providers are giving out ovpn ready to be used with --config.

Something like the following, paired with docker run option -v ~/myconfig.ovpn:/vpn/vpn.conf

diff --git a/openvpn.sh b/openvpn.sh
index 6e91294..08d64e6 100755
--- a/openvpn.sh
+++ b/openvpn.sh
@@ -211,7 +212,8 @@ route6="$dir/.firewall6"
 [[ -f $cert ]] || { [[ $(ls $dir/* | egrep '\.ce?rt$' 2>&- | wc -w) -eq 1 ]] &&
             cert="$(ls $dir/* | egrep '\.ce?rt$' 2>&-)"; }
 
-while getopts ":hc:df:p:R:r:v:" opt; do
+
+[ -s "$conf" ] || while getopts ":hc:df:p:R:r:v:" opt; do
     case "$opt" in
         h) usage ;;
         c) cert_auth "$OPTARG" ;;

@dperson dperson self-assigned this Sep 23, 2018

@dperson

This comment has been minimized.

Copy link
Owner

commented Sep 23, 2018

It is already supported. The -v or VPN environment variable are completely optional. Without those set it doesn't try to configure the vpn on it's own.

The container does expect that the configuration will be in /vpn and that it will end in either .ovpn or .conf. If the CA cert isn't embedded it must be in the same /vpn directory and have a file name ending with .crt

@dperson dperson closed this Sep 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.