Last active
June 7, 2016 08:57
-
-
Save varnav/55dd357b611809323559265c74dbc302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ $# -eq 0 ] && { echo "Usage: $0 username"; exit 1; } | |
if [ -d "/opt/clientconfig/$1/" ]; then | |
echo "Already exists" | |
exit 1 | |
fi | |
cd /opt/client-ca | |
source vars | |
KEY_EXPIRE=183 | |
./build-key $1 | |
cd /opt/clientconfig | |
mkdir $1 | |
cd $1 | |
cp /opt/client-ca/keys/$1.key /opt/clientconfig/$1/$1.key | |
cp /opt/client-ca/keys/$1.crt /opt/clientconfig/$1/$1.crt | |
cp /etc/openvpn/keys/ta.key /opt/clientconfig/$1/ | |
cp /opt/ca.crt /opt/clientconfig/$1/ | |
cp /opt/base.ovpn /opt/clientconfig/$1/$1.ovpn | |
sed -i "s/to_be_replaced/$1/g" /opt/clientconfig/$1/$1.ovpn | |
cd /opt/clientconfig/$1/ | |
zip -r $1.zip . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment