From f263eb9a6118902a01c768a70c90635da04e18c5 Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Wed, 9 Jul 2014 08:17:19 -0700 Subject: [PATCH] genconfig: Add client-to-client support --- bin/ovpn_genconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/ovpn_genconfig b/bin/ovpn_genconfig index dfaf090..9ff04cc 100755 --- a/bin/ovpn_genconfig +++ b/bin/ovpn_genconfig @@ -39,6 +39,7 @@ usage() { echo echo "optional arguments:" echo " -d Disable NAT routing and default route" + echo " -c Enable client-to-client option" } set -ex @@ -54,7 +55,7 @@ ORIG_OVPN_ROUTES=$OVPN_ROUTES OVPN_ROUTES="" # Parse arguments -while getopts ":r:s:du:" opt; do +while getopts ":r:s:du:c" opt; do case $opt in r) if [ -n "$OVPN_ROUTES" ]; then @@ -72,6 +73,9 @@ while getopts ":r:s:du:" opt; do u) OVPN_SERVER_URL=$OPTARG ;; + c) + OVPN_CLIENT_TO_CLIENT=1 + ;; \?) set +x echo "Invalid option: -$OPTARG" >&2 @@ -114,6 +118,7 @@ fi export OVPN_SERVER OVPN_ROUTES OVPN_DEFROUTE export OVPN_SERVER_URL OVPN_ENV OVPN_PROTO OVPN_CN OVPN_PORT +export OVPN_CLIENT_TO_CLIENT # Preserve config if [ -f "$OVPN_ENV" ]; then @@ -155,6 +160,8 @@ status /tmp/openvpn-status.log client-config-dir $OPENVPN/ccd EOF +[ -n "$OVPN_CLIENT_TO_CLIENT" ] && echo "client-to-client" >> "$conf" + # Append Routes for i in ${OVPN_ROUTES[@]}; do # If user passed "0" skip this, assume no extra routes