Skip to content

Commit e9c3c39

Browse files
committed
Add support for easy-rsa v3.
1 parent a48e2e1 commit e9c3c39

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

setup-self-signed-ssl.sh

+28-12
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,29 @@ for file in `ls -1 $EASY_RSA/openssl*.cnf | xargs` ; do
6464
$SUDO sed -i -e 's/^\(subjectAltName=.*\)$/#\1/' $file
6565
done
6666

67-
$SUDO ./clean-all
68-
$SUDO ./build-ca
69-
# We needed a CN for the CA build -- but now we have to drop it cause
70-
# the build-key* scripts don't want it set -- they set it to the first arg,
71-
# and behave badly if it IS set.
72-
unset KEY_CN
7367
hf=`getfqdn $HEAD`
74-
$SUDO ./build-key-server $hf
75-
$SUDO cp -p $KEY_DIR/$hf.crt $KEY_DIR/$hf.key $KEY_DIR/ca.crt $EASY_RSA
76-
77-
$SUDO ./build-dh
78-
$SUDO cp -p $KEY_DIR/dh2048.pem $EASY_RSA
68+
if [ -x ./build-ca ]; then
69+
$SUDO ./clean-all
70+
$SUDO ./build-ca
71+
# We needed a CN for the CA build -- but now we have to drop it cause
72+
# the build-key* scripts don't want it set -- they set it to the first arg,
73+
# and behave badly if it IS set.
74+
unset KEY_CN
75+
$SUDO ./build-key-server $hf
76+
$SUDO cp -p $KEY_DIR/$hf.crt $KEY_DIR/$hf.key $KEY_DIR/ca.crt $EASY_RSA
77+
78+
$SUDO ./build-dh
79+
$SUDO cp -p $KEY_DIR/dh2048.pem $EASY_RSA
80+
else
81+
$SUDO ./easyrsa --batch init-pki
82+
$SUDO ./easyrsa --batch build-ca nopass
83+
unset KEY_CN
84+
$SUDO ./easyrsa --batch build-server-full $hf nopass
85+
$SUDO cp -p $EASY_RSA/pki/ca.crt $EASY_RSA/pki/issued/$hf.crt $EASY_RSA/pki/private/$hf.key $EASY_RSA
86+
87+
$SUDO ./easyrsa --batch gen-dh
88+
$SUDO cp -p $EASY_RSA/pki/dh.pem $EASY_RSA
89+
fi
7990

8091
#
8192
# Now build keys and set static IPs for the controller and the
@@ -84,7 +95,12 @@ $SUDO cp -p $KEY_DIR/dh2048.pem $EASY_RSA
8495
for node in $NODES ; do
8596
nf=`getfqdn $node`
8697
export KEY_CN="$nf"
87-
$SUDO ./build-key $nf
98+
if [ -x ./build-key ]; then
99+
$SUDO ./build-key $nf
100+
else
101+
$SUDO ./easyrsa --batch build-client-full $nf nopass
102+
$SUDO cp -p $EASY_RSA/pki/issued/$hf.crt $EASY_RSA/pki/private/$hf.key $EASY_RSA
103+
fi
88104
done
89105

90106
unset KEY_COUNTRY

0 commit comments

Comments
 (0)