support old getent implementation

This commit is contained in:
Andy 2018-07-10 13:18:08 +02:00
parent 9229ff93e5
commit c17a7b98b6
Signed by: arno
GPG Key ID: 9076D5E6B31AE99C

View File

@ -176,7 +176,8 @@ extendedKeyUsage = serverAuth"
# Gather IPs for SAN
i=1
IPS="$(getent ahostsv4 $(hostname) | awk '{print $1}' |sort | uniq)"
IPS="$( (getent ahostsv4 $(hostname) 2>/dev/null || getent hosts $(hostname) 2>/dev/null) | awk '{print $1}' |sort | uniq)"
echo "[${ME}] Found these IPs: " ${IPS}
PAYLOAD="subjectAltName = @alt_names\n[ alt_names ]\n$(for IP in $IPS; do echo "IP.${i} = ${IP}" ; i=$((i + 1)); done)"
fi