Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postfix configuration on Bullseye

34 views
Skip to first unread message

Charles Curley

unread,
Apr 19, 2021, 7:10:05 PM4/19/21
to
On installing on Bullseye, I usually install postfix, then configure it
with "dpkg-reconfigure postfix".

I use postfix here only for logwatch and other system emails, so the
setup isn't concerned with the Internet at large.

The default list of systems to accept mail for doesn't look right to me:

grissom.localdomain, grissom.localdomain, localhost.localdomain, , localhost

* Why is the fully qualified host name in there twice, but not the
hostname alone ("grissom")? (localdomain is my local TLD on a private
network.)

* What with the two commas toward the end?

Shouldn't that be

grissom.localdomain, grissom, localhost.localdomain, localhost

--
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

Darac Marjal

unread,
Apr 20, 2021, 4:00:05 AM4/20/21
to

On 20/04/2021 00:08, Charles Curley wrote:
> On installing on Bullseye, I usually install postfix, then configure it
> with "dpkg-reconfigure postfix".
>
> I use postfix here only for logwatch and other system emails, so the
> setup isn't concerned with the Internet at large.
>
> The default list of systems to accept mail for doesn't look right to me:
>
> grissom.localdomain, grissom.localdomain, localhost.localdomain, , localhost
>
> * Why is the fully qualified host name in there twice, but not the
> hostname alone ("grissom")? (localdomain is my local TLD on a private
> network.)
>
> * What with the two commas toward the end?
>
> Shouldn't that be
>
> grissom.localdomain, grissom, localhost.localdomain, localhost

This looks to come from the debian/postfix.config file, and is thus part
of the Debian packaging of postfix, rather than an upstream thing. In
that file, at line 228, we see: 

if ($mailertype eq "Internet Site") { if ($mailname eq $hostname) {
$destinations = join ", ",("\$myhostname", $mailname, "localhost." .
$domain, ", localhost"); } else { $destinations = join ",
",("\$myhostname", $mailname, $hostname, "localhost." . $domain . ",
localhost"); } } else { # don't accept mail for $mailname by default if
we have a relayhost or local only mail, # unless the mailname bears no
resemblance to $myorigin. $destinations = join ", ",("\$myhostname",
$hostname, "localhost." . $domain . ", localhost" ); unless ( $hostname
=~ m/(^|[\.])$mailname$/ ) { $destinations = $mailname . ", " .
$destinations; } }

[ Taken from
https://sources.debian.org/src/postfix/3.5.6-1/debian/postfix.config/#L228,
which might be easier to read if that wraps ]

This is perl, so the join() function takes a string and an array and
delimits the array with the string. So, if we take the first one as an
example, the literal string "$myhostname" is followed by a comma-space,
then the value in the "mailname" variable, then the literal string
"localhost." with the "domain" variable appended, then another
comma-space. Finally, the last element to be added to the list is ",
localhost". I don't know why this was written this way, but it means
that in every case, the "destinations" variable will end with ", ,
localhost"

Sadly, the earliest revision I can find of this file on salsa.debian.org
(https://salsa.debian.org/postfix-team/postfix-dev/-/commit/a0577ca96dda9c4e5e5bc9dd0c5b7cfc545c5804#ac03215119d5f2efaeb830653c7f84124ceed640_0_192)
already has the ", localhost" code in it, so I can't say why it was
written like that.

On the upside, though, this is an allowlist of domains postfix will
accept mail for. If there are duplicates, it shouldn't REALLY make much
difference. It's a nice to fix (just because, if you can't explain why
the code is doing something weird, you can't adequately say whether it's
a problem or not).




OpenPGP_signature

Charles Curley

unread,
Apr 20, 2021, 12:40:05 PM4/20/21
to
On Tue, 20 Apr 2021 08:51:29 +0100
Darac Marjal <maili...@darac.org.uk> wrote:

> On the upside, though, this is an allowlist of domains postfix will
> accept mail for. If there are duplicates, it shouldn't REALLY make
> much difference.

Thanks for the analysis.

I don't mind the duplicates, and the spurious comma is probably
harmless. However, what this list would leave out is the hostname only,
e.g. boojum@grissom would, I am guessing, fail. Unless postfix adds the
domain to the hostname before testing it against this list.

As you say, it's a "nice to fix".
0 new messages