Header_Checks non-exsiting field check

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Header_Checks non-exsiting field check

rolelael
Hi

is there a way with header_checks to check if a field does not exist ?

We want to reject mails that do not include the field X-MS-Exchange-CrossTenant-id

But unable to find it ...

Any hekp pls

tx
R
Reply | Threaded
Open this post in threaded view
|

Re: Header_Checks non-exsiting field check

Noel Jones-2
On 9/13/2017 9:02 AM, Robby Van Mieghem wrote:
> Hi
>
> is there a way with header_checks to check if a field does not exist ?
>
> We want to reject mails that do not include the field
> X-MS-Exchange-CrossTenant-id

No, header_checks cannot check for a missing header.  It examines
each header individually with no knowledge of other headers.

You'll need to use a milter or content_filter to check for missing
headers.



  -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Header_Checks non-exsiting field check

rolelael
OK tx

Small other questions. Seems not to works also : assuming tenantid = 8888

I have one line in header checks

!/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT Tenant-ID In-Correct

So I want a reject whenever the X-********-CrossTenantID is not 8888 ... He seems to ignire th '!'

How can I say conditionally if it does not match do that ... Or can I use only :


if /^X-MS-Exchange-CrossTenant-id:/
!/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
/X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID Correct
endif


2017-09-13 18:01 GMT+02:00 Noel Jones <[hidden email]>:
On 9/13/2017 9:02 AM, Robby Van Mieghem wrote:
> Hi
>
> is there a way with header_checks to check if a field does not exist ?
>
> We want to reject mails that do not include the field
> X-MS-Exchange-CrossTenant-id

No, header_checks cannot check for a missing header.  It examines
each header individually with no knowledge of other headers.

You'll need to use a milter or content_filter to check for missing
headers.



  -- Noel Jones

Reply | Threaded
Open this post in threaded view
|

Re: Header_Checks non-exsiting field check

Noel Jones-2
On 9/14/2017 7:18 AM, Robby Van Mieghem wrote:

> OK tx
>
> Small other questions. Seems not to works also : assuming tenantid =
> 8888
>
> I have one line in header checks
>
> !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT Tenant-ID In-Correct
>
> So I want a reject whenever the X-********-CrossTenantID is not 8888
> ... He seems to ignire th '!'

The above will apply to all headers.  So eg. "Received: ..." doesn't
match and will cause the message to be rejected.

>
> How can I say conditionally if it does not match do that ... Or can
> I use only :
>
>
> if /^X-MS-Exchange-CrossTenant-id:/
> !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
> /X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID
> Correct
> endif


Yes, to test a specific header content, it needs to be in a IF/ENDIF
statement.




  -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Header_Checks non-exsiting field check

rolelael
Can there be more lines after the if .. endif

meaning I have 3 other checks to do ( not conditional ) , just a check if a field contains spec word 1, word2 or 3, depending on that FILTER smtp :

so

if /^X-MS-Exchange-CrossTenant-id:/ 
!/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
/X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID
endif
^route_gw:/ tst1/ FILTER smtpxxxxx
^route_gw:/ tst2/ FiLTER smtpxxxxx
^route_gw:/ tst3/ FILTER smtpxxxxxx

2017-09-14 19:41 GMT+02:00 Noel Jones <[hidden email]>:
On 9/14/2017 7:18 AM, Robby Van Mieghem wrote:
> OK tx
>
> Small other questions. Seems not to works also : assuming tenantid =
> 8888
>
> I have one line in header checks
>
> !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT Tenant-ID In-Correct
>
> So I want a reject whenever the X-********-CrossTenantID is not 8888
> ... He seems to ignire th '!'

The above will apply to all headers.  So eg. "Received: ..." doesn't
match and will cause the message to be rejected.

>
> How can I say conditionally if it does not match do that ... Or can
> I use only :
>
>
> if /^X-MS-Exchange-CrossTenant-id:/
> !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
> /X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID
> Correct
> endif


Yes, to test a specific header content, it needs to be in a IF/ENDIF
statement.




  -- Noel Jones

Reply | Threaded
Open this post in threaded view
|

Re: Header_Checks non-exsiting field check

Wietse Venema
Robby Van Mieghem:
> Can there be more lines after the if .. endif

Yes. Please RTFM: http://www.postfix.org/header_checks.5.html

    Wietse

> meaning I have 3 other checks to do ( not conditional ) , just a check if a
> field contains spec word 1, word2 or 3, depending on that FILTER smtp :
>
> so
>
> if /^X-MS-Exchange-CrossTenant-id:/
> !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
> /X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID
> endif
> ^route_gw:/ tst1/ FILTER smtpxxxxx
> ^route_gw:/ tst2/ FiLTER smtpxxxxx
> ^route_gw:/ tst3/ FILTER smtpxxxxxx
>
> 2017-09-14 19:41 GMT+02:00 Noel Jones <[hidden email]>:
>
> > On 9/14/2017 7:18 AM, Robby Van Mieghem wrote:
> > > OK tx
> > >
> > > Small other questions. Seems not to works also : assuming tenantid =
> > > 8888
> > >
> > > I have one line in header checks
> > >
> > > !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT Tenant-ID In-Correct
> > >
> > > So I want a reject whenever the X-********-CrossTenantID is not 8888
> > > ... He seems to ignire th '!'
> >
> > The above will apply to all headers.  So eg. "Received: ..." doesn't
> > match and will cause the message to be rejected.
> >
> > >
> > > How can I say conditionally if it does not match do that ... Or can
> > > I use only :
> > >
> > >
> > > if /^X-MS-Exchange-CrossTenant-id:/
> > > !/^X-MS-Exchange-CrossTenant-id: 8888/ REJECT TenantID-InCorrect
> > > /X-MS-Exchange-CrossTenant-id: 8888/ WARN Allowing mail  Tenant-ID
> > > Correct
> > > endif
> >
> >
> > Yes, to test a specific header content, it needs to be in a IF/ENDIF
> > statement.
> >
> >
> >
> >
> >   -- Noel Jones
> >