Re: How to write a milter with access to carddav

2018-03-16 Thread Andre Rodier

On 16/03/2018 15:36, Michael Munger wrote:

We've successfully written milters (Google pymilter) that check a
MySQL database to accept inbound mails for anyone who is in this
client's CRM system. Since the postfix box is a front-end to an
Exchange server, the milter triggers a FILTER relay:192.168.x.x
response to pass the email to Exchange without any further processing.

If your CardDav server is local, and uses MySQL as the backend, it's
easier to have a milter query MySQL directly. Depending on the size of
the DB, you will need to do some query optimization, get your indexes
set properly, etc... that will lower the query times and not add much
latency.

Our milter queries a 250K row table of contacts in 10ms, which adds
around 30ms latency to the inbound email based on log times.

If we had to do that over http with a multi-round trip 401
authorization and / or oath, that latency would skyrocket by
comparison.

My two cents.

 Michael Munger, dCAP, MCPS, MCNPS, MBSS
High Powered Help, Inc.
Microsoft Certified Professional
Microsoft Certified Small Business Specialist
Digium Certified Asterisk Professional
mich...@highpoweredhelp.com
On 03/12/2018 04:20 AM, André Rodier wrote:


Hello Bastian,

Thanks for the advice, I will consider it. I am pretty sure to know
how to do this.

However, because the CardDav server is on the same host, I think it
should not be an issue.

I made a few tests, and the performances are even better than some
anti-spam milters like SpamAssassin...

The other reason is I want to add headers to the email, and let the
users decide how they want to process personal emails.

Perhaps I can add headers with a global sieve filter as well, and
have the same result.

André.

On 12 March 2018 05:20:00 GMT+00:00, Bastian Blank
 wrote:

On Fri, Mar 09, 2018 at 11:53:00AM +, André Rodier wrote:

I would like to know if there is any milter for postfix that would

let

me query a CardDav server?

Well, don't.  Milter is latency sensitive and it will break mail
delivery if you don't manage to get it right.

If you use the correct Sieve implementation you can ask it to run
stuff
for you:



https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt


Bastian


Hello Michael,

Thanks for this, this is what I thought as well. The database should not 
contain more than a 100 contacts, and it local.


Python / PostgreSQL should do the trick.

--
https://github.com/progmaticltd/homebox


Re: How to write a milter with access to carddav

2018-03-16 Thread Michael Munger
We've successfully written milters (Google pymilter) that check a MySQL
database to accept inbound mails for anyone who is in this client's CRM
system. Since the postfix box is a front-end to an Exchange server, the
milter triggers a FILTER relay:192.168.x.x response to pass the email to
Exchange without any further processing.

If your CardDav server is local, and uses MySQL as the backend, it's
easier to have a milter query MySQL directly. Depending on the size of
the DB, you will need to do some query optimization, get your indexes
set properly, etc... that will lower the query times and not add much
latency.

Our milter queries a 250K row table of contacts in 10ms, which adds
around 30ms latency to the inbound email based on log times.

If we had to do that over http with a multi-round trip 401 authorization
and / or oath, that latency would skyrocket by comparison.

My two cents.

Michael Munger, dCAP, MCPS, MCNPS, MBSS
High Powered Help, Inc.
Microsoft Certified Professional
Microsoft Certified Small Business Specialist
Digium Certified Asterisk Professional
mich...@highpoweredhelp.com 
On 03/12/2018 04:20 AM, André Rodier wrote:
> Hello Bastian,
>
> Thanks for the advice, I will consider it. I am pretty sure to know how to do 
> this.
>
> However, because the CardDav server is on the same host, I think it should 
> not be an issue. 
>
> I made a few tests, and the performances are even better than some anti-spam 
> milters like SpamAssassin...
>
> The other reason is I want to add headers to the email, and let the users 
> decide how they want to process personal emails.
>
> Perhaps I can add headers with a global sieve filter as well, and have the 
> same result.
>
> André.
>
> On 12 March 2018 05:20:00 GMT+00:00, Bastian Blank 
>  wrote:
>> On Fri, Mar 09, 2018 at 11:53:00AM +, André Rodier wrote:
>>> I would like to know if there is any milter for postfix that would
>> let
>>> me query a CardDav server?
>> Well, don't.  Milter is latency sensitive and it will break mail
>> delivery if you don't manage to get it right.
>>
>> If you use the correct Sieve implementation you can ask it to run stuff
>> for you:
>>
>> https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt
>>
>> Bastian



Re: How to write a milter with access to carddav

2018-03-12 Thread André Rodier
Hello Bastian,

Thanks for the advice, I will consider it. I am pretty sure to know how to do 
this.

However, because the CardDav server is on the same host, I think it should not 
be an issue. 

I made a few tests, and the performances are even better than some anti-spam 
milters like SpamAssassin...

The other reason is I want to add headers to the email, and let the users 
decide how they want to process personal emails.

Perhaps I can add headers with a global sieve filter as well, and have the same 
result.

André.

On 12 March 2018 05:20:00 GMT+00:00, Bastian Blank 
 wrote:
>On Fri, Mar 09, 2018 at 11:53:00AM +, André Rodier wrote:
>> I would like to know if there is any milter for postfix that would
>let
>> me query a CardDav server?
>
>Well, don't.  Milter is latency sensitive and it will break mail
>delivery if you don't manage to get it right.
>
>If you use the correct Sieve implementation you can ask it to run stuff
>for you:
>
>https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt
>
>Bastian

-- 
André Rodier


Re: How to write a milter with access to carddav

2018-03-11 Thread Bastian Blank
On Fri, Mar 09, 2018 at 11:53:00AM +, André Rodier wrote:
> I would like to know if there is any milter for postfix that would let
> me query a CardDav server?

Well, don't.  Milter is latency sensitive and it will break mail
delivery if you don't manage to get it right.

If you use the correct Sieve implementation you can ask it to run stuff
for you:

https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt

Bastian

-- 
The heart is not a logical organ.
-- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4


Re: How to write a milter with access to carddav

2018-03-11 Thread J Doe
Hi Andre,

> On Mar 9, 2018, at 6:53 AM, André Rodier  wrote:
> 
> Hello,
> 
> I would like to know if there is any milter for postfix that would let
> me query a CardDav server?
> 
> The idea is to add a custom header, for instance 'X-Address-Book:
> Personal' if the from email address is referenced in a personal carddav
> address book of the recipient.
> 
> This will be used by a sieve filter, for instance to mark the emails as
> "Personal" / or "importants", al GMail, to keep them in the inbox.
> 
> Otherwise, if you can point me in a direction on how to write this, I
> will be happy. I can write it in Go, C, Perl, Python, etc.
> 
> I hope it's clear, thanks for your help.

I don’t have a solution to your question but out of curiosity, what is your 
CardDAV backend ?

- J


Re: How to write a milter with access to carddav

2018-03-11 Thread Andre Rodier

On 10/03/2018 16:29, J Doe wrote:

Hi Andre,


On Mar 9, 2018, at 6:53 AM, André Rodier  wrote:

Hello,

I would like to know if there is any milter for postfix that would let
me query a CardDav server?

The idea is to add a custom header, for instance 'X-Address-Book:
Personal' if the from email address is referenced in a personal 
carddav

address book of the recipient.

This will be used by a sieve filter, for instance to mark the emails 
as

"Personal" / or "importants", al GMail, to keep them in the inbox.

Otherwise, if you can point me in a direction on how to write this, I
will be happy. I can write it in Go, C, Perl, Python, etc.

I hope it's clear, thanks for your help.


I don’t have a solution to your question but out of curiosity, what is
your CardDAV backend ?

- J

Hello J,

I don't know yet which back-end I am going to use, I used Davical by the 
past. Basically, there is two conditions:


- authentication through LDAP
- included in Debian

I have not reached the point to add the CardDav server yet, but soon.

I may have a look to Sogo as well.

The project is here: https://github.com/progmaticltd/homebox

Kind regards,
André