On Wed, Jul 28, 2021 at 12:28:25PM +0200, Jean-François Bachelet 
<jfbache...@free.fr> wrote:

> Hello Matus ^^)
>
> Le 28/07/2021 à 09:36, Matus UHLAR - fantomas a écrit :
> > On 28.07.21 06:21, Jean-François Bachelet wrote:
> > > I have some problems with my postfix install, will report one by one :
> > >
> > > 1 / Mail sent by some daemons running as 'root' (here it's
> > > Pflogsumm, per example) with 'r...@server.mydomain.com'
> > >
> > > for 'r...@server.domain.com' are bounced/rejected, as reported in
> > > '/var/spool/postfix/defer/' :
> > >
> > > ----------------------------------------------------------------------------------------------------------------------
> > >
> > > <r...@server.mydomain.com>: mail for server.mydomain.com loops back
> > > to myself
> > > recipient=r...@server.mydomain.com
> > > offset=780
> > > dsn_orig_rcpt=rfc822;r...@server.mydomain.com
> > > status=4.4.6
> > > action=delayed
> > > reason=mail for server.mydomain.com loops back to myself
> >
> > this mean that your server is going to send mail to "server.mydomain.com"
> > and your postfix sees it should deliver domain to itself, but postfix
> > does
> > not know how to handle mail for server.mydomain.com
> > - you have to put "server.mydomain.com" to mydestinations if you want to
> > handle the mail locally
>
> ? but the pflogsumm crontab send its mail using 'mail' (as other system
> daemons do when necessary) not postfix for its reports... :

/usr/bin/mail invokes /usr/sbin/sendmail internally to
submit the email for delivery. /usr/sbin/sendmail is
postfix's sendmail-compatible interface provided for
this purpose. So, postfix is the system that handles
delivery or relaying of email that has been submitted
by /usr/bin/mail.

> "perl /usr/sbin/pflogsumm -e -d yesterday /var/log/mail.log | mail -s
> 'Pflogsumm Logwatch for Postfix' root"
>
> so aliases should apply and the mail should be sent to my external personal
> address.
>
> hum, here is the content of 'mydestination' without an 's' as in the
> 'main.cf' conf file :
>
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

This doesn't include server.mydomain.com. This means that postfix
isn't being instructed to deliver that mail locally. That means
that postfix won't consult the /etc/aliases database to see what
to do with that mail.

The recipient address was r...@server.mydomain.com.
If the postfix system is supposed to deliver that mail locally,
and therefore consider the /etc/aliases database, then you need
to add server.mydomain.com to $mydestinations.

So, your current definition of mydestination above is:

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

Try adding sender.$mydomain to it, so that it says this instead:

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, 
server.$mydomain

Unless you do that, postfix will want to send the email
to the MX host for server.mydomain.com, which is
probably itself, hence the loop error message.

But don't just trust this. I don't know anything about
your DNS set up, or your network, or what your postfix
server should consider to be local, or exactly what you
might have altered in your log messages before sending
them to the list, or the contents of your
/etc/mailname.

I'm just guessing about what might help. Doing what I
suggest might cause problems. You need to understand
what mydestination is for, where it is used, and what
should be in there. See
http://www.postfix.org/postconf.5.html#mydestination
as a starting point.

When you said "recipient=r...@server.mydomain.com" I
assumed that you only changed "mydomain.com" but that
"server" was really part of the hostname. If that's not
the case, what I suggest above will be wrong.

Is server.mydomain.com a different computer to the mail
server? Or is it the same computer? The local hostname
of the postfix server is mail.mydomain.com, not
server.mydomain.com. Where is server.mydomain.com
coming from? Is it in /etc/mailname perhaps? Is it just
an additional name for the same host? If it is, then it
should be correct to add it to $mydestination. If not,
and there are multiple hosts involved, it's more
complicated.

But if /etc/mailname contains server.mydomain.com but
the computer's "real" name is mail.mydomain.com, then
perhaps fixing /etc/mailname to contain the host's
real name might fix your problem. Again, I'm just
guessing. On debian, the default value of myorigin
is the contents of /etc/mailname, rather than the
normal default of $myhostname. If the two don't agree,
it could be causing your problem.

> last question : I found this in mail header sources when directly send to me
> to my external address (skipping 'root' to be sure I get the reports till
> the problem is resolved, it must be as I have a sh*tload of others aliases
> that will must be handled fine (migrating an uterly old suse server to a new
> debian one)...
>
> Received-SPF: None (DAG4EX1.mxp6.local:
>  r...@server.example.com does not designate permitted sender hosts)
>
> How can/what I must do to get rid of this ? maybe it should read
> r...@mail.example.com there (it's the mail server's name) ?,
>
> that should a permited sender hosts no ?
>
> (note : I haven't configured spf, dkim, dmarc, etc, yet on this new server,
> one thing at a time and ensure that's working fine before pilling other
> things on top ;))

That header might have been put there by the remote
receiving server. It's saying that the sending domain
does not specify which IP addresses are authorised to
send email for that domain. You could get rid of it by
specifying which IP adresses are authorised to do so,
and to include the IP address of your postfix server
host in the list. You don't have to do that, but you can.
But doing that isn't postfix-related.
You just need to add an SPF (TXT) record to the sending
domain's DNS setup. Google how to set up SPF. There's
lots of advice and tools to help construct it.

> Jeff

cheers,
raf

Reply via email to