Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

tcpserver, qmail-smtpd, qmail-queue and filter Qs

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


phil at pricom

Nov 18, 2009, 4:48 PM

Post #1 of 9 (2493 views)
Permalink
tcpserver, qmail-smtpd, qmail-queue and filter Qs

People,

Following up the previous question re tcpserver operation:

In my setup tcpserver execs greylite which eventually execs qmail-smtpd.
Greylite uses the to and from IP addresses of the tcp communication - is
any of the message itself (header lines?, body?) available at this point
or only after qmail-smtpd runs?

In the qmail-qfilter setup, the filtering of the message is done after
qmail-smtpd processes the message and before it hands it to qmail-queue.
So it looks like any filtering on lines from the message itself has to
be done at this point. I was thinking if the sender's and recipient's
addresses could be available immediately after greylite, I could block
black listed senders and recipients before qmail-smtpd execs?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil [at] pricom


search-web-for-address at pyropus

Nov 18, 2009, 5:07 PM

Post #2 of 9 (2374 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

Philip Rhoades <phil [at] pricom> wrote:
>
> In my setup tcpserver execs greylite which eventually execs qmail-smtpd.
> Greylite uses the to and from IP addresses of the tcp communication - is
> any of the message itself (header lines?, body?) available at this point
> or only after qmail-smtpd runs?

No, no data has been exchanged with the client before qmail-smtpd runs. The
only information that is available is that which tcpserver makes available to
the program it runs through the various environment variables it sets.

> In the qmail-qfilter setup, the filtering of the message is done after
> qmail-smtpd processes the message and before it hands it to qmail-queue. So
> it looks like any filtering on lines from the message itself has to be done
> at this point.

Yes, exactly.

> I was thinking if the sender's and recipient's addresses could be available
> immediately after greylite, I could block black listed senders and
> recipients before qmail-smtpd execs?

Not without a magic wand ;)

Charles
--
--------------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at: http://pyropus.ca/software/
Read http://pyropus.ca/personal/writings/12-steps-to-qmail-list-bliss.html
--------------------------------------------------------------------------


dpthakar at gmail

Nov 18, 2009, 9:41 PM

Post #3 of 9 (2359 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

On Thu, Nov 19, 2009 at 6:18 AM, Philip Rhoades <phil [at] pricom> wrote:

> People,
>
> Following up the previous question re tcpserver operation:
>
> In my setup tcpserver execs greylite which eventually execs qmail-smtpd.
> Greylite uses the to and from IP addresses of the tcp communication - is any
> of the message itself (header lines?, body?) available at this point or only
> after qmail-smtpd runs?
>
> In the qmail-qfilter setup, the filtering of the message is done after
> qmail-smtpd processes the message and before it hands it to qmail-queue. So
> it looks like any filtering on lines from the message itself has to be done
> at this point. I was thinking if the sender's and recipient's addresses
> could be available immediately after greylite, I could block black listed
> senders and recipients before qmail-smtpd execs?
>
> Thanks,
>
>
> i have blocked blacklisted sender & recipient at smtp using jms patch
all you need to do is to mention email ids in badmailfrom & badrcptto of
qmail control folder.

--
Regards
Dhaval Thakar
http://www.linuxreaders.com





/


adip at gmx

Nov 18, 2009, 10:03 PM

Post #4 of 9 (2363 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

On Thu, 19 Nov 2009 11:48:35 +1100 Philip Rhoades wrote:

> I was thinking if the sender's and recipient's addresses could be
> available immediately after greylite, I could block black listed
> senders and recipients before qmail-smtpd execs?

1. Sender (as specified by MAIL FROM) and recipient (as specified by
RPCTO TO) email addresses in the message envelope can differ to the ones
in the email message (specified by From: and To:). Which one is the
pair of addresses you are referring to?
2. Addresses in the envelope are not available until qmail-smtpd is
executed, because that's the process that sends "220 hostname ESMTP".
Before this message the client won't send any envelope information.

--
Adi Pircalabu


kyle-qmail at memoryhole

Nov 19, 2009, 8:16 AM

Post #5 of 9 (2357 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thursday, November 19 at 11:48 AM, quoth Philip Rhoades:
> In my setup tcpserver execs greylite which eventually execs
> qmail-smtpd. Greylite uses the to and from IP addresses of the tcp
> communication - is any of the message itself (header lines?, body?)
> available at this point or only after qmail-smtpd runs?

As other folks have pointed out, the short answer is "no".

But, I think the longer answer is: just precisely what is it that you
think qmail-smtpd *does*? If the message is available before
qmail-smtpd runs to communicate with the sender, what's the purpose of
qmail-smtpd?

Qmail-smtpd is there to SPEAK SMTP. That is, it can handle
authentication, allows the sender to specify recipients and the
sender, and finally prompts the sender to transmit the message. Before
that happens, the sender HAS NOT SENT THE MESSAGE. Thus, none of it is
available. Your question is akin to asking "is it possible to find out
what the lottery number will be before they draw the numbers from the
lottery machine?". The message is transmitted by talking SMTP;
qmail-smtpd is the program that speaks SMTP; without talking SMTP, no
part of the message has been transmitted (and you have not received
it). Before qmail-smtpd runs, you know only the information about the
connection itself: the IP address (and hostname) of the connecting
client, the port numbers that are being used.

> In the qmail-qfilter setup, the filtering of the message is done
> after qmail-smtpd processes the message and before it hands it to
> qmail-queue. So it looks like any filtering on lines from the
> message itself has to be done at this point.

Indeed - do you understand why that is the case?

> I was thinking if the sender's and recipient's addresses could be
> available immediately after greylite, I could block black listed
> senders and recipients before qmail-smtpd execs?

The sender and recipient list is transmitted VIA SMTP. Without
speaking SMTP (i.e. by using some program (such as qmail-smtpd) to
speak SMTP), you cannot know that information. Similarly, you cannot
know the first number that will come out of the lotto machine without
turning the lotto machine on.

If you want to create a greylisting behavior that includes
sender/recipient information, you probably want to use something like
the RCPTCHECK patch to qmail-smtpd, which allows qmail-smtpd to call
another program to verify recipients AFTER the sender and recipients
have been specified but BEFORE the message has been sent. I even have
an example script on my website, here:
http://www.memoryhole.net/qmail/#rcptcheck

Hope that helps. :)

~Kyle
- --
A tyrant must put on the appearance of uncommon devotion to religion.
Subjects are less apprehensive of illegal treatment from a ruler whom
they consider God-fearing and pious. On the other hand, they do less
easily move against him, believing that he has the gods on his side.
-- Aristotle
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJLBW9lAAoJECuveozR/AWeb9AP/jm7pK4bJ69etM3hmuAI35gA
r7Y23GysxE1shpkbsBQIJVVAuroPudjIOeBqQJjcfB+WD7iuPlkjtms1CBvi5yY5
U+53P2mERLB1/tIJQvYMOqoDW+yYRtoLURdkJpNOAu5a7C1rccC4/4cKkpCSeBsq
7egYcRWNMTHbcmeKhuAYF0wr2uek2rGdm794yzzV/OGwMy+vat3CA9vCPE5gCKpX
Exke4aOclQ4nXRCjdD110PGGoTDufasY5/NPiklS2b+dSw6ptKPQk412BzvabL77
EgMQGKMC+ZlW+0mQgjjtKYBwaLk8YLacRjl8HmJCEIe3cRniWT72lUXuhGLhGoXp
yu2JLG9K0kSwQBqAJFWx3RRdbUC6hSJYO2X79bR3JTW0HGwvbB87wHFHFFFg13M8
dA9uLFyyh+gkxsxww05Ro0wyY/ZYY+iDWlfoIUJ0YXeY6CGU2bCTUxAPRHZQEwmT
eN6i4vTCE99la04Ds86lBYuBuOLghdkxAjT2yNPpGJtNKLqbVHhk8XWwfmBkz5hY
shk+CZJswx452WPrHkYKK6stwaaQjPHcTreIX3RNgsRqVN5hPEf471rCrspk2KxW
DNBCt2cHXOHSP27+JRQJz2XwHIYabSVFWHfx++NQ5NOeiFtvgFsFHdPHm2NT7db/
MXG7xdKpbAJtmQ6ahVFv
=nFkg
-----END PGP SIGNATURE-----


phil at pricom

Nov 19, 2009, 3:03 PM

Post #6 of 9 (2352 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

Adi,


On 2009-11-19 17:03, Adi Pircalabu wrote:
> On Thu, 19 Nov 2009 11:48:35 +1100 Philip Rhoades wrote:
>
>> I was thinking if the sender's and recipient's addresses could be
>> available immediately after greylite, I could block black listed
>> senders and recipients before qmail-smtpd execs?
>
> 1. Sender (as specified by MAIL FROM) and recipient (as specified by
> RPCTO TO) email addresses in the message envelope can differ to the ones
> in the email message (specified by From: and To:). Which one is the
> pair of addresses you are referring to?


Good question - why is it that the two pairs can have different values?


> 2. Addresses in the envelope are not available until qmail-smtpd is
> executed, because that's the process that sends "220 hostname ESMTP".
> Before this message the client won't send any envelope information.


That doesn't seem to be the case - greylite execs before qmail-smtpd and
in the greylite code there is this:

#define SMTP_ENVELOPE_OK 0
/* session OK, envelope data stored correctly */

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil [at] pricom


lists-qmail at maexotic

Nov 19, 2009, 6:24 PM

Post #7 of 9 (2355 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

On Fri, Nov 20, 2009 at 10:03:17AM +1100, Philip Rhoades wrote:
> Good question - why is it that the two pairs can have different values?

Just think of this mailing list.
The 2822.From of your message was
Philip Rhoades <phil@...com.au>
but the 2821.FROM points to the qmail list manager, as this is where
administrative messages regarding this message should go to (like
recipient does no longer exist).
Also (although I have never seen that) per RFC 2822 a email can have
more than one address in the 2822.From field, but only one 2821.MAILFROM.

Just think of the 2821.MAILFROM as what it is often called: the envelope
sender. As with a lot of snail mail messages the address on the envelope
may be somewhat generic, while the address on the letter in the envelope
is more specific.

\Maex


Jost.Krieger+qmail at ruhr-uni-bochum

Nov 26, 2009, 1:01 PM

Post #8 of 9 (2224 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

On Thu, Nov 19, 2009 at 10:16:37AM -0600, Kyle Wheeler wrote:

Sorry to comeso late, but this all is a misunderstanding.

> On Thursday, November 19 at 11:48 AM, quoth Philip Rhoades:
> > In my setup tcpserver execs greylite which eventually execs
> > qmail-smtpd. Greylite uses the to and from IP addresses of the tcp
> > communication - is any of the message itself (header lines?, body?)
> > available at this point or only after qmail-smtpd runs?
>
> As other folks have pointed out, the short answer is "no".
> ...
> Before qmail-smtpd runs, you know only the information about the
> connection itself: the IP address (and hostname) of the connecting
> client, the port numbers that are being used.

That's not true (in the case of greylite).

I used greylite for a while (and gave up for reasons of database
contention). Now I use a variant of greydaemon (thanks to John Levine),
but that needs patching qmail-smtpd (which we have been doing for ten
years anyway ...).

Greylite is using "command line chainig", but not simple "exec
chaining". It does indeed set up a pair of pipes, then forks and execs.
After that, it listens into the SMTP stream. It will intercept the SMTP
dialogue for greylisting, and turn into a passthrough if everything is
fine. It never cares for anything after DATA, but it sees the MAIL FROM
and RCPT TO.

Qmail-smtpd doen't notice, because it sees the complete SMTP dialogue,
normally.

So greylite is like recordio in interface and function.

Jost
--
| Helft Spam ausrotten! HTML in Mail ist unhöflich. |
| Postmaster, JAPH, manchmal Wahrsager am RZ der RUB |
| Bitte immer an Funktionsadressen schreiben: Postmaster [at] rub |


phil at pricom

Nov 26, 2009, 7:46 PM

Post #9 of 9 (2219 views)
Permalink
Re: tcpserver, qmail-smtpd, qmail-queue and filter Qs [In reply to]

Jost,


On 2009-11-27 08:01, Jost Krieger wrote:
> On Thu, Nov 19, 2009 at 10:16:37AM -0600, Kyle Wheeler wrote:
>
> Sorry to comeso late, but this all is a misunderstanding.
>
>> On Thursday, November 19 at 11:48 AM, quoth Philip Rhoades:
>>> In my setup tcpserver execs greylite which eventually execs
>>> qmail-smtpd. Greylite uses the to and from IP addresses of the tcp
>>> communication - is any of the message itself (header lines?, body?)
>>> available at this point or only after qmail-smtpd runs?
>>
>> As other folks have pointed out, the short answer is "no".
>> ...
>> Before qmail-smtpd runs, you know only the information about the
>> connection itself: the IP address (and hostname) of the connecting
>> client, the port numbers that are being used.
>
> That's not true (in the case of greylite).
>
> I used greylite for a while (and gave up for reasons of database
> contention). Now I use a variant of greydaemon (thanks to John Levine),
> but that needs patching qmail-smtpd (which we have been doing for ten
> years anyway ...).
>
> Greylite is using "command line chainig", but not simple "exec
> chaining". It does indeed set up a pair of pipes, then forks and execs.
> After that, it listens into the SMTP stream. It will intercept the SMTP
> dialogue for greylisting, and turn into a passthrough if everything is
> fine. It never cares for anything after DATA, but it sees the MAIL FROM
> and RCPT TO.


Right - which would allow me to do some more filtering except that as
someone else pointed out - MAIL FROM and RCPT TO don't necessarily
correspond to From: and To: - I have checked most of my problem mails
and they would not be stopped by such filtering unfortunately . .


> Qmail-smtpd doen't notice, because it sees the complete SMTP dialogue,
> normally.
>
> So greylite is like recordio in interface and function.


Thanks for the extra info! - it is appreciated.

Regards,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil [at] pricom

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.