Thomas Pircher <[email protected]> wrote:
> On 2026-09-30 15:22, Chris Green wrote:
> > Thomas Pircher <[email protected]> wrote:
> >> What does not work exactly?
> >     chris$ ypdomainname
> >     chris$ domainname
> >     chris$ dnsdomainname
> 
> ypdomainname and domainname relate to NIS, as Greg already pointed out. 
> This is not related to the DNS domain name.
> The dnsdomainname and hostname --fqdn commands will give you a more 
> useful answer, given you r configuration.
> 
> >> Is there a reason you use 127.0.1.1 instead of the more commonly used
> >> value 127.0.0.1?
> >> 
> > It's what a Debian 13 installation produces, I have 127.0.0.1 as
> > localhost (see above).
> 
> Yes, ignore what I wrote here. I was about 20 years out of date with my 
> comment.
> 
> > However things like postfix and others use ypdomainname/domainname to 
> > get the domain.
> 
> Postfix's documentation says it uses the fully-qualified domain name 
> from gethostname(2). This is slightly confusing, as I would expect that 
> to return just the hostname. If it wanted the DNS domain name, it would 
> have to resolve it using e.g. getaddrinfo(3).
> 
> This all sounds very brittle to me. Please consider setting `mydomain` 
> or `myhostname` in the Postfix configuration explicitly. You want to be 
> in control of this information, if your mail server is public facing.
> 
Yes, I've decided that's the way to go, set mydomain in the postfix
configuration. 

The only (very slight) downside is that I have one system with an
otherwise identical main.cf which isn't on my LAN and thus needs a
different mydomain value.  Wherever possible I keep configurations the
same for ease of maintenance.

> Also see the discussion in "THE FQDN" in the man page of hostname(2): a 
> given machine can have zero, one or more domain names.
> 
> Thomas

-- 
Chris Green
ยท

Reply via email to