[openssh-commits] [openssh] 02/02: upstream: hostname is not specified by POSIX but uname -n is, so use

Darren Tucker dtucker at dtucker.net
Tue Feb 9 20:14:31 AEDT 2021


On Tue, 9 Feb 2021 at 19:05, Jochen Bern <Jochen.Bern at binect.de> wrote:
[...]
> Out of interest, what *purpose* is the obtained hostname being used for?

For the case that started this thread, it's used for expanding "%"
tokens in the config file.  From ssh_config(5):

TOKENS
     Arguments to some keywords can make use of tokens, which are expanded at
     runtime:
[...]
           %L    The local hostname.
           %l    The local hostname, including the domain name.

These can be used by various keywords, typically for file paths (for
example, if you want to make a ControlPath unique to a hostname).  I'd
have to check the code history to figure out where each token
originally came from, but I made them all more or less consistent
between the 8.2 and 8.3 releases.

> Does OpenSSH actually *need* it to be a) unique, b) reproducible, and/or
> c) a proper FQDN

Depends on what the user uses them for, but typically as long as
they're reproducible and unique within a set of machines that share a
filesystem it would likely be sufficient.

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list