1
0
mirror of synced 2024-11-23 05:26:02 +03:00

Update IKEv2 script

- Sort IKEv2 client names when listing existing clients
- Cleanup
This commit is contained in:
hwdsl2 2022-01-04 23:10:28 -06:00
parent c25baaf9a9
commit abbf19f296

View File

@ -153,7 +153,7 @@ check_container() {
show_header() { show_header() {
cat <<'EOF' cat <<'EOF'
IKEv2 Script Copyright (c) 2020-2021 Lin Song 29 Dec 2021 IKEv2 Script Copyright (c) 2020-2022 Lin Song 4 Jan 2022
EOF EOF
} }
@ -391,7 +391,7 @@ list_existing_clients() {
[ "$max_len" -lt "16" ] && max_len=16 [ "$max_len" -lt "16" ] && max_len=16
printf "%-${max_len}s %s\n" 'Client Name' 'Certificate Status' printf "%-${max_len}s %s\n" 'Client Name' 'Certificate Status'
printf "%-${max_len}s %s\n" '------------' '-------------------' printf "%-${max_len}s %s\n" '------------' '-------------------'
printf '%s\n' "$client_names" | while read -r line; do printf '%s\n' "$client_names" | LC_ALL=C sort | while read -r line; do
printf "%-${max_len}s " "$line" printf "%-${max_len}s " "$line"
client_status=$(certutil -V -u C -d sql:/etc/ipsec.d -n "$line" | grep -o -e ' valid' -e expired -e revoked | sed -e 's/^ //') client_status=$(certutil -V -u C -d sql:/etc/ipsec.d -n "$line" | grep -o -e ' valid' -e expired -e revoked | sed -e 's/^ //')
[ -z "$client_status" ] && client_status=unknown [ -z "$client_status" ] && client_status=unknown
@ -643,7 +643,6 @@ confirm_setup_options() {
cat <<EOF cat <<EOF
We are ready to set up IKEv2 now. Below are the setup options you selected. We are ready to set up IKEv2 now. Below are the setup options you selected.
Please double check before continuing!
====================================== ======================================
@ -1309,6 +1308,7 @@ ikev2setup() {
if [ "$list_clients" = "1" ]; then if [ "$list_clients" = "1" ]; then
show_header show_header
list_existing_clients list_existing_clients
echo
exit 0 exit 0
fi fi
@ -1362,6 +1362,7 @@ ikev2setup() {
3) 3)
echo echo
list_existing_clients list_existing_clients
echo
exit 0 exit 0
;; ;;
4) 4)