where is the fqdn coming from

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

where is the fqdn coming from

Matt Zagrabelny
Greetings,

I'm using Postfix 3.3.1-1+b1 (Debian testing).

I'm testing out the default for myhostname and am a little confused as to where it is getting its value. I purposefully did not set it in main.cf:

# grep '^ *myhostname' /etc/postfix/main.cf || echo nope
nope

Here is what postfix believes myhostname to be:

# postconf myhostname
myhostname = net-services.localdomain

I would expect:


Where is the ".localdomain" coming from?

# hostname
net-services

# hostname -f

# cat /etc/hostname
net-services

# grep localdomain /etc/hosts || echo nope
nope

Thanks for any help!

-m
Reply | Threaded
Open this post in threaded view
|

Re: where is the fqdn coming from

Ralph Seichter
* Matt Zagrabelny:

> Where is the ".localdomain" coming from?

It might be read from a file, or it might be set at compile time? The
person packaging Postfix for Debian should know. In any case, the Wiki
article https://wiki.debian.org/Postfix states that you should set the
'myhostname' and 'mydomain' parameters explicitly.

-Ralph
Reply | Threaded
Open this post in threaded view
|

Re: where is the fqdn coming from

Scott Kitterman-4


On November 21, 2018 10:01:41 PM UTC, Ralph Seichter <[hidden email]> wrote:
>* Matt Zagrabelny:
>
>> Where is the ".localdomain" coming from?
>
>It might be read from a file, or it might be set at compile time? The
>person packaging Postfix for Debian should know. In any case, the Wiki
>article https://wiki.debian.org/Postfix states that you should set the
>'myhostname' and 'mydomain' parameters explicitly.

This is Debian specific:

+# Debian GNU/Linux specific:  Specifying a file name will cause the
+# first line of that file to be used as the name.  The Debian default
+# is /etc/mailname.
+# +#myorigin = /etc/mailname

It's been that way for at least 18 years (well before I was involved in maintaining Postfix in Debian).

Scott K
Reply | Threaded
Open this post in threaded view
|

Re: where is the fqdn coming from

Viktor Dukhovni
> On Nov 21, 2018, at 6:25 PM, Scott Kitterman <[hidden email]> wrote:
>
>>> Where is the ".localdomain" coming from?
>>
>> It might be read from a file, or it might be set at compile time? The
>> person packaging Postfix for Debian should know. In any case, the Wiki
>> article https://wiki.debian.org/Postfix states that you should set the
>> 'myhostname' and 'mydomain' parameters explicitly.
>
> This is Debian specific:
>
> +# Debian GNU/Linux specific:  Specifying a file name will cause the
> +# first line of that file to be used as the name.  The Debian default
> +# is /etc/mailname.
> +# +#myorigin = /etc/mailname
>
> It's been that way for at least 18 years (well before I was involved in maintaining Postfix in Debian).

That said, absent any domain part in the system hostname and with
no explicit setting of mydomain in main.cf, the default, compiled-in
value of mydomain is "localdomain".   This is typically not what
"postconf -d" reports, since the latter reports the default name
derived from the system hostname.  But it can be teased out with
an unqualified "myhostname" override:

  $ mkdir temp
  $ echo "myhostname = foo" > temp/main.cf
  $ touch temp/master.cf
  $ postconf -c $PWD/temp mydomain
  mydomain = localdomain

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: where is the fqdn coming from

Matt Zagrabelny

On Wed, Nov 21, 2018 at 5:42 PM Viktor Dukhovni <[hidden email]> wrote:
> On Nov 21, 2018, at 6:25 PM, Scott Kitterman <[hidden email]> wrote:
>
>>> Where is the ".localdomain" coming from?
>>
>> It might be read from a file, or it might be set at compile time? The
>> person packaging Postfix for Debian should know. In any case, the Wiki
>> article https://wiki.debian.org/Postfix states that you should set the
>> 'myhostname' and 'mydomain' parameters explicitly.
>
> This is Debian specific:
>
> +# Debian GNU/Linux specific:  Specifying a file name will cause the
> +# first line of that file to be used as the name.  The Debian default
> +# is /etc/mailname.
> +# +#myorigin = /etc/mailname
>
> It's been that way for at least 18 years (well before I was involved in maintaining Postfix in Debian).

That said, absent any domain part in the system hostname and with
no explicit setting of mydomain in main.cf, the default, compiled-in
value of mydomain is "localdomain".   This is typically not what
"postconf -d" reports, since the latter reports the default name
derived from the system hostname.  But it can be teased out with
an unqualified "myhostname" override:

  $ mkdir temp
  $ echo "myhostname = foo" > temp/main.cf
  $ touch temp/master.cf
  $ postconf -c $PWD/temp mydomain
  mydomain = localdomain


Thanks for explaining it Viktor!

It feels unnecessarily nonintuitive to have Postfix "decide" to use a compiled in domain when there exists a domain in the system. Especially when postconf reports the "system" domain.

Perhaps the devs would be willing to change this behavior?

Thanks!

-m
Reply | Threaded
Open this post in threaded view
|

Re: where is the fqdn coming from

Viktor Dukhovni
> On Nov 26, 2018, at 3:37 PM, Matt Zagrabelny <[hidden email]> wrote:
>
> It feels unnecessarily nonintuitive to have Postfix "decide" to use a compiled
> in domain when there exists a domain in the system.

No, Postfix only uses the compiled-in domain when the system hostname
is not fully qualified, and there's no explicit mydomain setting.

In this situation there is no "domain in the system".

> Especially when postconf reports the "system" domain.
>
> Perhaps the devs would be willing to change this behavior?

Works correctly, as intended.

--
        Viktor.