Improve determination of external IP addresses for certificate checks