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

Update IKEv2 script

- Check certificate status when exporting a client configuration
  using --exportclient
This commit is contained in:
hwdsl2 2021-06-01 23:35:19 -05:00
parent 5adaa29947
commit 811ce6a9aa

View File

@ -193,6 +193,17 @@ check_arguments() {
|| ! check_client_cert_exists; then || ! check_client_cert_exists; then
exiterr "Invalid client name, or client does not exist." exiterr "Invalid client name, or client does not exist."
fi fi
if ! check_client_cert_status; then
printf '%s' "Error: Certificate '$client_name' " >&2
if printf '%s' "$cert_status" | grep -q "revoked"; then
echo "has been revoked." >&2
elif printf '%s' "$cert_status" | grep -q "expired"; then
echo "has expired." >&2
else
echo "is invalid." >&2
fi
exit 1
fi
fi fi
if [ "$list_clients" = "1" ]; then if [ "$list_clients" = "1" ]; then
check_ikev2_exists || exiterr "You must first set up IKEv2 before listing clients." check_ikev2_exists || exiterr "You must first set up IKEv2 before listing clients."
@ -206,13 +217,15 @@ check_arguments() {
exiterr "Invalid client name, or client does not exist." exiterr "Invalid client name, or client does not exist."
fi fi
if ! check_client_cert_status; then if ! check_client_cert_status; then
printf '%s' "Error: Certificate '$client_name' " >&2
if printf '%s' "$cert_status" | grep -q "revoked"; then if printf '%s' "$cert_status" | grep -q "revoked"; then
exiterr "Certificate '$client_name' has already been revoked." echo "has already been revoked." >&2
elif printf '%s' "$cert_status" | grep -q "expired"; then elif printf '%s' "$cert_status" | grep -q "expired"; then
exiterr "Certificate '$client_name' has expired." echo "has expired." >&2
else else
exiterr "Certificate '$client_name' is invalid." echo "is invalid." >&2
fi fi
exit 1
fi fi
fi fi
if [ "$remove_ikev2" = "1" ]; then if [ "$remove_ikev2" = "1" ]; then