Skip to content

Commit

Permalink
make protocol dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
brunodasilvalenga committed Feb 19, 2021
1 parent d1ba285 commit 740e326
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/ovpn_run
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ USER_ARGS=("${@}")
ARGS=()
CIPHER=AES-256-GCM

set +u

[ -z "$OVPN_PROTO" ] && OVPN_PROTO=udp

# Checks if ARGS already contains the given value
function hasArg {
local element
Expand Down Expand Up @@ -76,9 +80,9 @@ function checkUpdateConfig {
echo "==> Generating openvpn config"
if [ "${MFA:-false}" == "true" ]; then
echo "--> MFA Enabled"
ovpn_genconfig -u udp://${DOMAIN_NAME:-vpn.server.address} -d -N "${ROUTE_PUSH_ARGS[@]}" -2 -C ${CIPHER}
ovpn_genconfig -u ${OVPN_PROTO}://${DOMAIN_NAME:-vpn.server.address} -d -N "${ROUTE_PUSH_ARGS[@]}" -2 -C ${CIPHER}
else
ovpn_genconfig -u udp://${DOMAIN_NAME:-vpn.server.address} -d -N "${ROUTE_PUSH_ARGS[@]}"
ovpn_genconfig -u ${OVPN_PROTO}://${DOMAIN_NAME:-vpn.server.address} -d -N "${ROUTE_PUSH_ARGS[@]}"
fi
echo "--> /etc/openvpn/openvpn.conf START"
cat /etc/openvpn/openvpn.conf
Expand Down Expand Up @@ -211,8 +215,5 @@ function loopCheckUpdateConfig {

loopCheckUpdateConfig &

echo "Running http server"
exec python3 http-server.py &

echo "Running 'openvpn ${ARGS[@]} ${USER_ARGS[@]}'"
exec openvpn ${ARGS[@]} ${USER_ARGS[@]}

0 comments on commit 740e326

Please sign in to comment.