From fef608a91aa88b8fea28660625905bece7647c0b Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Wed, 19 Oct 2022 00:31:52 -0500 Subject: [PATCH] Update IKEv2 script - Cleanup --- extras/ikev2setup.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index 7d7d47c..35e729d 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -157,7 +157,7 @@ confirm_or_abort() { show_header() { cat <<'EOF' -IKEv2 Script Copyright (c) 2020-2022 Lin Song 16 Oct 2022 +IKEv2 Script Copyright (c) 2020-2022 Lin Song 19 Oct 2022 EOF } @@ -423,12 +423,13 @@ list_existing_clients() { printf "%-${max_len}s %s\n" 'Client Name' 'Certificate Status' printf "%-${max_len}s %s\n" '------------' '-------------------' if [ -n "$client_names" ]; then - printf '%s\n' "$client_names" | LC_ALL=C sort | while read -r line; do + client_list=$(printf '%s\n' "$client_names" | LC_ALL=C sort) + while IFS= read -r line; do printf "%-${max_len}s " "$line" client_status=$(certutil -V -u C -d "$CERT_DB" -n "$line" | grep -o -e ' valid' -e expired -e revoked | sed -e 's/^ //') [ -z "$client_status" ] && client_status=unknown printf '%s\n' "$client_status" - done + done <<< "$client_list" fi client_count=$(printf '%s\n' "$client_names" | wc -l 2>/dev/null) [ -z "$client_names" ] && client_count=0 @@ -706,10 +707,9 @@ EOF done } -print_server_client_info() { +print_server_info() { cat </dev/null - done + done <<< "$cert_list" crlutil -D -d "$CERT_DB" -n "$CA_NAME" 2>/dev/null certutil -F -d "$CERT_DB" -n "$CA_NAME" certutil -D -d "$CERT_DB" -n "$CA_NAME" 2>/dev/null