[Dovecot] sieve addflag has stopped working

2010-02-15 Thread Andrew Schulman
Dovecot 1.2.10 in Debian, using Dovecot sieve.  

I have a sieve script, generated by Ingo, that's supposed to mark spam messages
as Seen and file them into the Junk folder.  In part it reads:

require [regex, body, imapflags, fileinto];

if exists X-Spam-Flag  { 
addflag \\Seen;
fileinto Junk;
removeflag \\Seen;
stop;
} 

This has been working correctly for a long time, but since about 2 weeks ago
now, the Seen flag isn't being set, although the messages are still being
filed into the Junk folder.  In two different mail clients, new messages in the
Junk folder show up as being unread.  Looking at the mail files that hold those
messages, the file names don't have an S flag appended, while older messages
all have the S and show up as already seen in the mail clients.

I don't believe that I've updated dovecot recently, so I'm not sure why the
behavior has changed.  Note that I do have

plugin {
  sieve_extensions = +imapflags
}

in dovecot.conf.  I know that imapflags is deprecated, but it is still supposed
to be supported.  Unfortunately ingo1 doesn't support imap4flags yet
(http://bugs.horde.org/ticket/8784).

I'm trying to find log information that might indicate an error, but I'm not
finding much.  /var/log/exim4/mainlog just says:

2010-02-15 14:22:14 1Nh6WK-000200-8z x...@xxx.xxx: deliver_pipe transport
output: deliver(andrex): Info: sieve:
msgid=ad58db2a42700ec0e5c924c8882d4...@yourmailnews.net: stored mail into
mailbox 'Junk'

The wiki says that there should be a log file ~/.dovecot.sieve.log, but there
isn't one, which I guess means there are no error messages.

Output of dovecot -a is below.  Any ideas why the Seen flag isn't being set any
more?

Thanks,
Andrew.

# dovecot -a
# 1.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.26 x86_64 Debian squeeze/sid 
base_dir: /var/run/dovecot   
log_path:
info_log_path:   
log_timestamp: %Y-%m-%d %H:%M:%S 
syslog_facility: mail
protocols: imap imaps managesieve
listen(default): localhost   
listen(imap): localhost  
listen(managesieve): localhost:2000  
ssl_listen: imap 
ssl: yes 
ssl_ca_file: 
ssl_cert_file: /etc/dovecot/helium-imaps.cert.pem
ssl_key_file: /etc/dovecot/helium-imaps.key.pem  
ssl_key_password:
ssl_parameters_regenerate: 0 
ssl_cipher_list: 
ssl_cert_username_field: commonName  
ssl_verify_client_cert: no   
disable_plaintext_auth: yes  
verbose_ssl: no  
shutdown_clients: yes
nfs_check: yes   
version_ignore: no   
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login   
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
login_user: dovecot  
login_greeting: Dovecot ready.   
login_log_format_elements: user=%u method=%m rip=%r lip=%l %c  
login_log_format: %$: %s 
login_process_per_connection: yes
login_chroot: yes
login_trusted_networks:  
login_process_size: 64   
login_processes_count: 3 
login_max_processes_count: 128   
login_max_connections: 256   
valid_chroot_dirs:   
mail_chroot: 
max_mail_processes: 512  
mail_max_userip_connections: 10  
verbose_proctitle: no
first_valid_uid: 500 
last_valid_uid: 0
first_valid_gid: 1   
last_valid_gid: 0
mail_access_groups:  
mail_privileged_group: mail  
mail_uid:
mail_gid:
mail_location: maildir:~/.mail   
mail_cache_fields:   
mail_never_cache_fields: imap.envelope   
mail_cache_min_mail_count: 0 

Re: [Dovecot] sieve addflag has stopped working

2010-02-15 Thread Andrew Schulman
 Andrew Schulman wrote:
  plugin {
sieve_extensions = +imapflags
  }
 
  in dovecot.conf.  I know that imapflags is deprecated, but it is still 
  supposed
  to be supported.  Unfortunately ingo1 doesn't support imap4flags yet
  (http://bugs.horde.org/ticket/8784).

 This is a known problem and it has been fixed in the repository:
 
 http://hg.rename-it.nl/dovecot-1.2-sieve/rev/a890258aa5a9
 
 This bug was actually present for quite some time. It was however 
 shadowed by another bug that was fixed in the latest release, exposing 
 this one.

That's kind of funny.

 You can apply the above change as a patch to fix the issue during the 
 time that there is no new release.

OK, thanks.  I'll file a bug report with Debian and see if they'll release a
patched version.

Thanks,
Andrew.



Re: [Dovecot] Web-Interface for Dovecot-Sieve?

2009-11-17 Thread Andrew Schulman
 is there anywhere a web-interface for managing sieve-filters with dovecot?

I've found Ingo1 (part of horde) to be the most capable web interface for
interactively constructing sieve rules.  Non-technical users can easily use
it to build and install filter scripts.

Someone please correct me if I'm wrong, but IIRC the managesieve interfaces
of Roundcube and Thunderbird only allow you to choose between existing
sieve scripts that are already available through the managesieve server.
They *don't* provide an interface for constructing sieve scripts in the
first place-- you still have to write them by hand.

Andrew.



Re: [Dovecot] Web-Interface for Dovecot-Sieve?

2009-11-17 Thread Andrew Schulman
 Hi,
 
  Someone please correct me if I'm wrong, but IIRC the managesieve interfaces
  of Roundcube and Thunderbird only allow you to choose between existing
  sieve scripts that are already available through the managesieve server.
  They *don't* provide an interface for constructing sieve scripts in the
  first place-- you still have to write them by hand.
 
 sorry, I have to correct you:
 
 With RoundCube 0.3 and the managesieve-plugin, you get an interface to 
 click the rules you want to apply:
 
 http://yfrog.com/31rcmanagesievep

OK, good.  I'm glad to be corrected, that is starting to look promising.

Compare http://www.horde.org/ingo/screenshots/rule.png .  For now, ingo
still appears to be more capable-- e.g. I find it essential to be able to
mark messages as Seen as I file them.  But roundcube is a good product
under steady development, and I won't be at all surprised if they catch up
or surpass ingo.

I've been using ingo and am happy with it, but to use it you have to
install and configure the whole horde framework-- a good amount of work,
and the only part of it I want is ingo.



Re: [Dovecot] Move to a Specific Folder

2009-09-18 Thread Andrew Schulman
 Will this solution works even if I had a lot of messages or subfolders?

Of course, if you know how to use the find(1) command.  Test it carefully
before you deploy it, though-- find | xargs rm is an extremely dangerous
combination, since you'll probably need several iterations to get the find
conditions right.

 Will this index update take much time?

I can't say for sure.  All I can say is that I've never noticed any
significant delay.  If you run the job daily, then index updates might be
smaller and take less time.  Even if Dovecot has to rebuild the whole
index, you could probably arrange to make that happen right after you run
your deletion job, at off hours.  A search for dovecot rebuild index
turns up some discussion of this problem.

Good luck,
Andrew.



Re: [Dovecot] Move to a Specific Folder

2009-09-18 Thread Andrew Schulman
  Is there a way to automatically expurge or move messages from a
  specific folder to another folder after X days?
 
 I use a daily cron job for this.  It runs a script that deletes messages
 more than 6 months old from the Junk folder.

Looking at my nightly spam control job, I see that it essentially runs

find ~/.mail/.Junk/{new,cur} -type f -mtime +180 -delete

which deletes all files in the Junk folder that are more than 180 days old.
If instead of deleting those files you wanted to move them into another
directory, say $targetdir, then you could replace -delete in the above by
e.g. 

-exec mv --target-directory=$targetdir '{}' +

See find(1) for details.
A.



Re: [Dovecot] Move to a Specific Folder

2009-09-17 Thread Andrew Schulman
 Is there a way to automatically expurge or move messages from a
 specific folder to another folder after X days?

I use a daily cron job for this.  It runs a script that deletes messages
more than 6 months old from the Junk folder.

If you can do this directly in Dovecot, then I guess that's better, because
it will keep the folder indexes up to date.  But I move messages around
outside of Dovecot and it works fine.  Dovecot updates the indexes when I
view the folder, and there's not much delay.

A.



Re: [Dovecot] Moving from cyrus to dovecot (a story)

2008-09-16 Thread Andrew Schulman
Rock on.  I agree, dovecot is very good.  I like the integration of imap server,
managesieve, and sieve-aware LDA all in one package.  Configuration is
straightforward, and since I set it up a few months ago it's been working
reliably without a thought from me.



Re: [Dovecot] Override config in deliver command line

2008-08-25 Thread Andrew Schulman
 In dovecot deliver LDA, is there a way to override some configuration
 settings for particular users?

No, I don't believe there is a way to do that at present.  And yes, it would be
a very useful and probably simple feature to add.  I'll add my voice to the
feature request for this.

I also needed to do this.  I ended up working around it by writing a script to
create a new temporary config file, with the settings replaced.  It's not
pretty, but it works.

Andrew.



Re: [Dovecot] Dovecot sieve plugin reject not working

2008-08-05 Thread Andrew Schulman
 When I send message from yahoo.com to my [EMAIL PROTECTED]
 account on this server no rejection notice is being sent back.  It looks
 like at the end of the log file section below that it is sending
 something back, but nothing shows up. Also see how the From is empty?
 I don't think this is postfix problem as I can send and receive mail
 through it fine.

I reported a related bug with the reject action here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489760 .  Seems to be different
from your case, though.



Re: [Dovecot] Deliver mail as 'read'?

2008-07-21 Thread Andrew Schulman
 On Mon, 2008-07-21 at 06:42 +0100, Peter Collinson wrote:
  I'd like to be able to deliver certain mail as 'read'  from procmail.  
 
 Only way I can think of would be with a Sieve script that uses the
 imap4flags extension to set the flag \seen.

Yes, that's what I did.  I wanted to file all identified spam into the user's
Junk folder, and mark it as read.  You can do it with sieve using the imap4flags
extension, but you have to use deliver as the LDA since that's the only one that
supports imap4flags AFAIK.

At first I set up exim to do this automatically, and it worked but it took
several steps to set up.  

Later I decided to let each user create a rule in their sieve scripts to do
this, so that they could override it by putting their whitelist rule first.  The
rule is simple to specify in e.g. Ingo, if you have that set up for your users
to create their sieve scripts.  Ingo generates the following sieve fragment:

# spam
if exists X-Spam-Flag  {
addflag \\Seen;
fileinto Junk;
removeflag \\Seen;
stop;
}

There is another way, though.  I used to mark messages read in kind of an ugly
way in maildrop, using an external call to formail(1), which comes with procmail
(at least on Debian).  See below.

Good luck,
Andrew.

# .mailfilter excerpt:
# spam filter
SPAMDIR=$HOME/.mail/.Junk
xfilter spamc   # SpamAssassin
if ( /^X-Spam-Flag: YES/ )
{
# mark as Read
xfilter formail -I\Status: R\
# deliver to the spam folder
cc $SPAMDIR
# mark it Read (in fact, mark all new spam messages as Read)
foreach (`ls $SPAMDIR/new`) =~ /[^ ]+/
{
exception {
`cd $SPAMDIR  mv new/$MATCH cur/${MATCH}:2,S`
}
}
exit
}



Re: [Dovecot] can't download attachment from the wiki

2008-07-05 Thread Andrew Schulman
  Hi.  At http://wiki.dovecot.org/ManageSieve#line-229 , I want to
  download the patch that's supposed to fix two problems in Avelsieve.
  Unfortunately, when I click on the link to the patch, I always get
  an error message:
 
  You are not allowed to do AttachFile on this page.
 
  Ouch, sorry, I advised Timo to disable AttachFile because somebody
  was using the dovecot wiki to distribute some key files for something
  that had nothing to do with dovecot.
 
  Johannes, thanks.  While we're waiting for that to get sorted out,
  could someone be so kind as to email me the patch?  Thanks, Andrew.

 Ok, that is not practical. I've recovered it from my mail discussion
 with Hanspeter Kunz who provided the definitive version of this patch.
 I've put it online here:

 http://www.rename-it.nl/dovecot/client-patches/avelsieve-1.9.7-dovecot.d
iff

Stephan, thank you.  I applied the patch and it seems to work fine.

For anyone else who wants the patch, I'm attaching it here in diff -urN 
format.

I hope we can get attachment downloads working soon in the wiki.

Thanks,
Andrew.

diff -urNb avelsieve.orig/include/managesieve.lib.php avelsieve/include/managesieve.lib.php
--- avelsieve.orig/include/managesieve.lib.php	2008-05-20 13:13:29.0 -0400
+++ avelsieve/include/managesieve.lib.php	2008-07-05 06:46:18.0 -0400
@@ -82,6 +82,12 @@
* a comma seperated list of allowed auth types, in order of preference
*/
   var $auth_types;
+
+  /** 
+   * options
+   */
+  var $broken_tls;
+
   /**
* type of authentication attempted
*/
@@ -311,6 +317,9 @@
 else
 $this-auth = $auth;
 $this-auth_types=$auth_types;	/* Allowed authentication types */
+
+$this-broken_tls = false;
+
 $this-fp=0;
 $this-line=;
 $this-retval=;
@@ -484,6 +493,10 @@
 } /* end if */
 elseif(is_string($this-modules))
 $this-capabilites[$this-cap_type][$this-module]=true;
+
+// set broken_tls. Older cyrus servers do not respond with 
+// capabilities after STARTTLS
+$broken_tls = true;
 }
 
 if(sieve::status($this-line) == F_NO){		//here we should do some returning of error codes?
@@ -504,8 +517,13 @@
 return false;
 } else {
 $this-loggedin = true;
-// RFC says that we need to ask for the capabilities again
+// RFC says that we get an unsolicited capability response after TLS negotiation. Older Cyrus
+// did not do this. If the server has old/broken TLS we need to send a CAPABILITY command,
+// otherwise we just parse the unsolicited capability response. 
+if ( $this-broken_tls )
 $this-sieve_get_capability();
+else
+$this-sieve_read_capability_response();
 $this-loggedin = false;
 }
 }
@@ -817,14 +835,11 @@
   }
 
   /**
-   * Return an array of available capabilities.
+   * Read incoming capability response.
*
* @return array
*/
-  function sieve_get_capability() {
-if($this-loggedin==false)
-return false;
-fputs($this-fp, CAPABILITY\r\n); 
+  function sieve_read_capability_response() {
 $this-line=fgets($this-fp,1024);
 
 $tmp = array();
@@ -876,8 +891,20 @@
 return $this-capabilities['modules'];
   }
 
-}
+  /**
+   * Return an array of available capabilities.
+   *
+   * @return array
+   */
+  function sieve_get_capability() {
 
+if($this-loggedin==false)
+return false;
+fputs($this-fp, CAPABILITY\r\n);
+
+return $this-sieve_read_capability_response();
+  }
+}
 
 /**
  * The following functions are support functions and might be handy to the
diff -urNb avelsieve.orig/table.php avelsieve/table.php
--- avelsieve.orig/table.php	2008-05-20 13:13:29.0 -0400
+++ avelsieve/table.php	2008-07-05 06:52:47.0 -0400
@@ -162,6 +162,7 @@
 	if (!$conservative) {
 		$s-login();
 		if(sizeof($rules) == 0) {
+		$s-setactive('');
 $s-delete('phpscript');
 			}  else {
 		$newscript = makesieverule($rules);


[Dovecot] can't download attachment from the wiki

2008-06-26 Thread Andrew Schulman
Hi.  At http://wiki.dovecot.org/ManageSieve#line-229 , I want to download
the patch that's supposed to fix two problems in Avelsieve.  Unfortunately,
when I click on the link to the patch, I always get an error message:

You are not allowed to do AttachFile on this page.

Annoying.  I've created an account and logged in, but still no joy.  Can
anyone suggest how or where else I can get that patch?

Thanks,
Andrew.