Prechádzať zdrojové kódy

HPCC-23733 Should still generate public.key.pem file

- Add commands to generate the public key file from the private key file

Signed-off-by: Yanrui Ma <yanrui.ma@lexisnexisrisk.com>
Yanrui Ma 5 rokov pred
rodič
commit
43d0a0581d
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  1. 3 2
      initfiles/bash/etc/init.d/setupPKI.in

+ 3 - 2
initfiles/bash/etc/init.d/setupPKI.in

@@ -84,7 +84,7 @@ for i in "" ${compArray[@]} ; do
         mkdir -p ${certPath}/${compName}
     fi
 
-    if [ "${regenerate}" = "1" ] || [ ! -e ${certPath}/${compName}/key.pem ] || [ ! -e ${certPath}/${compName}/certificate.pem ]; then
+    if [ "${regenerate}" = "1" ] || [ ! -e ${certPath}/${compName}/key.pem ] || [ ! -e ${certPath}/${compName}/certificate.pem ] || [ ! -e ${certPath}/${compName}/public.key.pem ]; then
         if [ "${compName}" != "" ]; then
              cn="${compName}.${domainname}"
         else
@@ -95,7 +95,8 @@ for i in "" ${compArray[@]} ; do
         rm -rf ${certPath}/${compName}/key.pem ${certPath}/${compName}/certificate.pem
         openssl req -nodes -newkey rsa:2048 -keyout ${certPath}/${compName}/key.pem -out ${certPath}/${compName}/my.csr -subj "${compSubject}"
         chmod 400 ${certPath}/${compName}/key.pem
-        printf "PKI key installed for user %-32s component %-15s ..." "${USER_NAME}" "${compNamePrint}"
+        openssl rsa -in ${certPath}/${compName}/key.pem -pubout -out ${certPath}/${compName}/public.key.pem
+        printf "PKI keys installed for user %-32s component %-15s ..." "${USER_NAME}" "${compNamePrint}"
         log_success_msg
         openssl x509 -req -days 365 -in ${certPath}/${compName}/my.csr -CA ${certPath}/cacert.pem -CAkey ${certPath}/cacert-key.pem -sha256 -CAcreateserial -CAserial ca.seq -out ${certPath}/${compName}/certificate.pem
         rm ${certPath}/${compName}/my.csr