wmdeit-cf-wmdelib/scripts/get-domains-from-cert.sh

12 lines
281 B
Bash
Raw Normal View History

2023-10-31 23:31:26 +00:00
#!/bin/sh
#!/bin/sh
# Check for the presence of the certificate file
if [ ! -f "$1" ]; then
exit 0
fi
# Extract subjectAltName from the certificate
openssl x509 -in "$1" -text -noout | grep -E -o "DNS:[^,]*" | sed 's/DNS://g' | tr -d ' ' | tr ',' ' ' | sort | tr '\n' ' '