Discussion:
Strange behaviour of my multi-instance server
(too old to reply)
i***@itrezero.it
2015-03-18 19:26:44 UTC
Permalink
Hello.

I'm facing with a strange behaviour of my Postfix multi-instance server and
I'll try. to explain.

Every instance manages outbound emails from a specific IP. This is an
example master.cf:

---------------------- /etc/postfix/master.cf (instance
1)--------------------------

smtp unix - - n - - smtp

-o syslog_name=postfix-smtp79

-o smtp_helo_name=mx1.kkkkk.com

-o smtp_bind_address=xxx.yyy.zzz.79

----------------------------- END
-------------------------------------------------------------



---------------------- /etc/postfix-1/master.cf (instance
2)--------------------------

smtp unix - - n - - smtp

-o syslog_name=postfix-smtp80

-o smtp_helo_name=mx2.kkkkk.com

-o smtp_bind_address=xxx.yyy.zzz.80

----------------------------- END
-------------------------------------------------------------



In other words:

if web client (a web application) connects to xxx.yyy.zzz.79 => emails are
sent through xxx.yyy.zzz.79 (instance 1),

if it connects to xxx.yyy.zzz.80 => emails are sent through xxx.yyy.zzz.80
(instance 2),

and so on.



Everything worked properly, I thought! Until I discovered some complaints
messages from Yahoo that say:

421 4.7.0 [TS01] Messages from xxx.yyy.zzz.79 temporarily deferred due to
user complaints <-- from INSTANCE 1 IP address

BUT I sent messages through xxx.yyy.zzz.80 that is IP address of instance
(2)!!!.



Where can I pay attention in main/master.cf of the instances to understand
where is the problem?

Hoping to have been clear :) many thanks for your help.

-Francesco







---
Questa e-mail Ú stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Viktor Dukhovni
2015-03-18 19:46:25 UTC
Permalink
Post by i***@itrezero.it
421 4.7.0 [TS01] Messages from xxx.yyy.zzz.79 temporarily deferred due to
user complaints <-- from INSTANCE 1 IP address
Sending such error response fragments out of context is a waste of
everyone's time. Please post complete log entries along with
sufficient related configuration information to ensure that the
error message is not misconstrued.

The technical information posted should speak for itself. Where
appropriate you can explain what you want to happen, but you should
not need to explain what actually happenned in your words, the
logs and configuration data must do that for you.
--
Viktor.
Wietse Venema
2015-03-18 20:36:35 UTC
Permalink
Post by i***@itrezero.it
if web client (a web application) connects to xxx.yyy.zzz.79 => emails are
sent through xxx.yyy.zzz.79 (instance 1),
if it connects to xxx.yyy.zzz.80 => emails are sent through xxx.yyy.zzz.80
(instance 2),
Here you talk about the IP address that Postfix uses to receive mail.
Post by i***@itrezero.it
Everything worked properly, I thought! Until I discovered some complaints
421 4.7.0 [TS01] Messages from xxx.yyy.zzz.79 temporarily deferred due to
user complaints <-- from INSTANCE 1 IP address
BUT I sent messages through xxx.yyy.zzz.80 that is IP address of instance
(2)!!!.
Here you talk about the IP address that Postfix uses to send
mail.

To fix the source IP address for sending mail either:

- Specify smtp_bind_address in the respective main.cf files.

or:

- Specify ONE address with the inet_interfaces parameters
in the respective main.cf files.

Wietse
i***@itrezero.it
2015-03-19 09:16:57 UTC
Permalink
Thanks a lot, Mr. Venema.

As you can see, I have a bind address in master.cf with:
-o smtp_bind_address=xxx.yyy.zzz.79
Is it OK or "smtp_bind_address" in main.cf is different?

Regarding "inet_interfaces" I usually have something like this (in every
instance main.cf file, changing IP for each one):
inet_interfaces = xxx.xxx.xxx.79, localhost
Is it correct with "localhost" or I must write just the IP used for
accepting smtp connections from my client?

Finally, in my main.cf files I have:
mynetworks = xxx.xxx.xxx.79/32, xxx.xxx.xxx.80/32, xxx.xxx.xxx.81/32,
127.0.0.0/8
where I usually list all IPs used for every instance of Postfix (5 instances
=> 5 IPs).

Maybe the error is here!?

Thank you.
-Francesco



-----Messaggio originale-----
Da: owner-postfix-***@postfix.org [mailto:owner-postfix-***@postfix.org]
Per conto di Wietse Venema
Inviato: mercoledì 18 marzo 2015 21:37
A: Postfix users
Oggetto: Re: Strange behaviour of my multi-instance server
Post by i***@itrezero.it
if web client (a web application) connects to xxx.yyy.zzz.79 => emails
are sent through xxx.yyy.zzz.79 (instance 1),
if it connects to xxx.yyy.zzz.80 => emails are sent through
xxx.yyy.zzz.80 (instance 2),
Here you talk about the IP address that Postfix uses to receive mail.
Post by i***@itrezero.it
Everything worked properly, I thought! Until I discovered some
421 4.7.0 [TS01] Messages from xxx.yyy.zzz.79 temporarily deferred due
to user complaints <-- from INSTANCE 1 IP address
BUT I sent messages through xxx.yyy.zzz.80 that is IP address of
instance (2)!!!.
Here you talk about the IP address that Postfix uses to send mail.

To fix the source IP address for sending mail either:

- Specify smtp_bind_address in the respective main.cf files.

or:

- Specify ONE address with the inet_interfaces parameters
in the respective main.cf files.

Wietse


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Wietse Venema
2015-03-19 11:17:10 UTC
Permalink
Post by i***@itrezero.it
-o smtp_bind_address=xxx.yyy.zzz.79
Is it OK or "smtp_bind_address" in main.cf is different?
Postfix has TWO SMTP clients in master.cf: one called "relay" and
one called "smtp". You need to set smtp_bind_address on both.
Post by i***@itrezero.it
Regarding "inet_interfaces" I usually have something like this (in every
inet_interfaces = xxx.xxx.xxx.79, localhost
Is it correct with "localhost" or I must write just the IP used for
accepting smtp connections from my client?
To force a fixed Postfix SMTP client IP address, you must specify
smtp_bind_address if inet_interfaces has more than one IP address.
See also my comment about multiple SMTP clients in master.cf.

Wietse
i***@itrezero.it
2015-03-19 17:31:50 UTC
Permalink
Thanks Dr. Venema.
I'll try these settings (in particular for relay client in master.cf of each
instance).

However, here below a snippet of an email sent to yahoo where the problem is
more evident:

[...]
X-Originating-IP: [xxx.xxx.xxx.79]
Received: from 127.0.0.1 (EHLO mx4.DOMAIN1.it) (xxx.xxx.xxx.79)
by mta1163.mail.ir2.yahoo.com with SMTP; Thu, 19 Mar 2015 14:47:00 +0000
[...]

As i wrote, my client connects to (and send email through) mx4.mydomain.it
(IP= xxx.xxx.xxx.80) BUT email header contains an EHLO host whose IP
(xxx.xxx.xxx.80) is different from IP between parenteses (xxx.xxx.xxx.79
whose correct reverse is mx7.DOMAIN1.it).

While, this is what I find in email sent to gmail (that is CORRECT: FROM
hostname and IP are consistent!!!):

[...]
Received: from mx4.DOMAIN1.it (mx4.DOMAIN1.it. [xxx.xxx.xxx.80])
by mx.google.com with ESMTP id
pe8si4041037wic.94.2015.03.19.10.25.18
for <***@gmail.com>;
[...]

Why this problem?

Attached you'll find the main/master.cf of the 2 instances that seem to be
problematic.
Thank you.
-Francesco



---
Questa e-mail Ú stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Viktor Dukhovni
2015-03-19 18:26:56 UTC
Permalink
Post by i***@itrezero.it
However, here below a snippet of an email sent to yahoo where the problem is
[...]
X-Originating-IP: [xxx.xxx.xxx.79]
Received: from 127.0.0.1 (EHLO mx4.DOMAIN1.it) (xxx.xxx.xxx.79)
by mta1163.mail.ir2.yahoo.com with SMTP; Thu, 19 Mar 2015 14:47:00 +0000
[...]
You're still wasting everyone's time by not providing the corresponding
Postfix log entries in full.
Post by i***@itrezero.it
myhostname = mx4.DOMAIN1.it
inet_interfaces = xxx.xxx.xxx.80, localhost
At most one instance should list "localhost" in inet_interfaces,
probably only the "default" one (/etc/postfix).
Post by i***@itrezero.it
MASTER.CF
==========================================================
xxx.xxx.xxx.80:smtp inet n - n - 10 smtpd
smtp unix - - n - - smtp
-o syslog_name=postfix-smtp80
-o smtp_helo_name=mx4.DOMAIN1.it
-o myhostname=mx4.DOMAIN1.it
-o smtp_bind_address=xxx.xxx.xxx.80
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
What are these "slow" and "veryslow" transports? Did you set
"smtp_bind_address" for these also?
Post by i***@itrezero.it
inet_interfaces = xxx.xxx.xxx.79, localhost
See above.
Post by i***@itrezero.it
smtp unix - - n - - smtp
-o syslog_name=postfix-smtp79
-o smtp_helo_name=mx7.DOMAIN1.it
-o myhostname=mx7.DOMAIN1.it
-o smtp_bind_address=xxx.xxx.xxx.79
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
Sure looks like you don't understand that each instance of an
smtp(8) transport needs all the relevant settings specified.
There's no "inheritance" between "smtp" and "slow" for example.
--
Viktor.
i***@itrezero.it
2015-03-24 10:29:42 UTC
Permalink
Dear Mr. Dukhovni,
you're right, I'm not a great expert of Postfix but I'm here to learn!
Post by Viktor Dukhovni
Sure looks like you don't understand that each instance of an
smtp(8) transport needs all the relevant settings specified.
There's no "inheritance" between "smtp" and "slow" for example.
I just updated my master.cf, and ALL IS FINALLY CORRECT:
-------------------------------------- MASTER.CF
-----------------------------------
xxx.xxx.xxx.79:smtp inet n - n - 10 smtpd
smtp unix - - n - - smtp
-o syslog_name=postfix-smtp79
-o smtp_helo_name=mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
slow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
-------------------------------------- END MASTER.CF
-----------------------------------
I thought that was ineritance between smtp and other transports settings
(slow, veryslow, etc.) :-(
THANK YOU A LOT!





However I've another question. Here below is a snippet from master.cf of
another instance where I use a Perl script for randomizing the smtp client
to be used for outbound email:

------------------------------- MASTER.CF-----------------------------
127.0.0.1:21025 inet n n n - 0 spawn user=nobody
argv=/etc/postfix/random-block1.pl
smtp2 unix - - n - - smtp
-o syslog_name=postfix-smtp2
-o smtp_helo_name=mx2.dominio1.it
-o smtp_bind_address=xxx.xxx.xxx.111
smtp3 unix - - n - - smtp
-o syslog_name=postfix-smtp3
-o smtp_helo_name=mx3. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.112
smtp1 unix - - n - - smtp
-o syslog_name=postfix-smtp5
-o smtp_helo_name=mx5. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.113

veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
------------------------------- END MASTER.CF-----------------------------

Here is the transport file used in my configuration:

------------------------------------ TRANSPORT -------------------------
testdom.it slow:
testdom.com veryslow:
trydom.it slow:
trydom.com slow:
------------------------------------ END TRANSPORT -------------------------

Well: with the configuration files above, how can I update veryslow and slow
transports for each IPs?
What smtp_bind_address I have to set for slow/veryslow?

Uhmm... I hope to have been clear.

Thanks for your help!

-Francesco


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
j***@gmail.com
2018-07-02 20:36:10 UTC
Permalink
Post by i***@itrezero.it
Dear Mr. Dukhovni,
you're right, I'm not a great expert of Postfix but I'm here to learn!
Post by Viktor Dukhovni
Sure looks like you don't understand that each instance of an
smtp(8) transport needs all the relevant settings specified.
There's no "inheritance" between "smtp" and "slow" for example.
-------------------------------------- MASTER.CF
-----------------------------------
xxx.xxx.xxx.79:smtp inet n - n - 10 smtpd
smtp unix - - n - - smtp
-o syslog_name=postfix-smtp79
-o smtp_helo_name=mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
slow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
-------------------------------------- END MASTER.CF
-----------------------------------
I thought that was ineritance between smtp and other transports settings
(slow, veryslow, etc.) :-(
THANK YOU A LOT!
However I've another question. Here below is a snippet from master.cf of
another instance where I use a Perl script for randomizing the smtp client
------------------------------- MASTER.CF-----------------------------
127.0.0.1:21025 inet n n n - 0 spawn user=nobody
argv=/etc/postfix/random-block1.pl
smtp2 unix - - n - - smtp
-o syslog_name=postfix-smtp2
-o smtp_helo_name=mx2.dominio1.it
-o smtp_bind_address=xxx.xxx.xxx.111
smtp3 unix - - n - - smtp
-o syslog_name=postfix-smtp3
-o smtp_helo_name=mx3. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.112
smtp1 unix - - n - - smtp
-o syslog_name=postfix-smtp5
-o smtp_helo_name=mx5. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.113
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
------------------------------- END MASTER.CF-----------------------------
------------------------------------ TRANSPORT -------------------------
------------------------------------ END TRANSPORT -------------------------
Well: with the configuration files above, how can I update veryslow and slow
transports for each IPs?
What smtp_bind_address I have to set for slow/veryslow?
Uhmm... I hope to have been clear.
Thanks for your help!
-Francesco
---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Estimados, alguna respuesta?, estoy interesado en este post.

MegaBrutal
2015-03-24 12:51:12 UTC
Permalink
I don't understand Postfix internals so deeply, but I see another
possible problem. Please correct me if I'm wrong!

Basically, you want to run separate instances of Postfix in separate
processes, right? These instances (if not configured carefully)
probably put their queue files in the same directory
(/var/spool/postfix by Debian default). Isn't it possible that there
is a race condition between multiple instances, and an e-mail queued
by one instance actually gets delivered by another instance (thus
another IP)?

If you've taken care of this, or it is not a problem for Postfix, or
in case I said something very stupid, I'm sorry.
Post by i***@itrezero.it
Dear Mr. Dukhovni,
you're right, I'm not a great expert of Postfix but I'm here to learn!
Post by Viktor Dukhovni
Sure looks like you don't understand that each instance of an
smtp(8) transport needs all the relevant settings specified.
There's no "inheritance" between "smtp" and "slow" for example.
-------------------------------------- MASTER.CF
-----------------------------------
xxx.xxx.xxx.79:smtp inet n - n - 10 smtpd
smtp unix - - n - - smtp
-o syslog_name=postfix-smtp79
-o smtp_helo_name=mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
slow unix - - n - - smtp
-o smtp_fallback_relay=
-o syslog_name=postfix- smtp79
-o smtp_helo_name= mx4.domain.it
-o myhostname= mx4.domain.it
-o smtp_bind_address= xxx.xxx.xxx.79
-------------------------------------- END MASTER.CF
-----------------------------------
I thought that was ineritance between smtp and other transports settings
(slow, veryslow, etc.) :-(
THANK YOU A LOT!
However I've another question. Here below is a snippet from master.cf of
another instance where I use a Perl script for randomizing the smtp client
------------------------------- MASTER.CF-----------------------------
127.0.0.1:21025 inet n n n - 0 spawn user=nobody
argv=/etc/postfix/random-block1.pl
smtp2 unix - - n - - smtp
-o syslog_name=postfix-smtp2
-o smtp_helo_name=mx2.dominio1.it
-o smtp_bind_address=xxx.xxx.xxx.111
smtp3 unix - - n - - smtp
-o syslog_name=postfix-smtp3
-o smtp_helo_name=mx3. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.112
smtp1 unix - - n - - smtp
-o syslog_name=postfix-smtp5
-o smtp_helo_name=mx5. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.113
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
------------------------------- END MASTER.CF-----------------------------
------------------------------------ TRANSPORT -------------------------
------------------------------------ END TRANSPORT -------------------------
Well: with the configuration files above, how can I update veryslow and slow
transports for each IPs?
What smtp_bind_address I have to set for slow/veryslow?
Uhmm... I hope to have been clear.
Thanks for your help!
-Francesco
---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Viktor Dukhovni
2015-03-24 13:22:35 UTC
Permalink
Post by MegaBrutal
I don't understand Postfix internals so deeply, but I see another
possible problem. Please correct me if I'm wrong!
Basically, you want to run separate instances of Postfix in separate
processes, right? These instances (if not configured carefully)
probably put their queue files in the same directory
(/var/spool/postfix by Debian default). Isn't it possible that there
is a race condition between multiple instances, and an e-mail queued
by one instance actually gets delivered by another instance (thus
another IP)?
No. And these are not "instances of Postfix" sharing a queue directory.
--
Viktor.
Viktor Dukhovni
2015-03-24 13:30:15 UTC
Permalink
Post by i***@itrezero.it
------------------------------- MASTER.CF-----------------------------
127.0.0.1:21025 inet n n n - 0 spawn user=nobody
argv=/etc/postfix/random-block1.pl
smtp2 unix - - n - - smtp
-o syslog_name=postfix-smtp2
-o smtp_helo_name=mx2.dominio1.it
-o smtp_bind_address=xxx.xxx.xxx.111
smtp3 unix - - n - - smtp
-o syslog_name=postfix-smtp3
-o smtp_helo_name=mx3. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.112
smtp1 unix - - n - - smtp
-o syslog_name=postfix-smtp5
-o smtp_helo_name=mx5. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.113
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
------------------------------- END MASTER.CF-----------------------------
To distribute load among multiple IPs also for slow/veryslow, you'll
need to have multiple instances of slow and very slow, and appropriate
ways to randomly distribute load among them.

At which point it is clear that you're much better off with separate
Postfix instances per address, each with its own "smtp/slow/veryslow"
transport. And just inject the mail into those at random.

The second solution ensures that for any given message the address
used is stable over time, and so encounters shorter greylisting
delays. Your current configuration is a bad idea, so don't make
it worse by also splitting the slow/veryslow transports.

Happy snow-shoeing...
--
Viktor.
i***@itrezero.it
2015-03-24 14:50:48 UTC
Permalink
So, you suggest to:
1) use many singleIP-instances with specific smtp/slow/veryslow/etc.
transports (all bound on the same IP)
2) not use a randomizer script in the master.cf BUT randomizing the outbound
address through web application (that is a PHP script)
Is it correct?

But here I have a further question (never really answered in my searches on
Internet):
how many instances can I set up on the same machine without deteriorating
perfomances?

I know that this answer is linked to the resources of the server, so suppose
that it's a dual-core with 4 GB RAM.

Thanks again
-Francesco

-----Messaggio originale-----
Da: owner-postfix-***@postfix.org [mailto:owner-postfix-***@postfix.org]
Per conto di Viktor Dukhovni
Inviato: martedì 24 marzo 2015 14:30
A: postfix-***@postfix.org
Oggetto: Re: R: R: R: Strange behaviour of my multi-instance server
Post by i***@itrezero.it
------------------------------- MASTER.CF-----------------------------
127.0.0.1:21025 inet n n n - 0 spawn user=nobody
argv=/etc/postfix/random-block1.pl
smtp2 unix - - n - - smtp
-o syslog_name=postfix-smtp2
-o smtp_helo_name=mx2.dominio1.it
-o smtp_bind_address=xxx.xxx.xxx.111
smtp3 unix - - n - - smtp
-o syslog_name=postfix-smtp3
-o smtp_helo_name=mx3. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.112
smtp1 unix - - n - - smtp
-o syslog_name=postfix-smtp5
-o smtp_helo_name=mx5. dominio1.it
-o smtp_bind_address= xxx.xxx.xxx.113
veryslow unix - - n - - smtp
-o smtp_fallback_relay=
slow unix - - n - - smtp
-o smtp_fallback_relay=
------------------------------- END
MASTER.CF-----------------------------
To distribute load among multiple IPs also for slow/veryslow, you'll need to
have multiple instances of slow and very slow, and appropriate ways to
randomly distribute load among them.

At which point it is clear that you're much better off with separate Postfix
instances per address, each with its own "smtp/slow/veryslow"
transport. And just inject the mail into those at random.

The second solution ensures that for any given message the address used is
stable over time, and so encounters shorter greylisting delays. Your
current configuration is a bad idea, so don't make it worse by also
splitting the slow/veryslow transports.

Happy snow-shoeing...
--
Viktor.


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com
Loading...