Skip to content

Commit

Permalink
Merge pull request #3006 from wazuh/bug/2371-fix-certs-generation-mul…
Browse files Browse the repository at this point in the history
…ti-dns

Added check when generating certificates for multiple DNS
  • Loading branch information
teddytpc1 authored Jun 25, 2024
2 parents b818579 + 94f995b commit c4e499b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions unattended_installer/cert_tool/certFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,15 @@ function cert_readConfig() {

for ip in "${all_ips[@]}"; do
isIP=$(echo "${ip}" | grep -P "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$")
isDNS=$(echo "${ip}" | grep -P "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\.([A-Za-z]{2,})$" )
if [[ -n "${isIP}" ]]; then
if ! cert_checkPrivateIp "$ip"; then
common_logger -e "The IP ${ip} is public."
exit 1
fi
elif [[ -n "${isDNS}" ]]; then
common_logger -e "The DNS ${ip} is not valid."
exit 1
fi
done

Expand Down

0 comments on commit c4e499b

Please sign in to comment.