need help with pcre for postfix

View: New views
7 Messages — Rating Filter:   Alert me  

need help with pcre for postfix

by VALOIS, Pascal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

i don't understand how the filter are processed ?

can someone help me write a filter who would accept mail for
"postmaster@domain" and reject all other mails ?

--
Pascal Valois
Service Informatique
01 41 16 70 33


Re: need help with pcre for postfix

by Victor Duchovni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 04, 2009 at 06:34:38PM +0100, pascal valois wrote:

> i don't understand how the filter are processed ?
>
> can someone help me write a filter who would accept mail for
> "postmaster@domain" and reject all other mails ?

    http://www.postfix.org/access.5.html
    http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions
    http://www.postfix.org/postconf.5.html#check_recipient_access

A lot depends on the type of domain, for "virtual alias" domains for
example, just don't create any virtual alias table entries for any
other users in the domain.

    http://www.postfix.org/ADDRESS_CLASS_README.html
    http://www.postfix.org/VIRTUAL_README.html
    http://www.postfix.org/virtual.5.html
    http://www.postfix.org/postconf.5.html#virtual_alias_maps
    http://www.postfix.org/postconf.5.html#virtual_alias_domains

None of this has anything to do with "pcre" per-se. Why do you believe
you need PCRE to implement a policy that only accepts mail for certain
recipients?

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo@...?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.

RE: need help with pcre for postfix

by Sharma, Ashish-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pascal,

You can create a mail filter for Postfix using Milter API.

For c implementation you can use lib-milter API and for Java implementation you can use 'Jilter' API.

It's possible to write code depending on your requirement as mentioned by you:

> can someone help me write a filter who would accept mail for
>"postmaster@domain" and reject all other mails ?

I have a sample Jilter implementation in java for understanding Jilter implementation, reply if you need it.

Check these links for more info:
http://en.wikipedia.org/wiki/Milter
https://www.sendmail.org/doc/sendmail-current/libmilter/docs/
http://www.sendmail.org/doc/sendmail-current/libmilter/README
http://sendmail-jilter.sourceforge.net/

Ashish


-----Original Message-----
From: owner-postfix-users@... [mailto:owner-postfix-users@...] On Behalf Of pascal valois
Sent: Wednesday, November 04, 2009 11:05 PM
To: postfix users list
Subject: need help with pcre for postfix

hi,

i don't understand how the filter are processed ?

can someone help me write a filter who would accept mail for
"postmaster@domain" and reject all other mails ?

--
Pascal Valois
Service Informatique
01 41 16 70 33


Re: need help with pcre for postfix

by Victor Duchovni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 06, 2009 at 10:17:26AM +0000, Sharma, Ashish wrote:

> Pascal,
>
> You can create a mail filter for Postfix using Milter API.

Massive overkill for a simple recipient address access policy.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo@...?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.

Re: need help with pcre for postfix

by VALOIS, Pascal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Viktor,

Yes, Milter seems way to much for what i wanna do.

i installed postfix-pcre on ubuntu 8.04.

and add this line in my main.cf postfix configuration :

header_checks = pcre:/etc/postfix/header_checks

then here is the content of my /etc/postfix/header_checks :

!/postmaster@devinci\.fr/ REJECT go away

but when this is enables, all mail are rejected.

can anyone help me with this ?


Le vendredi 06 novembre 2009 à 14:56 -0500, Victor Duchovni a écrit :
> On Fri, Nov 06, 2009 at 10:17:26AM +0000, Sharma, Ashish wrote:
>
> > Pascal,
> >
> > You can create a mail filter for Postfix using Milter API.
>
> Massive overkill for a simple recipient address access policy.
>


--
Pascal Valois
Service Informatique
Pôle Universitaire Léonard de Vinci


Re: need help with pcre for postfix

by VALOIS, Pascal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hum, i think i found what was wrong.

when checking with pcre, all lines in the header are processed. and then
the "from: adress" get a REJECT go away reponse from the filter.

i though that all the subject was processed as once ?

right or wrong ?

Le mercredi 18 novembre 2009 à 09:17 +0100, pascal valois a écrit :

> Viktor,
>
> Yes, Milter seems way to much for what i wanna do.
>
> i installed postfix-pcre on ubuntu 8.04.
>
> and add this line in my main.cf postfix configuration :
>
> header_checks = pcre:/etc/postfix/header_checks
>
> then here is the content of my /etc/postfix/header_checks :
>
> !/postmaster@devinci\.fr/ REJECT go away
>
> but when this is enables, all mail are rejected.
>
> can anyone help me with this ?
>
>
> Le vendredi 06 novembre 2009 à 14:56 -0500, Victor Duchovni a écrit :
> > On Fri, Nov 06, 2009 at 10:17:26AM +0000, Sharma, Ashish wrote:
> >
> > > Pascal,
> > >
> > > You can create a mail filter for Postfix using Milter API.
> >
> > Massive overkill for a simple recipient address access policy.
> >
>
>


--
Pascal Valois
Service Informatique
Pôle Universitaire Léonard de Vinci


Re: need help with pcre for postfix

by Victor Duchovni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 18, 2009 at 09:17:14AM +0100, pascal valois wrote:

> i installed postfix-pcre on ubuntu 8.04.
>
> and add this line in my main.cf postfix configuration :
>
> header_checks = pcre:/etc/postfix/header_checks

Why are using header checks to filter the envelope recipient address?
(Hint: DO NOT).

    http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions
    http://www.postfix.org/postconf.5.html#check_recipient_access
    http://www.postfix.org/access.5.html

Find a decent tutorial on Postfix restriction processing.

> then here is the content of my /etc/postfix/header_checks :
>
> !/postmaster@devinci\.fr/ REJECT go away
>
> but when this is enables, all mail are rejected.
>
> can anyone help me with this ?

Don't reject all messages that contain header lines that don't mention
the postmaster address.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo@...?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.