From 2abbcf19997e03ee7e070bc9db077dc3e02d70b0 Mon Sep 17 00:00:00 2001 From: Christian Tawfik Date: Fri, 27 Nov 2015 15:02:33 +0100 Subject: [PATCH 1/3] added config param to enable COMP-LZO compression --- bin/ovpn_genconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/ovpn_genconfig b/bin/ovpn_genconfig index 558d907..b430778 100755 --- a/bin/ovpn_genconfig +++ b/bin/ovpn_genconfig @@ -49,6 +49,7 @@ usage() { echo " -T Encrypt packets with the given cipher algorithm instead of the default one (tls-cipher)." echo " -C A list of allowable TLS ciphers delimited by a colon (cipher)." echo " -a Authenticate packets with HMAC using the given message digest algorithm (auth)." + echo " -z Enable comp-lzo compression." } if [ "$DEBUG" == "1" ]; then @@ -78,7 +79,7 @@ OVPN_AUTH='' [ -r "$OVPN_ENV" ] && source "$OVPN_ENV" # Parse arguments -while getopts ":a:C:T:r:s:du:cp:n:DNm:t" opt; do +while getopts ":a:C:T:r:s:du:cp:n:DNm:t:z" opt; do case $opt in a) OVPN_AUTH="$OPTARG" @@ -122,6 +123,9 @@ while getopts ":a:C:T:r:s:du:cp:n:DNm:t" opt; do t) OVPN_DEVICE="tap" ;; + z) + OVPN_COMP_LZO=1 + ;; \?) set +x echo "Invalid option: -$OPTARG" >&2 @@ -167,6 +171,7 @@ export OVPN_SERVER OVPN_ROUTES OVPN_DEFROUTE export OVPN_SERVER_URL OVPN_ENV OVPN_PROTO OVPN_CN OVPN_PORT export OVPN_CLIENT_TO_CLIENT OVPN_PUSH OVPN_NAT OVPN_DNS OVPN_MTU OVPN_DEVICE export OVPN_TLS_CIPHER OVPN_CIPHER OVPN_AUTH +export OVPN_COMP_LZO # Preserve config if [ -f "$OVPN_ENV" ]; then @@ -211,6 +216,7 @@ EOF [ -n "$OVPN_AUTH" ] && echo "auth $OVPN_AUTH" >> "$conf" [ -n "$OVPN_CLIENT_TO_CLIENT" ] && echo "client-to-client" >> "$conf" +[ -n "$OVPN_COMP_LZO" ] && echo "comp-lzo" >> "$conf" [ "$OVPN_DNS" == "1" ] && for i in "${OVPN_DNS_SERVERS[@]}"; do echo "push dhcp-option DNS $i" >> "$conf" From 2650d4a286435e9168a11b7081778f9af4029007 Mon Sep 17 00:00:00 2001 From: Christian Tawfik Date: Fri, 27 Nov 2015 15:03:35 +0100 Subject: [PATCH 2/3] COMP-lzo param is set in client config, if defined in server. --- bin/ovpn_getclient | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/ovpn_getclient b/bin/ovpn_getclient index bc32942..1c029c9 100755 --- a/bin/ovpn_getclient +++ b/bin/ovpn_getclient @@ -84,6 +84,10 @@ $OVPN_ADDITIONAL_CLIENT_CONFIG if [ -n "$OVPN_AUTH" ]; then echo "auth $OVPN_AUTH" fi + + if [ -n "$OVPN_COMP_LZO" ]; then + echo "comp-lzo" + fi } dir="$OPENVPN/clients/$cn" From 2fa3abe064d95fa415c86a10cb10e11592ec4f10 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 29 Nov 2015 04:49:24 +0100 Subject: [PATCH 3/3] fixed getopts argument typo. removed ":" before "z" --- bin/ovpn_genconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ovpn_genconfig b/bin/ovpn_genconfig index b430778..a809260 100755 --- a/bin/ovpn_genconfig +++ b/bin/ovpn_genconfig @@ -79,7 +79,7 @@ OVPN_AUTH='' [ -r "$OVPN_ENV" ] && source "$OVPN_ENV" # Parse arguments -while getopts ":a:C:T:r:s:du:cp:n:DNm:t:z" opt; do +while getopts ":a:C:T:r:s:du:cp:n:DNm:tz" opt; do case $opt in a) OVPN_AUTH="$OPTARG"