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

12 lines
281 B
Bash

#!/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' ' '