get_all_keys.sh: fix error in case og old easyrsa layout (revert to previos version).

This commit is contained in:
Christoph 2019-07-16 16:56:06 +02:00
parent 08016ed7b2
commit 53c1600d3c
2 changed files with 26 additions and 12 deletions

Binary file not shown.

View File

@ -253,6 +253,7 @@ else
info "No revoked keys in \033[1m${OPENVPN_REVOKED_KEY_DIR}\033[m for OpenVPN service \033[1m$service_name\033[m exists." info "No revoked keys in \033[1m${OPENVPN_REVOKED_KEY_DIR}\033[m for OpenVPN service \033[1m$service_name\033[m exists."
fi fi
if $EASYRSA_LAYOUT_NEW ; then
while IFS= read -r -d '' _cert ; do while IFS= read -r -d '' _cert ; do
_serial="$(basename "$_cert")" _serial="$(basename "$_cert")"
@ -268,6 +269,19 @@ while IFS= read -r -d '' _cert ; do
fi fi
done < <(find ${OPENVPN_CERT_DIR_SERIAL} -name "*\.pem" -print0 | sort -z ) done < <(find ${OPENVPN_CERT_DIR_SERIAL} -name "*\.pem" -print0 | sort -z )
else
while IFS= read -r -d '' _cert ; do
_serial="$(basename "$_cert")"
_serial="${_serial%.*}"
_cn="$(openssl x509 -noout -text -in $_cert | grep Subject: | grep -oE "CN\s*=\s*[^,]+" | awk '{print$3}')"
all_arr+=("${_serial}:$(trim $_cn)")
if ! containsElement "$_cn" "${revoked_cn_arr[@]}" ; then
active_arr+=("${_serial}:$(trim $_cn)")
fi
done < <(find ${OPENVPN_KEY_DIR} -name "??\.pem" -print0 | sort -z )
fi
if [[ ${#all_arr[@]} -gt 0 ]]; then if [[ ${#all_arr[@]} -gt 0 ]]; then
echo "" echo ""