#!/bin/sh # put me in /usr/local/bin FROMBASE=./keys TOBASE=./keys/packages COMMON=$1 TAR=$TOBASE/$COMMON.tar USER=$SUDO_USER CLIENT=client if [ ! $1 ]; then echo "no common name given" exit 1 fi if [ ! -f $TAR ]; then cd /usr/local/share/doc/openvpn/easy-rsa/2.0 . ./vars ./pkitool $COMMON mv $FROMBASE/$COMMON.key $FROMBASE/$CLIENT.key mv $FROMBASE/$COMMON.crt $FROMBASE/$CLIENT.crt tar -cf $TAR \ $FROMBASE/ca.crt \ $FROMBASE/$CLIENT.key \ $FROMBASE/$CLIENT.crt \ $FROMBASE/client.conf \ $FROMBASE/up.sh cp $TAR /home/$USER/$COMMON.tar chown $USER /home/$USER/$COMMON.tar else echo "$TAR was already created" exit 1 fi