On 09.02.21 01:25, Nico Kadel-Garcia wrote: > On Mon, Feb 8, 2021 at 3:59 PM Bob Proulx <bob@xxxxxxxxxx> wrote: >> The hostname -f option is a "new-ish" Linux specific option. It's not >> portable. And because it works by doing a reverse DNS lookup it >> depends upon live network connectivity at that moment working for the >> network lookup and the results are spotty depending upon how DNS is >> set up and how many IP addresses are configured on the host. > > It looks in /etc/hosts first, which works very well when DNS is > unavailable and when the host his publishing a dynamic DNS entry. Suffice to say that I added a check to our monitoring so as to detect machines entering production where `hostname`, not to even mention /etc/hosts, still returns "localhost.localdomain" or even just "localhost" instead of something unique. Out of interest, what *purpose* is the obtained hostname being used for? Does OpenSSH actually *need* it to be a) unique, b) reproducible, and/or c) a proper FQDN, or does it merely enter the comment of autogenerated host keypairs? All the KnownHosts checking AFAIR happens on the *client* side and uses whatever name(s) of the server are known *there* ... Regards, -- Jochen Bern Systemingenieur Binect GmbH
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev