2015-03-08 21:40:08 +00:00
|
|
|
#!/bin/bash
|
2015-05-12 19:24:59 +00:00
|
|
|
## @licence MIT <http://opensource.org/licenses/MIT>
|
2015-03-08 21:40:08 +00:00
|
|
|
## @author Copyright (C) 2015 Robin Schneider <ypid@riseup.net>
|
|
|
|
|
2015-03-12 22:07:34 +00:00
|
|
|
if [ -z "$OPENVPN" ]; then
|
|
|
|
export OPENVPN="$PWD"
|
|
|
|
fi
|
|
|
|
if ! source "$OPENVPN/ovpn_env.sh"; then
|
|
|
|
echo "Could not source $OPENVPN/ovpn_env.sh."
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-03-08 21:40:08 +00:00
|
|
|
|
|
|
|
TARGET="/tmp/openvpn_${OVPN_CN}"
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
TARGET="$1"
|
2015-03-12 22:07:34 +00:00
|
|
|
else
|
|
|
|
TARGET="$OPENVPN/server"
|
2015-03-08 21:40:08 +00:00
|
|
|
fi
|
|
|
|
|
2015-05-30 22:45:16 +00:00
|
|
|
echo "
|
|
|
|
pki/private/${OVPN_CN}.key
|
|
|
|
pki/issued/${OVPN_CN}.crt
|
|
|
|
pki/dh.pem
|
|
|
|
pki/ta.key
|
|
|
|
pki/ca.crt
|
|
|
|
" | rsync --recursive --verbose \
|
|
|
|
--files-from - \
|
2015-03-12 22:49:49 +00:00
|
|
|
"$OPENVPN/" "$TARGET"
|
2015-05-30 22:45:16 +00:00
|
|
|
ln --symbolic --force ../openvpn.conf ../ovpn_env.sh "$TARGET"
|
2015-03-08 21:40:08 +00:00
|
|
|
|
|
|
|
echo "Created the openvpn configuration for the server: $TARGET"
|