Commit 360cc6d1 authored by Matthew Smith's avatar Matthew Smith
Browse files

Can build certs with questions or paramaters

parent ddf98f07
......@@ -28,6 +28,20 @@ function ask_key_questions
read -p "Users E-mail address for certificate: " OVPN_EMAIL
}
function allocate_ip {
if [ -z $ALLOCATEIP ]; then
read -p "Do you want to allocate a static VPN IP to the client for firewalling? (y/n)" ALLOCATEIP
fi
if [ "$ALLOCATEIP" = "yes" ]; then
export $OVPN_ORGNICK
/usr/lib/openvpn-server/ovs-commands/make-static-ip $OVPN_COMMONNAME
else
echo -n
fi
}
# make_pkcs12
# Generate a PKCS12 certificate bundle from the given
# parameters, and utilising the openvpn-server generated default files (CA,
......
......@@ -28,7 +28,12 @@ pushd $WORKDIR >/dev/null
mkdir -p DEBIAN etc/openvpn
ask_key_questions
if [ -z $1 ] || [ -z $2 ] ; then
ask_key_questions
else
OVPN_COMMONNAME=$1
OVPN_EMAIL=$2
fi
FILEBASE=`echo "${OVPN_ORGNICK}-${OVPN_COMMONNAME}"`
# deb files can only contain a-z and - so lets just fix the deb file, the name would need to be pretty screwed to fail or duplicate
......@@ -65,12 +70,4 @@ fi
rm -rf $WORKDIR
read -p "Do you want to allocate a static VPN IP to the client for firewalling? (y/n)" ALLOCATEIPYN
if [ "$ALLOCATEIPYN" = "y" ]
then
export $OVPN_ORGNICK
/usr/lib/openvpn-server/ovs-commands/make-static-ip $OVPN_COMMONNAME
else
echo -n
fi
allocate_ip()
......@@ -25,7 +25,12 @@ WORKDIR=$(mktemp -d)
pushd $WORKDIR >/dev/null
ask_key_questions
if [ -z $1 ] || [ -z $2 ] ; then
ask_key_questions
else
OVPN_COMMONNAME=$1
OVPN_EMAIL=$2
fi
FILEBASE="${OVPN_ORGNICK}-${OVPN_COMMONNAME}"
......@@ -61,9 +66,11 @@ fi
rm -rf $WORKDIR
read -p "Do you want to email this .ovpn file now (y/n)" EMAIL
if [ "$EMAIL" = "y" ]
then
if [ -z $1 ]; then
read -p "Do you want to email this .ovpn file now (y/n)" EMAIL
fi
if [ "$EMAIL" = "y" ]; then
read -p "Users E-mail address to send .ovpn file: " EMAILADDRESS
......@@ -81,14 +88,6 @@ else
echo -n
fi
read -p "Do you want to allocate a static VPN IP to the client for firewalling? (y/n)" ALLOCATEIPYN
if [ "$ALLOCATEIPYN" = "y" ]
then
export $OVPN_ORGNICK
/usr/lib/openvpn-server/ovs-commands/make-static-ip $OVPN_COMMONNAME
else
echo -n
fi
allocate_ip()
echo "Your OpenVPN config file is $OVPNFILE"
......@@ -22,7 +22,12 @@ WORKDIR=$(mktemp -d)
pushd $WORKDIR >/dev/null
ask_key_questions
if [ -z $1 ] || [ -z $2 ] ; then
ask_key_questions
else
OVPN_COMMONNAME=$1
OVPN_EMAIL=$2
fi
FILEBASE="${OVPN_ORGNICK}-${OVPN_COMMONNAME}"
......@@ -53,15 +58,6 @@ fi
rm -rf $WORKDIR
#/usr/lib/openvpn-server/ovs-commands/umount-ca-store
read -p "Do you want to allocate a static VPN IP to the client for firewalling? (y/n)" ALLOCATEIPYN
if [ "$ALLOCATEIPYN" = "y" ]
then
export $OVPN_ORGNICK
/usr/lib/openvpn-server/ovs-commands/make-static-ip $OVPN_COMMONNAME
else
echo -n
fi
allocate_ip()
......@@ -25,7 +25,12 @@ WORKDIR=$(mktemp -d)
pushd $WORKDIR >/dev/null
ask_key_questions
if [ -z $1 ] || [ -z $2 ] ; then
ask_key_questions
else
OVPN_COMMONNAME=$1
OVPN_EMAIL=$2
fi
FILEBASE="${OVPN_ORGNICK}-${OVPN_COMMONNAME}"
......@@ -46,14 +51,6 @@ fi
rm -rf $WORKDIR
read -p "Do you want to allocate a static VPN IP to the client for firewalling? (y/n)" ALLOCATEIPYN
if [ "$ALLOCATEIPYN" = "y" ]
then
export $OVPN_ORGNICK
/usr/lib/openvpn-server/ovs-commands/make-static-ip $OVPN_COMMONNAME
else
echo -n
fi
allocate_ip()
echo "Your OpenVPN config files are in openvpn-${FILEBASE}.zip"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment