Re: Strange mail appeared in one of mailboxes

2006-04-03 Thread Scott Bronson
On Mon, 2006-04-03 at 11:07 +0200, Olaf Fraczyk wrote:
> Hi,
> 
> In one of mailboxes I got strange mail with no subject,no sender, no
> body. Anybody knows what could be the source of this message?

I saw this a few times when I was setting up a custom deliver script.
When I accidentally printed the message to stdout instead of the deliver
process's filehandle, I would get empty messages.

Basically, my script had perfect protocol interaction, it just didn't
supply any data.  In other words, I had rfc821 working perfectly but no
rfc822.

FWIW,  - Scott


Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Help with a Sieve script

2006-04-01 Thread Scott Bronson
There are two simple Sieve scripts that I would like to write:

I need to unconditionally save a copy of each incoming message,
organized by the recipient's name.  Is it possible to write a global
Sieve script to do something like this?

fileinto :address :localpart;
keep;

If not, then what's the best way of doing this?


Also, on a personal note, I'm on a lot of mailing lists and need to
modify my Sieve scripts every time I subscribe or unsubscribe.  It's
starting to get painful.  Can I just automatically file each list based
on its List-Id?  That would leave me only a few lists that would have to
be special-cased.

if header :matches "List-Id" /([A-Za-z][A-Za-z0-9_-]*)/ {
fileinto "mail.$1";
}

The second one at least appears possible in Gnu Mailutils Sieve.  Are
either of these requirements possible in Cyrus Sieve?  Thanks!

- Scott



Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Can't get sieve to send mail

2006-03-30 Thread Scott Bronson
On Thu, 2006-03-30 at 11:05 -0500, Ken Murchison wrote:
> > 2. Add a debug message that says that the notification daemon could not
> >be contacted so the notification is being dropped on the floor.  That
> >way the problem would have been less silent.
> 
> There *are* LOG_ERR messages (imap/notify.c) when we fail to talk to 
> notifyd.  You should have these in your logs.

I didn't get anything at all in the logs.  Probably because notifyd
wasn't listend in cyrus.conf?  Or maybe because I didn't have
"sievenotifier: mailto" in imapd.conf.  If the latter, then maybe a
debug message saying "notification dropped because sievenotifier isn't
set" would have helped.

Thanks for making the rest of those changes!

- Scott





Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Can't get sieve to send mail

2006-03-30 Thread Scott Bronson
On Thu, 2006-03-30 at 08:01 -0500, Ken Murchison wrote:
> Is notifyd running?  Can it find the 'sendmail' binary?

Ah.  I thought notifyd was just for mail notifications, not sieve too.
I was misled by this entry in imapd.conf(5):

  notifysocket: {configdirectory}/socket/notify
   Unix domain socket that the new mail notification daemon listens
   on.

So I didn't enable notifyd when installing.  Now it's running hunky
dory.


Might I suggest some changes so others don't suffer the same fate?

1. change the description of notifysocket in imapd.conf(5) to be
   applicable to more than new mail notification:

   old: Unix domain socket that the new mail notification...
   new: Unix domain socket that the notification daemon listens on.

2. Add a debug message that says that the notification daemon could not
   be contacted so the notification is being dropped on the floor.  That
   way the problem would have been less silent.

3. The notification sent by sieve has the subject "New mail
   notification."  That's a little strange.  Is there any way to
   change the subject so it doesn't overlap with actual new mail
   notifications?  The Sieve notification could be sent for any
   reason.

4. master/conf/normal.conf, make notifyd sound a bit more critical:
   change: # this is only necessary if using notifications
   # notify cmd="notifyd" ...
   to: # this is necessary when using notifications
   notify cmd="notifyd" ...

   Why not enable notifyd by default?  Proper notification is a rather
   important part of sieve filtering isn't it?

Anyhow, I'm glad it works.  Thanks for your help.  And for Cyrus!

- Scott





Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Can't get sieve to send mail

2006-03-29 Thread Scott Bronson
I'm running Cyrus 2.3.0.  Sieve works perfectly except that it
steadfastly refuses to send a notification.  For instance, with the
following script (generated by Avelsieve):

address :contains ["to", "cc"] "_deny"
{
   fileinto "INBOX.test";
   notify :method "mailto" :options "[EMAIL PROTECTED]" :low :message
"Hey, no kidding.  Did this work?";
}

The message gets filed into INBOX.test, but I never receive the
notification.  The cyrus logs don't show any sort of problem and my
mailer logs show that Cyrus never tried to contact it to send the
notification.

It's like that last line was steadfastly ignored.

Can anyone tell me how to track this down?  Thanks.

- Scott



Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: Log message: No worthy mechs found

2003-07-10 Thread Scott Bronson
On Thu, 2003-07-10 at 05:19, Ken Murchison wrote:
> What is this perl script trying to do?  Can you get a protocol dump?

The script:

I require a server-side sent directory.  That way, I don't have to try
to synchronize the sent directory on the three clients that I use, and
we have a copy of every outgoing mail sent

So, in Postfix, I say:   always_bcc = storesent
and in /etc/aliases: storesent: |/usr/sbin/storesent

That way, Postfix invokes this script on every message that passes
through the mail server.  The script throws out the messages with
non-local origin and then saves the rest in the appropriate user's
mailbox.  I've been doing this for years on Courier -- it takes
about a 10-line script.

Here's where the authentication happens:

my $userid = shift;

my $cl = Cyrus::IMAP::Admin->new('localhost');
die "Could not connect to Cyrus server" .
($! ? ": $!\n" : "\n") unless $cl;

my $rc = $cl->authenticate('-user' => $user, '-password' => $pass);
die "Could not log in: " . $cl->error . "\n" unless $rc;

# check for the existence of the Sent folder
unless( $cl->list("user.$userid.$sent") ) {
# doesn't exist, so create it.
$cl->create("user.$userid.$sent");
die "Could not create user.$userid.$sent: " .
$cl->error . "\n" if $cl->error;
}

...

I've included the entire script as an attachment.

It must be possible to get a protocol dump, but I'm not sure how.
Is there a flag I can turn on in Perl to get the Cyrus::IMAP::Admin
module to log all LMTP traffic?  Feel free to comment, no matter how
harshly.  :)

Thanks,

- Scott

#!/usr/bin/perl -w

# storesent
# Scott Bronson
# 3 July 2003


# TODO: should report errors via an email message.
# TODO: right now Return-Path on stored messages is [EMAIL PROTECTED]  Prolly want to fix this.

# This script is called by the Postfix local transport to automatically
# deliver messages into a user's Sent mail folder.
# This works for Cyrus.  Simple modifications would be needed for Courier.

# How to install:
# 1) Put "always_bcc = storesent" in /etc/postfix/main.cf
# 2) Put "storesent = |/usr/local/sbin/storesent" in /etc/aliases
# 3) Run "newaliases" and "postdfix reload".  That's it!
# 4) On my system, I need to do this to get it to work (I haven't
#figured out why): "chown cyrus storesent; chmod u+s storesent"
#This is a very minor but totally unnecessary security risk.
# 5) "chmod go-r" so regular users can't see the password.


# There is only one known bug: if you send a message to a mailing
# list, that message will usually be reflected back to you.  Since
# you are listed as the sender in that message, and there's no easy
# way to tell that it is from a mailing list and not directly from
# the user, it will be stored in your Sent folder.  This is not a
# problem if your IMAP server removes dupes (like Cyrus).


use strict;


# the following three lines are only used by ensure_folder_exists().
# If you create all the Sent folders ahead of time, you can delete
# these three lines, the routine itself, and the one line that calls it.
use Cyrus::IMAP::Admin;
my $user = 'root';	# username of an IMAP administrator
my $pass = 'PASSPASS';	# his/her PASSWORD   < < <   % % % % % 


# These should be configured for the local site:
my $sent = "Sent";	# name of the sent mail mailbox
my %ignores = ( 'root' => 1, 'daemon' => 1 );
my $deliver = "/usr/sbin/cyrdeliver";


# allow this script to run suid
$ENV{PATH} = '/bin:/usr/bin';


#
# 	Use postconf to tell us the value of $mydomain
#

open(CONF, "-|", "/usr/sbin/postconf", "-h", "mydomain")
	or die "Could not execute /usr/sbin/postconf: $!\n";
my $mydomain = ;
chomp $mydomain;
close CONF or die "Error running /usr/sbin/postconf: $1\n";


#
# 	Read headers into @msgheaders.  Each header will be a
# 	single element in this ordered set of multi-line strings.
#

my @msgheaders;
while(  ) {
last if /^\s*$/;  # empty line markes the end of the headers
if( /^\s/ ) {
# Any line in the header beginning with whitespace is a
# continuation of the previous header.
$msgheaders[$#msgheaders] .= $_;
} else {
push @msgheaders, $_;
}
}


#
# 	Decide whether to store in sent mail or not.  If the sender's
# 	domain is the same as $mydomain, then sender is local.  If
# 	not, we throw it away.
#

my $sender = $ENV{'SENDER'};

if( $sender =~ /^\s*([EMAIL PROTECTED])\@(?:\S+\.)?$mydomain\s*$/ && !$ignores{$1} ) {
	my $userid = $1;
	ensure_folder_exists($userid);
	open(OUT, 

Re: Log message: No worthy mechs found

2003-07-09 Thread Scott Bronson
On Wed, 2003-07-09 at 14:05, Ken Murchison wrote:

> It looks like your perl script is trying to authenticate to your server 
> using DIGEST-MD5 and failing.
...
> Yes.  Read doc/options.html in the SASL distro.  I'm guessing that you want:
>   sasl_mech_list: PLAIN

Thanks, Ken.  That helped a lot.  It got rid of two of the log
messages, but the "no worthy mechs" remains.

   auth.log:Jul  9 18:15:28 eden perl: No worthy mechs found
   auth.log:Jul  9 18:17:24 eden perl: No worthy mechs found
   auth.log:Jul  9 18:17:42 eden perl: No worthy mechs found
   auth.log:Jul  9 18:20:19 eden perl: No worthy mechs found

After reading the documentation, my configuration looks correct
to me...

   sasl_mech_list: PLAIN
   sasl_pwcheck_method: auxprop
   sasl_auxprop_plugin: sasldb

Any ideas?  I'm not getting any other related messages.  I really
have no idea how Perl can't find any worthy mechs, yet the script
still works.  :)



Log message: No worthy mechs found

2003-07-09 Thread Scott Bronson
I have tons of log messages (level=notice, log=auth) from "perl"
claiming:

Jul  8 11:26:46 eden cyrus/imapd[30661]: DIGEST-MD5 server step 2
Jul  8 11:26:46 eden perl: DIGEST-MD5 client step 3
Jul  9 10:33:22 eden perl: No worthy mechs found

Well, this sure sounds SASL-related, not Perl.  :)  Does anybody know
what it is trying to tell me?  My mail system appears to work fine.

My imapd.conf says:

sasl_mech_list: pam

Is this wrong?

Either way, I can log in and perform all IMAP transactions just fine.
But I WOULD like to know how to make this log message go away.

Thanks!

- Scott






Re: Logs filling with strange error

2003-07-07 Thread Scott Bronson
As long as they don't indicate something amiss, I can live with them.
Thanks.

- Scott



On Mon, 2003-07-07 at 12:54, Ken Murchison wrote:
> These are harmless (I could give you a technical reason if you care). 
> Reduce you logging level from DEBUG down to something like INFO or 
> NOTICE and these will disappear.
> 
> 
> Scott Bronson wrote:
> 
> > Can anyone tell me why my logs are filling with messages
> > like these?
> > 
> > Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
> > filedescriptor 0: Bad file descriptor
> > Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
> > filedescriptor 1: Bad file descriptor
> > Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
> > filedescriptor 2: Bad file descriptor
> > Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
> > filedescriptor 0: Bad file descriptor
> > Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
> > filedescriptor 1: Bad file descriptor
> > Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
> > filedescriptor 2: Bad file descriptor
> > 
> > Why would cyrus even TRY to shut down STDIN, STDOUT, and
> > STDERR?
> > 
> > - Scott
> > 
> > 
> > 
> > 



Logs filling with strange error

2003-07-07 Thread Scott Bronson
Can anyone tell me why my logs are filling with messages
like these?

Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
filedescriptor 0: Bad file descriptor
Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
filedescriptor 1: Bad file descriptor
Jul  5 17:41:08 eden cyrus/lmtpd[28993]: Could not shut down
filedescriptor 2: Bad file descriptor
Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
filedescriptor 0: Bad file descriptor
Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
filedescriptor 1: Bad file descriptor
Jul  5 17:41:09 eden cyrus/imapd[28983]: Could not shut down
filedescriptor 2: Bad file descriptor

Why would cyrus even TRY to shut down STDIN, STDOUT, and
STDERR?

- Scott