一个自动生成OpenVPN证书的脚本

用下面这个脚本可以自动生成OpenVPN证书,省去了每次都要手动输入一堆命令的烦锁。

#########################################################################
# Author: pengjianqing@gmail.com
# Created Time: Tue 23 Mar 2010 09:27:16 PM CST
# File Name: createkeys.sh
# Description: 
#########################################################################
#!/bin/bash
echo "Create OpenVPN keys"

echo "source vars"
source vars


FILE=${1}

echo "mkdir -p ${FILE}"
mkdir -p ${FILE}



./build-key ${FILE}

cp keys/ca.crt ${FILE}
cp keys/${FILE}.crt ${FILE}/client.crt
cp keys/${FILE}.key ${FILE}/client.key
cp keys/client.conf ${FILE}

#cp keys/${FILE}.crt ${FILE}
#cp keys/${FILE}.key ${FILE}
#cp keys/client.conf ${FILE}
#sed -i 's/client.crt/${FILE}.crt/g' ${FILE}/client.conf
#sed -i 's/client.key/${FILE}.key/g' ${FILE}/client.conf