@@ -64,18 +64,29 @@ for file in `ls -1 $EASY_RSA/openssl*.cnf | xargs` ; do
64
64
$SUDO sed -i -e ' s/^\(subjectAltName=.*\)$/#\1/' $file
65
65
done
66
66
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
73
67
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
79
90
80
91
#
81
92
# 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
84
95
for node in $NODES ; do
85
96
nf=` getfqdn $node `
86
97
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
88
104
done
89
105
90
106
unset KEY_COUNTRY
0 commit comments