#!/bin/bash # # Get an OpenVPN client configuration file # set -ex source "$OPENVPN/ovpn_env.sh" cn=$1 if [ ! -f "$EASYRSA_PKI/private/${cn}.key" ]; then echo "Unable to find ${cn}, please try again or generate the key first" exit 1 fi cat < $(cat $EASYRSA_PKI/private/${cn}.key) $(cat $EASYRSA_PKI/issued/${cn}.crt) $(cat $EASYRSA_PKI/ca.crt) $(cat $EASYRSA_PKI/dh.pem) $(cat $EASYRSA_PKI/ta.key) key-direction 1 remote $OVPN_CN $OVPN_PORT $OVPN_PROTO EOF if [ "$OVPN_DEFROUTE" != "0" ];then echo "redirect-gateway def1" fi [ -n "$OVPN_MTU" ] && echo "tun-mtu $OVPN_MTU"