#!/bin/bash -
#
#        +-----------------------------------------------------------------------------+
#        | OpenFW UTM Community                                                           |
#        +-----------------------------------------------------------------------------+


if [ "$#" -lt 1 ]; then
    echo "Invalid usage - this script must be triggered by OpenVPN daemon"
    exit 1
fi

config_pathname=$(cd $(dirname "$1"); pwd)/$(basename "$1")
/sbin/jobcontrol call openvpnjob.client_connect --config_pathname "$config_pathname" \
    --common_name "$common_name" \
    --dev "$dev" \
    --local "$ifconfig_pool_remote_ip" \
    --remote "$trusted_ip" \
    --remote_port "$trusted_port"
exit 0
