1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/openvpn/setup.sh

38 lines
969 B
Bash
Raw Normal View History

2015-07-06 02:35:53 +02:00
#!/bin/bash
#
2016-09-19 07:04:07 +02:00
# setup script for kylemanna/openvpn
2015-07-06 02:35:53 +02:00
#
2015-07-16 11:55:42 +02:00
OVPN_DIR=./ovpn
2016-09-02 06:23:56 +02:00
OVPN_SERVER=tcp://openvpn.easypi.info
2015-07-06 02:35:53 +02:00
2015-07-16 11:55:42 +02:00
mkdir -p $OVPN_DIR
2016-09-02 06:23:56 +02:00
select opt in server client revoke quit
2015-07-06 02:35:53 +02:00
do
if [[ $opt == "server" ]]
then
echo "setup server ..."
2016-09-02 06:23:56 +02:00
docker-compose run --rm openvpn ovpn_genconfig -u $OVPN_SERVER
docker-compose run --rm openvpn ovpn_initpki
2015-07-06 02:35:53 +02:00
elif [[ $opt == "client" ]]
then
echo "setup client ..."
2015-07-16 11:55:42 +02:00
read -p '>>> ' OVPN_CLIENT
2016-09-02 06:23:56 +02:00
docker-compose run --rm openvpn easyrsa build-client-full ${OVPN_CLIENT:?client is empty} nopass
docker-compose run --rm openvpn ovpn_getclient $OVPN_CLIENT > $OVPN_DIR/$OVPN_CLIENT.ovpn
2015-09-01 05:00:28 +02:00
elif [[ $opt == "revoke" ]]
then
2016-09-02 06:23:56 +02:00
echo "revoke client ..."
2015-09-01 05:00:28 +02:00
read -p '>>> ' OVPN_CLIENT
2016-09-02 06:23:56 +02:00
docker-compose run --rm openvpn easyrsa revoke ${OVPN_CLIENT:?client is empty}
docker-compose run --rm openvpn easyrsa gen-crl
2015-07-06 02:35:53 +02:00
elif [[ $opt == "quit" ]]
then
echo "bye"
exit
else
echo "invalid"
fi
done