Don't reverse resolve CNAMEs when advertising our SSHD

If the sshd.listenAddress has been configured to a CNAME, because
that is the name that clients should create "Host" configuration
blocks in ~/.ssh/config with, Gerrit must ensure we advertise the
CNAME in the server host key display, and in the output of the
/ssh_info URL for "repo upload".  If we force the host name into
a canonical host name, we'll actually do the reverse lookup on
the IP and potentially get a different hostname than the one we
were supplied in the configuration file, causing clients to see
an address that the administrator was trying to hide.

Signed-off-by: Shawn O. Pearce <>
3 files changed