View Full Version : ispconfig3+dovecot with mailbox traffic
17th October 2010, 05:30
I had an older courier ispc3 system and converted it to dovecot for one of many reasons but one problem I didn run into is that ispc3 no longer tracks the mailbox traffic information (not that I really cared too much anyway). What makes it worse is that since it's not using procmail and instead using sieve, sieve has no way of writing to file (that I know of, possibly security reasons) so the ispconfig_mailsize files are no long updated.
Using dovecot settings, I had written a sieve wrapper which will process the emails sizes and create/append the files upon receiving mail.
I don't know how the new dovecot support works since 3.0.3 and how many people are using it. The sieve script and wrapper is still a bit quick patched up since I wrote it a while back but if there's interest, I'll release the code/howto.
17th October 2010, 11:18
Would be great if you could release that wrapper. Maybe it can be used in ispconfig to solve the mail statistics problem for dovecot servers.
17th October 2010, 12:20
i think it will be not only me thankfull for this!
i'm using 3.0.3 with dovecot
18th October 2010, 03:13
I have been running it now for months now and so far it's been successful but i only have 1 little issue to resolve and that is that since this is opensource there's the problem that I'm using a localhost email address which is the processing agent (php script) that takes care of counting it.
The problem itself is that anyone outside can telnet to the server and send heaps of emails to the "mailtrafficlogger@localhost" or whatever address either to exploit it (attack php itself) or to artificially inject traffic to an account that never got the traffic... if you get what I mean.
The way I did it is to write a global sieve script which all mailboxes receiving the mail will run this script, it auto forwards the emails to the local scripted alias address which does the processing.
One solution i thought of is forcing the admin installing the script to generate their own email, possibly using an md5 or something eg. 80b0cb7936ebf798b1ca4305b6f313e9@localhost
Then alias from that.
there's the other thing which I haven't actually checked yet is that if 2 people in the same domain are sent the same email, is it counted as 2x traffic (1 for each) or just the 1.. I believe it's counting as 1 atm...
any suggestions are helpful. I'll modify and release as I clean it up.
18th October 2010, 10:04
Ok, so your approach is similar to what we have used in ispconfig 2. One other solution for dovecot might be to use the dovecot rawlog. I've read about that log but I was not able to test it yet. This log shall contain the mailsize as well.
19th October 2010, 03:13
Yeah at the time I didn't realise the change to dovecot would affect this so when I noticed what was happening and so in the rush to simulate how it was being done in the past was do to the same in dovecot/sieve although couldn't write to a file so opted for an alias script. works well so far.
23rd August 2011, 10:59
any news to this topic? On our servers there is also dovecot running an we are heavily interested in implementing the mailbox-traffic-monitoring feature.
I did a bit of research and came across the rawlog-feature for dovecot (http://wiki1.dovecot.org/Debugging/Rawlog). Maybe it's possible to use that feature instead of sieve-stuff. Had no time to test the feature so far.
24th August 2011, 01:13
rawlog would be the ideal way as it wouldnt need special permissions or sieve scripting etc.
Without doubling checking the logs I believe you would have to script it well enough to pickup the size=[0-9]+ value on 1 log line and then chase the recipients names in upcoming lines as it aren't on the same log line entry making it a wee bit trickier. You would have to track the queue id and then find the recipients on the line with the same queue id.
This is going off memory but whatever the case, it's possible.
24th August 2011, 09:25
Just checked out the rawlog feature - the problem seems to be that those logfiles are simply exploding because they "log" also the attachments sent. So basically I send a couple of test-mails - one containing an attachment - and the dovecot.rawlog directory came up with 500 kb. That seems to be a damn lot of hdd-space (if you think not about one but about one-hundred users).
I wonder if the mail.log wouldn't be another interesting starting point - I mean awstats is able to log the mailbox traffic.
25th August 2011, 00:49
actually, I was thinking of logtail with a script as most of you probably realised. then you can run it every minute or so and process the mail.log. shouldn't be too hard.
25th August 2011, 10:54
After some research: I've to admit that this is too hard for me. Maybe you pick that up? Otherwise we've to live with awstats log-facilities for the moment.
Edit: Just came across mysqmail which logs postfix + dovecot /courier + ftp traffic in a mysql-db. Obviously it was also discussed earlier that year here (http://www.howtoforge.com/forums/showthread.php?t=51029).
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.