Re: [Dovecot] antispam plugin signature-log backend with v1.1.2

2008-09-22 Thread Alexander Prinsier
Johannes Berg wrote:
 On Mon, 2008-09-22 at 00:59 +0200, Alexander Prinsier wrote:
 Hello,

 Is the signature-log backend of the antispam plugin broken when
 compiling with dovecot version 1.1.2? I'm using version 1.0 of the
 antispam plugin. It looks like there isn't anything more recent.
 
 It has never even worked correctly so I haven't bothered to update it
 for a long time, sorry. You can probably find some old notes from me
 about that on the list archive.

Oh it worked very fine for me with dovecot 1.0 :) I'll see what I can do
to fix it, or I'll use another version of dovecot if I can't get it fixed :)

Alexander



[Dovecot] antispam plugin signature-log backend with v1.1.2

2008-09-21 Thread Alexander Prinsier
Hello,

Is the signature-log backend of the antispam plugin broken when
compiling with dovecot version 1.1.2? I'm using version 1.0 of the
antispam plugin. It looks like there isn't anything more recent.

cc -c  -DCONFIG_DEBUG -DDEBUG_SYSLOG -fPIC -shared -Wall -Wextra
-DPLUGINNAME=antispam -DHAVE_CONFIG_H -I../dovecot-1.1.2/
-I../dovecot-1.1.2/src/ -I../dovecot-1.1.2/src/lib/
-I../dovecot-1.1.2/src/lib-storage/ -I../dovecot-1.1.2/src/lib-mail/
-I../dovecot-1.1.2/src/lib-imap/ -I../dovecot-1.1.2/src/lib-dict/
-I../dovecot-1.1.2/src/lib-index/ -I../dovecot-1.1.2/src/imap/ -o
signature-log.o signature-log.c
signature-log.c: In function ‘backend_start’:
signature-log.c:54: error: incompatible type for argument 2 of ‘dict_init’
signature-log.c:54: error: too few arguments to function ‘dict_init’
signature-log.c: In function ‘backend_handle_mail’:
signature-log.c:97: error: incompatible type for argument 2 of
‘mail_storage_set_error’
signature-log.c:97: error: too few arguments to function
‘mail_storage_set_error’
signature-log.c:128: error: incompatible type for argument 2 of
‘mail_storage_set_error’
signature-log.c:128: error: too few arguments to function
‘mail_storage_set_error’
make: *** [signature-log.o] Error 1

Thanks,
Alexander


Re: [Dovecot] enabling quota.

2008-06-30 Thread Alexander Prinsier
Mauro Sanna wrote:
 I'm reading http://wiki.dovecot.org/Quota to enable quota management
 with dovecot.
 The first question is: I need to enable dovecot deliver, lda protocol,
 to have quota work?
 

It depends on the backend you use. If you use filesystem quota's, then
there is no need to use the dovecot LDA, because the actual quota usage
is already being updated by the filesystem/kernel itself.

However if you use Maildir++ quota, then something has to update the
maildirsize file so that it contains the actual usage of that Maildir.
So you need the dovecot LDA here, or another LDA that can update those
files in a compatible way.

However I prefer to always use dovecot's deliver, because it
automatically updates indexes and caches when a mail arrives, and this
cannot be done by another LDA because the indexes and caches are dovecot
specific.

Alexander


Re: [Dovecot] enabling quota.

2008-06-30 Thread Alexander Prinsier
Mauro Sanna wrote:
 if I use dovecot deliver, in dovecot.conf I need to enable only
 
 protocol lda {
   mail_plugins = quota
 } 
 
 or I must enable also
 
 protocol pop3 {
   mail_plugins = quota
 }
 
 and in case I have imap
 
 protocol imap {
   mail_plugins = quota imap_quota
 }
 ?
 

You also need to specify what backend you want to use (fs quota,
maildir++ quota's, ...).

See here: http://wiki.dovecot.org/Quota/1.0

Alexander


Re: [Dovecot] dovecot as gmail imap proxy

2008-06-17 Thread Alexander Prinsier
To have a speed increase, dovecot needs direct access to the emails. So
you'll need them stored locally. You can't use it as a proxy, just to
speed up things, because dovecot would just need to wait for gmail too,
to load an email (except if dovecot would cache the emails, but then
again, it's just a cache, and you're talking about 'critical applications').

I'm not sure, but I don't think there's even a way to run dovecot as a
proxy.

Why don't you forward mail from your gmail account to your own server?
That's so much easier and more common. You get the benefit of good
filtering, and you have your own server to access your mail. If your own
server goes down, you still have gmail as backup.

Alexander

Farkas Levente wrote:
 hi,
 may be this is a bit of topic, but i hope not. it's always a big
 question which is the better to choose a hosting provider to keep and
 manage you mail or setup your own mail server, hosting, virus and spam
 filter etc.. now as more and more people and company move to gmail or
 google apps mail service it seems google can't handle the load and it's
 getting more and more slower. what's more not just the imap interface
 but nowadays the web interface used to be hang or even stop working.
 it's getting more and more annoying that the speed is worst than in a 10
 years ago. i thing about how can this be solved without totally give up
 gmail as a mail service provider (and may be they can solve it in a few
 months/years:-).
 would it be possible to create a dovecot server as an imap proxy for
 gmail and google apps?
 imho many people/company would be love to use such a setup where he can
 use gmail in vacation or any other time, but when the email is real
 critical apps (not acceptable to wait 1 minutes for an email to load or
 to open a folder/label) than he can use a proxy server eg. dovecot which
 act as a imap proxy to gmail and can be hosted on closer, faster server
 and this speed problem never happend. what's more it can be used as a
 mail backup server too.
 anybody has any such setup, idea? would it be possible with dovecot.
 any other suggestion?
 yours.
 



Re: [Dovecot] Need a quick, safe method to empty /home/user/Maildir/{.Junk, .Trash}

2008-06-12 Thread Alexander Prinsier
Jeff Kowalczyk wrote:
 Any thoughts on a variant using find -name that could safely iterate over
 /home/*/Maildir for all users? Otherwise I would script it in python.

What about:

find /home/*/Maildir/.Junk/cur -type f -delete

Alexander


Re: [Dovecot] Dovecot quota for mailadministrator

2008-05-27 Thread Alexander Prinsier
Markus Hofer wrote:
 With that way the administrator could have always a look if some
 users have quota problems.
 
 My question is, if dovecot has some similar command for the administrator?

It depends on what quota backend you use. If you use filesystem quota's
like I do, you can use the linux quota(1) command to see the status for
all users.

I'm not sure whether something alike exists for other quota backends.

Alexander


Re: [Dovecot] Dovecot quota for mailadministrator

2008-05-27 Thread Alexander Prinsier
Markus Hofer wrote:
 plugin {
  quota = maildir
  quota_rule = *:storage=1G
  quota_rule2 = Trash:storage=100M
 }

Ok, so you are using the Maildir++ format.

 I have the possibility to see the user LIMITs?

You could write a script that checks the contents of the maildirsize
files inside each Maildir. (it holds the limit, and the current size of
the maildir).

The specification of that format can be found here:
http://www.inter7.com/courierimap/README.maildirquota.html

I'm not sure there already exists a script just to do this. It's quite
easy to write one though.

Alexander


Re: [Dovecot] Dovecot or postfix Quota

2008-05-21 Thread Alexander Prinsier
Hello,

First of all, postfix doesn't support quota's by default. There is the
quota patch of course. But there is a reason that it isn't included by
default. (but I'm not sure what the exact reason is, if it's not the one
below).

Secondly, how do you define the quota of a mailbox? There are many ways
to do that. (Filesystem quota's, Maildir++ quota, and probably other
ways). Do you think it's the mail 'routing' system's job to know all
these different implementations?

Instead I think it's a cleaner (and more logical) way to let the mail
delivery agent take care of this, hence by deliver from dovecot.

Alexander

Adrián Ribao Martínez wrote:
 Hello,
 I'm a bit confused with the dovecot quota support. What is it for?
 I thought postfix should be the one managing the quota. If I set up a quota 
 in 
 dovecot, does dovecot keep the messages size under certain limit?
 What happen when you reach the quota limit?
 What's the difference between postfix quotas and dovecot quota?
 I'm confused about this.
 
 Thank you!



Re: [Dovecot] Dovecot or postfix Quota

2008-05-21 Thread Alexander Prinsier
Johannes Berg wrote:
 Instead I think it's a cleaner (and more logical) way to let the mail
 delivery agent take care of this, hence by deliver from dovecot.
 
 Any self-respecting mail administrator should avoid sending bounces like
 the plague, hence the need to check whatever you possibly can during the
 smtp transaction. Quota certainly ought to be checkable, and if you then
 accept a few mails too many due to race conditions I guess you don't
 really care.

I agree that bounces should be minimized. Still the most logical
solution would be that the MTA asks the MDA about the quota status.

However I don't know any way to let postfix ask the MDA about quota
status. Even bypassing the MDA, do you know of any software that plugs
into postfix that can check filesystem quota's?

I need to use filesystem quota's because I also need to set a group
quota (which is not only used for email, also for other files).

Alexander


Re: [Dovecot] Run command when moving messages

2008-04-20 Thread Alexander Prinsier
Hi,

The easiest way to do this seems to me is adapting the dspam backend of
the antispam plugin to a generic exec backend, that calls some program.

The antispam plugin was designed to do exactly this, monitoring moving
messages, so you better make use of it ;)

Alexander

Juan Asensio Sánchez wrote:
 Hi
 
 Is it possible to run a command when a message is moved from a folder
 to another? I want this to simulate the antispam plugin, so one script
 would be ran when a message is moved to/from the spam folder, so the
 sa-learn command would be called.
 
 Thanks



[Dovecot] building a simple antispam plugin

2008-04-19 Thread Alexander Prinsier
Hello,

I'm trying to build another antispam plugin, but some things are a bit
unclear.

In backend_handle_mail I put store the signature returned from
signature_extract into my antispam_transaction_context. In
backend_commit it appears that the signature is empty. (It wasn't in
backend_handle_mail).

Somehow between backend_handle_mail en backend_commit it has been
cleared... When I use i_strdup it appears to work. Anyone can tell me
where this clearing happens? Is i_strdup the right way to do it then?

Thanks,
Alexander


Re: [Dovecot] building a simple antispam plugin

2008-04-19 Thread Alexander Prinsier
Johannes Berg wrote:
 Hi,
 
 I'm trying to build another antispam plugin, but some things are a bit
 unclear.
 
 What are you trying to achieve? Just build another backend for my
 antispam plugin?
Yes, just another backend. It would be logging the signatures to a mysql
database, so that I can process the signatures with dspam at a
convenient time.

I'll use the sql functions available in the sql-api.h from dovecot. I'll
probably store a global sql_db, so I don't need to open/close
connections for every message.
 
 In backend_handle_mail I put store the signature returned from
 signature_extract into my antispam_transaction_context. In
 backend_commit it appears that the signature is empty. (It wasn't in
 backend_handle_mail).

 Somehow between backend_handle_mail en backend_commit it has been
 cleared... When I use i_strdup it appears to work. Anyone can tell me
 where this clearing happens? Is i_strdup the right way to do it then?
 
 Well, how did you put it in there? It's well possible that the memory
 was allocated on a stack or in a pool that has been cleared/freed...
My antispam_transaction_context contains a  const char* signature.

in backend_handle_mail:
ast-signature = signature_extract(t, mail);

Then in backend_commit:
debug(backend_commit %p SIG: %s CLASS: %u, ast, ast-signature ?
ast-signature : /, ast-classification);

signature appears to be an empty string there. When using i_strdup in
backend_handle_mail it seems to work.

Thanks,

Alexander


[Dovecot] using mysql from within a plugin

2008-04-19 Thread Alexander Prinsier
Hello,

I'm trying to access a mysql database in a plugin.

-What special compiler flags do I need? I discovered that when I don't
explicitly link lib-sql/libsql.a in, then I get an undefind symbol error
about sql_init when loading the plugin.

Shouldn't the imap process itself have sql support linked in, rather
than each plugin?

-It appears that I need to call sql_drivers_init() and
sql_drivers_register_all() before sql_init.

Again, shouldn't the imap process do this, instead of each plugin? It
should probably only be called once, so if one plugin already does it,
then the second one will create problems.

-When linking libsql.a in, and calling the functions mentioned above,
then I get this error when starting dovecot:

undefined symbol: mysql_ssl_set

I'm guessing it's part of the mysql library itself, not dovecot.

Can someone give me some hints on how to use dovecot's mysql library in
a plugin?

Thanks,

Alexander


Re: [Dovecot] localhost deliver([EMAIL PROTECTED]): setgid(5001) failed with euid=8, gid=8, egid=8: Operation not permitted

2008-04-12 Thread Alexander Prinsier
Install it setuid root as described here http://wiki.dovecot.org/LDA.

Alexander

Gert Cuykens wrote:
 How can i give lda dovecot permision to set user and goup id to 5001
 
 dovecot  unix  -   n   n   -   -   pipe
  flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender}
 -d ${recipient}



Re: [Dovecot] localhost deliver([EMAIL PROTECTED]): setgid(5001) failed with euid=8, gid=8, egid=8: Operation not permitted

2008-04-12 Thread Alexander Prinsier
I meant _setuid_ root, not owner root. You better lookup what this means
on google before doing it.

Reread the instructions on http://wiki.dovecot.org/LDA (section Multiple
UIDs). Set the group of the directory deliver is in to the same user
that postfix will use to run deliver. (You appear to be using 'mail').

See the manual page of chmod to know how to set a program setuid root.

Alexander

Gert Cuykens wrote:
 but deliver is already root ?
 
 and master is set as
 
   master {
path = /var/run/dovecot/auth-master
mode = 0600
user = mail
group = mail
   }
 
 [EMAIL PROTECTED]:~# ls -al /usr/lib/dovecot/deliver
 -rwxr-xr-x 1 root root 563112 2008-03-31 21:05 /usr/lib/dovecot/deliver
 [EMAIL PROTECTED]:~#
 
 i am sorry i dont understand what i need to do ?
 
 On Sat, Apr 12, 2008 at 4:03 PM, Alexander Prinsier
 [EMAIL PROTECTED] wrote:
 Install it setuid root as described here http://wiki.dovecot.org/LDA.

  Alexander



  Gert Cuykens wrote:
   How can i give lda dovecot permision to set user and goup id to 5001
  
   dovecot  unix  -   n   n   -   -   pipe
flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender}
   -d ${recipient}





Re: [Dovecot] localhost deliver([EMAIL PROTECTED]): setgid(5001) failed with euid=8, gid=8, egid=8: Operation not permitted

2008-04-12 Thread Alexander Prinsier
You realize that this way anyone can send email do any mailbox directly
by invoking deliver? The instructions told you to make a subdirectory,
and only give access to that subdirectory to users that need to be able
to deliver to any user. Then place a copy of deliver with setuid root in
that subdirectory.

You probably forgot to set postmaster_address in the lda section of
dovecot.conf.

Alexander

Gert Cuykens wrote:
 a thank you :) Now i learned something really important today
 
 chmod u+s /usr/lib/dovecot/deliver
 
 [EMAIL PROTECTED]:~# ls -al /usr/lib/dovecot/deliver
 -rwsr-xr-x 1 root root 563112 2008-03-31 21:05 /usr/lib/dovecot/deliver
 [EMAIL PROTECTED]:~#
 
 I think i am almost there but now i get
 
 Apr 12 19:01:40 localhost deliver([EMAIL PROTECTED]): postmaster_address
 setting not given



Re: [Dovecot] [PATCH] deliver tries to compile already compiled sieve script

2008-04-01 Thread Alexander Prinsier
Hello,

I've solved it. The compiled sieve script had the same mtime as the
uncompiled script. Dovecot used  to see if compilation is needed. It
has to be =.

If you wonder why the mtime is the same, I write and compile the sieve
script right after each other automated. Apparently mtime doesn't have a
good resolution in time...

Patch to dovecot-sieve-1.1.4 is attached, can it be included?

Thanks,

Alexander

Alexander Prinsier wrote:
 I should have mentioned I'm running dovecot 1.1.rc3
 
 Alexander
 
 Alexander Prinsier wrote:
 Hello,

 I'm trying to setup dovecot with sieve support in a way where all sieve
 scripts are precompiled. All sieve scripts are in /var/cache/sieve/.

 I believe I discovered a bug here. I describe below how to reproduce it.

 Dovecot and the user that deliver runs as do not have write permission
 in /var/cache/sieve/.

 h01:/var/cache/sieve# ls -la
 total 16
 drwxr-xr-x  2 ecp  ecp  4096 Mar 31 21:32 .
 drwxr-xr-x 10 root root 4096 Mar 31 20:14 ..
 -rw-r--r--  1 ecp  ecp88 Mar 31 21:32 [EMAIL PROTECTED]
 -rw-r--r--  1 ecp  ecp   132 Mar 31 21:32 [EMAIL PROTECTED]

 When deliver runs it logs this error:

 open(/var/cache/sieve/[EMAIL PROTECTED]) failed:
 Permission denied

 This indicates deliver tries to compile the script, even though the
 compiled version already is there.

 To verify I tested another case. I make the compiled script immutable
 and I did a chmod 777 on /var/cache/sieve/. Then deliver logs this error:

 rename(/var/cache/sieve/[EMAIL PROTECTED],
 /var/cache/sieve/[EMAIL PROTECTED]) failed: Operation not
 permitted

 And deliver created the file [EMAIL PROTECTED]

 Some relevant pieces of my dovecot.conf:

 protocol lda {
  mail_plugins = quota cmusieve
  ...
 }

 plugin {
  sieve = /var/cache/sieve/%u.sieve
 }

 Anyone can help me? Is this an error on my end, or really a bug?

 Alexander

 
 

--- dovecot-sieve-1.1.4.orig/src/sieve-cmu.c2008-02-16 19:24:51.0 
+0100
+++ dovecot-sieve-1.1.4/src/sieve-cmu.c 2008-04-01 11:30:24.0 +0200
@@ -869,7 +869,7 @@ dovecot_sieve_compile(script_data_t *sda
return -1;
}
} else {
-   if (st.st_mtime  st2.st_mtime)
+   if (st.st_mtime = st2.st_mtime)
return 1;
}
 


[Dovecot] deliver tries to compile already compiled sieve script

2008-03-31 Thread Alexander Prinsier
Hello,

I'm trying to setup dovecot with sieve support in a way where all sieve
scripts are precompiled. All sieve scripts are in /var/cache/sieve/.

I believe I discovered a bug here. I describe below how to reproduce it.

Dovecot and the user that deliver runs as do not have write permission
in /var/cache/sieve/.

h01:/var/cache/sieve# ls -la
total 16
drwxr-xr-x  2 ecp  ecp  4096 Mar 31 21:32 .
drwxr-xr-x 10 root root 4096 Mar 31 20:14 ..
-rw-r--r--  1 ecp  ecp88 Mar 31 21:32 [EMAIL PROTECTED]
-rw-r--r--  1 ecp  ecp   132 Mar 31 21:32 [EMAIL PROTECTED]

When deliver runs it logs this error:

open(/var/cache/sieve/[EMAIL PROTECTED]) failed:
Permission denied

This indicates deliver tries to compile the script, even though the
compiled version already is there.

To verify I tested another case. I make the compiled script immutable
and I did a chmod 777 on /var/cache/sieve/. Then deliver logs this error:

rename(/var/cache/sieve/[EMAIL PROTECTED],
/var/cache/sieve/[EMAIL PROTECTED]) failed: Operation not
permitted

And deliver created the file [EMAIL PROTECTED]

Some relevant pieces of my dovecot.conf:

protocol lda {
mail_plugins = quota cmusieve
...
}

plugin {
sieve = /var/cache/sieve/%u.sieve
}

Anyone can help me? Is this an error on my end, or really a bug?

Alexander



Re: [Dovecot] deliver tries to compile already compiled sieve script

2008-03-31 Thread Alexander Prinsier
I should have mentioned I'm running dovecot 1.1.rc3

Alexander

Alexander Prinsier wrote:
 Hello,
 
 I'm trying to setup dovecot with sieve support in a way where all sieve
 scripts are precompiled. All sieve scripts are in /var/cache/sieve/.
 
 I believe I discovered a bug here. I describe below how to reproduce it.
 
 Dovecot and the user that deliver runs as do not have write permission
 in /var/cache/sieve/.
 
 h01:/var/cache/sieve# ls -la
 total 16
 drwxr-xr-x  2 ecp  ecp  4096 Mar 31 21:32 .
 drwxr-xr-x 10 root root 4096 Mar 31 20:14 ..
 -rw-r--r--  1 ecp  ecp88 Mar 31 21:32 [EMAIL PROTECTED]
 -rw-r--r--  1 ecp  ecp   132 Mar 31 21:32 [EMAIL PROTECTED]
 
 When deliver runs it logs this error:
 
 open(/var/cache/sieve/[EMAIL PROTECTED]) failed:
 Permission denied
 
 This indicates deliver tries to compile the script, even though the
 compiled version already is there.
 
 To verify I tested another case. I make the compiled script immutable
 and I did a chmod 777 on /var/cache/sieve/. Then deliver logs this error:
 
 rename(/var/cache/sieve/[EMAIL PROTECTED],
 /var/cache/sieve/[EMAIL PROTECTED]) failed: Operation not
 permitted
 
 And deliver created the file [EMAIL PROTECTED]
 
 Some relevant pieces of my dovecot.conf:
 
 protocol lda {
   mail_plugins = quota cmusieve
   ...
 }
 
 plugin {
   sieve = /var/cache/sieve/%u.sieve
 }
 
 Anyone can help me? Is this an error on my end, or really a bug?
 
 Alexander