From f96480ad91d4f4d475dd5f538f7b5c9e8754f646 Mon Sep 17 00:00:00 2001 From: Md Imran Date: Tue, 31 Oct 2023 18:19:03 +0530 Subject: [PATCH] fix(): tcp support (#31) * fix(): tcp support Signed-off-by: Md Imran * fix(): file update done Signed-off-by: Md Imran --------- Signed-off-by: Md Imran --- ovpn/scripts/process.sh | 1 + ovpn/scripts/validate.sh | 10 ++++++++++ ovpn/template/client-openvpn-combined.conf | 1 + ovpn/template/server-openvpn.conf | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ovpn/scripts/process.sh b/ovpn/scripts/process.sh index e31b7c3..9585da0 100644 --- a/ovpn/scripts/process.sh +++ b/ovpn/scripts/process.sh @@ -153,6 +153,7 @@ function substituteTemplateParameters() { sed -i "s;;${VPN_NETWORK};g" ${VPN_FQDN}/$file sed -i "s;;${VPN_MASK};g" ${VPN_FQDN}/$file sed -i "s;;${VPN_CIPHER};g" ${VPN_FQDN}/$file + sed -i "s;;${GATEWAY_PROTOCOL};g" ${VPN_FQDN}/$file done popd log "All parameters were substituted." diff --git a/ovpn/scripts/validate.sh b/ovpn/scripts/validate.sh index e1e2d63..a798f24 100644 --- a/ovpn/scripts/validate.sh +++ b/ovpn/scripts/validate.sh @@ -105,6 +105,16 @@ function validateIndividualCertRequest() { FAIL=YES fi + if [[ -z ${GATEWAY_PROTOCOL} ]]; then + GATEWAY_PROTOCOL="udp" + else + GATEWAY_PROTOCOL=$(echo "${GATEWAY_PROTOCOL}" | tr '[:upper:]' '[:lower:]') + if [[ ${GATEWAY_PROTOCOL} != "udp" && ${GATEWAY_PROTOCOL} != "tcp" ]]; then + GATEWAY_PROTOCOL="udp" + fi + fi + + if [[ "${FAIL}" == "YES" ]]; then log "One or more required parameters were missing." finish diff --git a/ovpn/template/client-openvpn-combined.conf b/ovpn/template/client-openvpn-combined.conf index 2af3cbd..ad3b7cb 100644 --- a/ovpn/template/client-openvpn-combined.conf +++ b/ovpn/template/client-openvpn-combined.conf @@ -15,6 +15,7 @@ tls-auth ta.key 1 cipher auth SHA256 tun-mtu 1300 +proto diff --git a/ovpn/template/server-openvpn.conf b/ovpn/template/server-openvpn.conf index 67dc987..7935e8a 100644 --- a/ovpn/template/server-openvpn.conf +++ b/ovpn/template/server-openvpn.conf @@ -12,7 +12,7 @@ keepalive 10 60 persist-key persist-tun -proto udp +proto txqueuelen 5000 tun-mtu 1300