1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-29 18:21:24 +00:00

update setup.sh

This commit is contained in:
kev 2015-09-01 11:00:28 +08:00
parent 6b5728d5c6
commit 68d30e3bcc
2 changed files with 14 additions and 7 deletions

@ -68,8 +68,10 @@ $ fig up -d data
$ ./setup.sh $ ./setup.sh
1) server 1) server
2) client 2) client
3) backup 3) revoke
4) quit 4) backup
5) restore
6) quit
$ fig up -d $ fig up -d
``` ```

@ -11,19 +11,24 @@ OVPN_SERVER=tcp://vpn.datageek.info
mkdir -p $OVPN_DIR mkdir -p $OVPN_DIR
select opt in server client backup restore quit select opt in server client revoke backup restore quit
do do
if [[ $opt == "server" ]] if [[ $opt == "server" ]]
then then
echo "setup server ..." echo "setup server ..."
docker run --volumes-from $OVPN_DATA --rm $OVPN_IMG ovpn_genconfig -u $OVPN_SERVER docker run --rm --volumes-from $OVPN_DATA $OVPN_IMG ovpn_genconfig -u $OVPN_SERVER
docker run --volumes-from $OVPN_DATA --rm -it $OVPN_IMG ovpn_initpki docker run -it --rm --volumes-from $OVPN_DATA $OVPN_IMG ovpn_initpki
elif [[ $opt == "client" ]] elif [[ $opt == "client" ]]
then then
echo "setup client ..." echo "setup client ..."
read -p '>>> ' OVPN_CLIENT read -p '>>> ' OVPN_CLIENT
docker run --volumes-from $OVPN_DATA --rm -it $OVPN_IMG easyrsa build-client-full ${OVPN_CLIENT:?client is empty} nopass docker run -it --rm --volumes-from $OVPN_DATA $OVPN_IMG easyrsa build-client-full ${OVPN_CLIENT:?client is empty} nopass
docker run --volumes-from $OVPN_DATA --rm $OVPN_IMG ovpn_getclient $OVPN_CLIENT > $OVPN_DIR/$OVPN_CLIENT.ovpn docker run --rm --volumes-from $OVPN_DATA $OVPN_IMG ovpn_getclient $OVPN_CLIENT > $OVPN_DIR/$OVPN_CLIENT.ovpn
elif [[ $opt == "revoke" ]]
then
read -p '>>> ' OVPN_CLIENT
docker run -it --rm --volumes-from $OVPN_DATA $OVPN_IMG easyrsa revoke ${OVPN_CLIENT:?client is empty}
docker run -it --rm --volumes-from $OVPN_DATA $OVPN_IMG easyrsa gen-crl
elif [[ $opt == "backup" ]] elif [[ $opt == "backup" ]]
then then
echo "backup volume ..." echo "backup volume ..."