Re: Working Vacation?? [solved?]
Hi, Gary Mills says Sendmail can rewrite header addresses for local delivery. This works well. It's only the envelope recipient that has the domain stripped. And it has only taken a week or two to figure out how to prevent that... cyrusv2.mc patch: -cyrusv2.mc- # divert(-1) # # (C) Copyright 2000 by Carnegie Mellon University # # This sample mc file is for a site that uses the Cyrus IMAP server # exclusively for local mail. This requires Sendmail 8.10 or later. # # $Id: cyrusv2.mc,v 1.4 2001/08/23 23:26:56 leg Exp $ divert(0)dnl VERSIONID(`cyrus v2 sample configuartion') OSTYPE(linux) define(`confBIND_OPTS',`-DNSRCH -DEFNAMES') define(`confTO_IDENT',`0') dnl setting cyrus as the trusted user will make it easier to pass dnl Sendmail's safefile checks. however, it means that someone with the dnl cyrus password could easily become root. dnl define(`confTRUSTED_USER', `cyrus') define(`confLOCAL_MAILER', `cyrus') dnl if you aren't using Sendmail 8.12, you might need to remove dnl the following feature. FEATURE(`preserve_local_plus_detail') FEATURE(`nocanonify') FEATURE(`always_add_domain') MAILER(`local') MAILER(`smtp') MAILER_DEFINITIONS Mcyrus, P=[IPC], F=lsDFMnqA@/:|SmXz, E=\r\n, - S=EnvFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix, + S=EnvFromL, R=HdrToL, T=DNS/RFC822/X-Unix, A=FILE /var/imap/socket/lmtp LOCAL_RULE_0 Rbb + $+ @ $=w . $#cyrus $: + $1 Dump `EnvToL/' from R= and you get working sieve vacations. The fix turned out to be rather trivial. Does anyone spot problems with this? On Thu, 23 Jan 2003 08:25:05 -0600, Gary Mills [EMAIL PROTECTED] wrote... On Thu, Jan 23, 2003 at 08:02:42PM +0900, Mark Keasling wrote: Sendmail is removing the domain part from smtp envelope TO addresses (RCPT TO) when they are sent to the local deliverer in my case LMTP. Apparently, there is no way to avoid this obnoxious behavior. Hacking on sendmail.cf has had no effect. Yes, sendmail assumes that the domain name is not needed for the envelope recipient for local delivery. No vacation reply gets sent because lmtpd substitutes unspecified-domain for the domain which was removed by sendmail. Its to me check fails because user@unspecified-domain is definitely not in the message's headers. Yes, when I was debugging this, I found that CCing the message to user@unspecified-domain would cause vacation to work! The following patches seem to fix the sieve vacation problem. It would be nice if these patches could be incorporated into the main source so that other people who use sendmail can have vacations too. If someone spots a problem with these patches or notices a deficiency PLEASE let me know how they should be fixed as I'll be putting them into production use RSN. I'm using a similar set of patches. I did submit them to the Cyrus maintainers, but they were rejected as unnecessary. There will be some interactions with aliases where [EMAIL PROTECTED] [EMAIL PROTECTED] and [EMAIL PROTECTED] are all equivalent and all are used. Mail sent to one address will get vacation replies while mail sent to the others will not. I know of no simple way to solve this unless sendmail is kind enough to rewrite the addresses in the message header. Sendmail can rewrite header addresses for local delivery. This works well. It's only the envelope recipient that has the domain stripped. -- -Gary Mills--Unix Support--U of M Academic Computing and Networking- Regards, Mark Keasling [EMAIL PROTECTED]
Re: Working Vacation?? [solved?]
On Thu, 23 Jan 2003, John Alton Tamplin wrote: Mikael Brandström wrote: It should be possible to rewrite rulset Parse0 (and maybe Parse1) to make them leave the local adress qualified while delivering locally. There might even be something among the files in cf/cf which kan fix it, I have a vague memory of something such. Just my 2c. I made changes locally that amounted to always setting $@ whenever $#local was selected as a mailer (for mailers that don't use $h, it shouldn't matter at all). If you redefine the local mailer to be cyrusv2, then look for $#cyrusv2. The places that have to be changed are: Ruleset 0, change: R@$#local $: @ special case error msgs to R@$#local $@ $M $: @special case error msgs (if you aren't masquerading use $j instead of $M -- it could be cleaned up so it would work for more general configs but I was in a hurry to get something working for our setup). In Ruleset Parse1, change: R $+ + $* $+ $#local $: $1 + $2 plussed name? to R $+ + $* @ $+$#local $@ $3 $: $1 + $2plussed name? and then the last two rules in Parse1 change from: R$=L$#local $: @ $1 special local names R$+ $#local $: $1regular local names to R$=L$#local $@ $M $: @ $1special local names R$+ $#local $@ $M $: $1 regular local names Remember that tabs separate the columns, not spaces. Then in the mailer definition, you can pass $u@$h rather than just $u. I am currently using my own deliver program which then connects to LMTP -- this should work for the stock deliver program as well, but for direct LMTP delivery from sendmail you will have to get more creative. I haven't tried it, but it should be possible to copy ruleset EnvFromSMTP to something else and modify it to add @$h to the end of the address if $h is defined, and then change the cyrusv2 mailer to use that for the envelope sender rewrite ruleset. This is what I use (no sendmail m4 hacking neccessary). FEATURE(`mailertable', ... define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_', `1')dnl FEATURE(`virtusertable', ... Mcyrus, P=[IPC], F=1lsDFMnqAmXzS, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, T=DNS/RFC822/SMTP, A=FILE $h virtusertable: [EMAIL PROTECTED] [EMAIL PROTECTED] mailertable: domain.com lmtp:/var/imap/socket/lmtp Hope this helps. If anyone wants patches to the stock sendmail 8.12.7 proto.m4 file, I will be happy to send them with the usual disclaimers (I have not made any effort to make the changes more general, just working for our particular configuration -- YMMV). I also have changes (including 3 lines of source changes) to allow the w flag to be used with a local mailer yet pass through any users that aren't listed in getpwent (ie, I wanted to have user .forward files yet still allow delivery to shared mailboxes). This hack is even more likely to be a problem in the future, as they are likely to eventually use the flag letter 'y' for something else, but if you want them just ask. One day when I get time I will clean these up and try and submit them to see if they will get included. -- Igor
Re: Working Vacation?? [solved?]
On Fri, 24 Jan 2003, John Alton Tamplin wrote: Igor Brezac wrote: virtusertable: [EMAIL PROTECTED] [EMAIL PROTECTED] So you have to have an entry in virtusertable for every user on the domain? Yes. What is the _mbox%3 part for? userid_mbox is really meant to be a name of the mailbox. %3 handles plussed email addresses, [EMAIL PROTECTED] -- Igor
Re: Working Vacation?? [solved?]
Hi, Sieve is not sending vacation replies. Why? Here's my stab... in the dark... Sieve vacation wants a domain part for the rcpt to address for its Was the message send directly to me as opposed to being sent to an alias or got to me some other way check. Being sent directly to me means my address will appear verbatim in either the TO, CC or BCC headers. It is comparing the stmp envelope's TO to the addresses in the message header. Sendmail is removing the domain part from smtp envelope TO addresses (RCPT TO) when they are sent to the local deliverer in my case LMTP. Apparently, there is no way to avoid this obnoxious behavior. Hacking on sendmail.cf has had no effect. No vacation reply gets sent because lmtpd substitutes unspecified-domain for the domain which was removed by sendmail. Its to me check fails because user@unspecified-domain is definitely not in the message's headers. What I did was to: add parseaddr_getdomain() to lib/parseaddr.c which retrieves the domain name. It returns unspecified-domain if no domain name was set. add parseaddr_setdomain(domain) to lib/parseaddr.c which sets the domain name. call parseaddr_setdomain(config_servername) in imap/config.c after config_servername has been set. call parseaddr_getdomain() in lib/parseaddr.c and sieve/message.c before setting unspecified-domain. The following patches seem to fix the sieve vacation problem. It would be nice if these patches could be incorporated into the main source so that other people who use sendmail can have vacations too. If someone spots a problem with these patches or notices a deficiency PLEASE let me know how they should be fixed as I'll be putting them into production use RSN. There will be some interactions with aliases where [EMAIL PROTECTED] [EMAIL PROTECTED] and [EMAIL PROTECTED] are all equivalent and all are used. Mail sent to one address will get vacation replies while mail sent to the others will not. I know of no simple way to solve this unless sendmail is kind enough to rewrite the addresses in the message header. lib/parseaddr.h *** parseaddr.h.old Thu Jan 23 18:14:19 2003 --- parseaddr.h Thu Jan 23 17:53:59 2003 *** *** 64,69 --- 64,71 extern void parseaddr_list P((const char *s, struct address **addrp)); extern void parseaddr_free P((struct address *addr)); + extern void parseaddr_setdomain P((const char *domain)); + extern char * parseaddr_getdomain (); #endif /* INCLUDED_PARSEADDR_H */ lib/parseaddr.c *** parseaddr.c.old Thu Jan 23 18:15:38 2003 --- parseaddr.c Thu Jan 23 17:56:11 2003 *** *** 189,194 --- 189,197 newaddr-mailbox = mailbox; + if ( domain !*domain) { + domain = parseaddr_getdomain(); + } if (domain !*domain) { domain = parseaddr_unspecified_domain; } *** *** 364,367 --- 367,389 return c; } } } + + /* + * manage the default domain + */ + static char *parseaddr_domain_name = (char *)0; + + void parseaddr_setdomain (domain) + const char * domain ; + { + if (parseaddr_domain_name) free(parseaddr_domain_name); + if (domain *domain) parseaddr_domain_name = xstrdup(domain) ; + else parseaddr_domain_name = (char*)0; + } + + char * parseaddr_getdomain () + { + if (parseaddr_domain_name) return parseaddr_domain_name; + return unspecified-domain; + } sieve/message.c *** message.c.old Thu Jan 23 19:15:02 2003 --- message.c Thu Jan 23 17:16:15 2003 *** *** 460,466 #define U_USER unknown-user if (a-mailbox || a-domain) { char *m = a-mailbox ? a-mailbox : U_USER; ! char *d = a-domain ? a-domain : U_DOMAIN; am-freeme = (char *) xmalloc(strlen(m) + strlen(d) + 2); --- 460,468 #define U_USER unknown-user if (a-mailbox || a-domain) { char *m = a-mailbox ? a-mailbox : U_USER; ! /* char *d = a-domain ? a-domain : U_DOMAIN; */ + char *d = a-domain ? a-domain : parseaddr_getdomain(); + if (!d || !*d) d = U_DOMAIN; am-freeme = (char *) xmalloc(strlen(m) + strlen(d) + 2); Many thanks to all the busy people, in particular Ken Murchison, who have provided assistance without recompense. Your accomulated wisdom pointed me in the right direction. You have my humble thanks such as they may be. Regards, Mark Keasling [EMAIL PROTECTED]
Re: Working Vacation?? [solved?]
On Thu, Jan 23, 2003 at 08:02:42PM +0900, Mark Keasling wrote: Sendmail is removing the domain part from smtp envelope TO addresses (RCPT TO) when they are sent to the local deliverer in my case LMTP. Apparently, there is no way to avoid this obnoxious behavior. Hacking on sendmail.cf has had no effect. Yes, sendmail assumes that the domain name is not needed for the envelope recipient for local delivery. No vacation reply gets sent because lmtpd substitutes unspecified-domain for the domain which was removed by sendmail. Its to me check fails because user@unspecified-domain is definitely not in the message's headers. Yes, when I was debugging this, I found that CCing the message to user@unspecified-domain would cause vacation to work! The following patches seem to fix the sieve vacation problem. It would be nice if these patches could be incorporated into the main source so that other people who use sendmail can have vacations too. If someone spots a problem with these patches or notices a deficiency PLEASE let me know how they should be fixed as I'll be putting them into production use RSN. I'm using a similar set of patches. I did submit them to the Cyrus maintainers, but they were rejected as unnecessary. There will be some interactions with aliases where [EMAIL PROTECTED] [EMAIL PROTECTED] and [EMAIL PROTECTED] are all equivalent and all are used. Mail sent to one address will get vacation replies while mail sent to the others will not. I know of no simple way to solve this unless sendmail is kind enough to rewrite the addresses in the message header. Sendmail can rewrite header addresses for local delivery. This works well. It's only the envelope recipient that has the domain stripped. -- -Gary Mills--Unix Support--U of M Academic Computing and Networking-
Re: Working Vacation?? [solved?]
On Thu, 23 Jan 2003 at 08:25, Gary Mills wrote: On Thu, Jan 23, 2003 at 08:02:42PM +0900, Mark Keasling wrote: Sendmail is removing the domain part from smtp envelope TO addresses (RCPT TO) when they are sent to the local deliverer in my case LMTP. Apparently, there is no way to avoid this obnoxious behavior. Hacking on sendmail.cf has had no effect. Yes, sendmail assumes that the domain name is not needed for the envelope recipient for local delivery. It should be possible to rewrite rulset Parse0 (and maybe Parse1) to make them leave the local adress qualified while delivering locally. There might even be something among the files in cf/cf which kan fix it, I have a vague memory of something such. Just my 2c. Mikael
Re: Working Vacation?? [solved?]
Mikael Brandström wrote: It should be possible to rewrite rulset Parse0 (and maybe Parse1) to make them leave the local adress qualified while delivering locally. There might even be something among the files in cf/cf which kan fix it, I have a vague memory of something such. Just my 2c. I made changes locally that amounted to always setting $@ whenever $#local was selected as a mailer (for mailers that don't use $h, it shouldn't matter at all). If you redefine the local mailer to be cyrusv2, then look for $#cyrusv2. The places that have to be changed are: Ruleset 0, change: R@$#local $: @ special case error msgs to R@$#local $@ $M $: @special case error msgs (if you aren't masquerading use $j instead of $M -- it could be cleaned up so it would work for more general configs but I was in a hurry to get something working for our setup). In Ruleset Parse1, change: R $+ + $* $+ $#local $: $1 + $2 plussed name? to R $+ + $* @ $+$#local $@ $3 $: $1 + $2plussed name? and then the last two rules in Parse1 change from: R$=L$#local $: @ $1 special local names R$+ $#local $: $1regular local names to R$=L$#local $@ $M $: @ $1special local names R$+ $#local $@ $M $: $1 regular local names Remember that tabs separate the columns, not spaces. Then in the mailer definition, you can pass $u@$h rather than just $u. I am currently using my own deliver program which then connects to LMTP -- this should work for the stock deliver program as well, but for direct LMTP delivery from sendmail you will have to get more creative. I haven't tried it, but it should be possible to copy ruleset EnvFromSMTP to something else and modify it to add @$h to the end of the address if $h is defined, and then change the cyrusv2 mailer to use that for the envelope sender rewrite ruleset. If anyone wants patches to the stock sendmail 8.12.7 proto.m4 file, I will be happy to send them with the usual disclaimers (I have not made any effort to make the changes more general, just working for our particular configuration -- YMMV). I also have changes (including 3 lines of source changes) to allow the w flag to be used with a local mailer yet pass through any users that aren't listed in getpwent (ie, I wanted to have user .forward files yet still allow delivery to shared mailboxes). This hack is even more likely to be a problem in the future, as they are likely to eventually use the flag letter 'y' for something else, but if you want them just ask. One day when I get time I will clean these up and try and submit them to see if they will get included. -- John A. Tamplin Unix System Administrator Emory University, School of Public Health +1 404/727-9931
Re: Working Vacation??
Hi Ken, On Fri, 10 Jan 2003 12:43:12 -0500, Ken Murchison [EMAIL PROTECTED] wrote... Did you try sieve/test on your script and a message? I've finally had a chance to try sieve/test on the script and a message as you suggested. The test program after asking questions decided to send a vacation response. However, the same message sent through lmtp to a user with a vacation script doesn't cause a vacation reply. I've hacked in the sieve/script.c VACATION section. Adding syslog LOG_DEBUG calls where SIEVE_DONE is set. It gets to the section where it tries to find my address in the headers TO, CC or BCC. However, myaddr contains test@unspecified-domain rather than [EMAIL PROTECTED] and since it can't find the unspecified-domain address in the headers, it bails out and doesn't send a vacation response. Where does unspecified-domain come from? How can I fix it? I was connecting directly to sendmail so I'm certain that I didn't enter the unspecified-domain. I suppose that sendmail is stripping off the domain part. helo test.air.co.jp mail from: [EMAIL PROTECTED] rcpt to: [EMAIL PROTECTED] data Date: Wed, 22 Jan 2003 17:21:09 +0900 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Test Message-ID: [EMAIL PROTECTED] Test message text goes here . quit Here is the cyrus entry from sendmail.cf if that helps any. Mcyrus, P=[IPC], F=lsDFMnqA@/:|SmXz, E=\r\n, S=EnvFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix, A=FILE /var/imapd/socket/lmtp Regards, Mark Keasling [EMAIL PROTECTED]
Working Vacation??
Hi, Has anyone got sieve's vacation notifications to work? If you have, can you post your imapd.conf and cyrus.conf files and a sieve script? Haven't been able to get it to work, think everything has been tried and have run out of hair... ;) Regards, Mark Keasling [EMAIL PROTECTED]
Re: Working Vacation??
Mark Keasling wrote: Hi, Has anyone got sieve's vacation notifications to work? If you have, Yes. Since I fixed it in 1.6.x. :) can you post your imapd.conf and cyrus.conf files and a sieve script? Haven't been able to get it to work, think everything has been tried and have run out of hair... ;) Why don't you post your configs, along with any relevant imapd.log and maillog entries? What MTA are you using? Have you tried a redirect or reject? This will verify that you can send out responses, vacation has more complexity. Have you tried passing a message and your script through the sieve test program (sieve/test.c)? 9 times out of 10, this problem is because your MTA chokes on the sendmail command line passed to it, or the address matching in Sieve fails. -- Kenneth Murchison Oceana Matrix Ltd. Software Engineer 21 Princeton Place 716-662-8973 x26 Orchard Park, NY 14127 --PGP Public Key--http://www.oceana.com/~ken/ksm.pgp
Re: Working Vacation??
Hi Ken, I can get a rejection; but, I can't get a vacation. Here's the info you requested. -sieve script- require [fileinto, notify, vacation, reject]; if allof( header :contains :comparator i;octet [Subject] [TEST] ) { vacation :subject I wanna vacation Yes, I really wanna vacation ; } if allof( header :contains :comparator i;octet [Subject] [Reject] ) { reject This is a rejection notice; } -cyrus.conf- START { recover cmd=ctl_cyrusdb -r } SERVICES { imap cmd=imapd listen=imap prefork=0 imaps cmd=imapd -s listen=imaps prefork=0 pop3 cmd=pop3d listen=pop3 prefork=0 pop3s cmd=pop3d -s listen=pop3s prefork=0 lmtp cmd=lmtpd listen=lmtp prefork=0 lmtpunix cmd=lmtpd listen=/var/imap/socket/lmtp prefork=0 sieve cmd=timsieved listen=sieve prefork=3 notifycmd=notifyd listen=/var/imap/socket/notify proto=udp prefork=1 } EVENTS { checkpointcmd=ctl_cyrusdb -cperiod=30 delprune cmd=ctl_deliver -E 3 period=1440 tlsprune cmd=tls_prune period=1440 } -imapd.conf- configdirectory: /export/home/cyrus/imap/config partition-default: /export/home/cyrus/imap/default sasl_pwcheck_method: auxprop hashimapspool: yes sievedir: /export/home/cyrus/imap/sieve # usually # sievenotifier: null # mailnotifier: null # but currently sievenotifier: log mailnotifier: log notifysocket: /var/imap/socket/notify admins: cyrus circus allowplaintext: false altnamespace: false unixhierarchysep: false -imapd.log- Jan 10 10:27:39 air master[11328]: [ID 965400 local6.notice] process started Jan 10 10:27:39 air master[11330]: [ID 392559 local6.debug] about to exec /opt/imap/bin/ctl_cyrusdb Jan 10 10:27:39 air ctl_cyrusdb[11330]: [ID 702911 local6.notice] recovering cyrus databases Jan 10 10:27:46 air ctl_cyrusdb[11330]: [ID 127214 local6.notice] done recovering cyrus databases Jan 10 10:27:46 air master[11328]: [ID 139525 local6.notice] ready for work Jan 10 10:27:46 air master[11360]: [ID 392559 local6.debug] about to exec /opt/imap/bin/tls_prune Jan 10 10:27:46 air master[11361]: [ID 392559 local6.debug] about to exec /opt/imap/bin/ctl_deliver Jan 10 10:27:46 air master[11362]: [ID 392559 local6.debug] about to exec /opt/imap/bin/ctl_cyrusdb Jan 10 10:27:46 air ctl_cyrusdb[11362]: [ID 702911 local6.notice] checkpointing cyrus databases Jan 10 10:27:46 air master[11363]: [ID 392559 local6.debug] about to exec /opt/imap/bin/timsieved Jan 10 10:27:46 air sieve[11363]: [ID 518349 local6.debug] executed Jan 10 10:27:46 air master[11364]: [ID 392559 local6.debug] about to exec /opt/imap/bin/notifyd Jan 10 10:27:46 air notify[11364]: [ID 518349 local6.debug] executed Jan 10 10:27:46 air tls_prune[11360]: [ID 275131 local6.notice] skiplist: recovered /export/home/cyrus/imap/config/tls_sessions.db (0 records, 144 bytes) in 0 seconds Jan 10 10:27:46 air tls_prune[11360]: [ID 383969 local6.notice] tls_prune: purged 0 out of 0 entries Jan 10 10:27:46 air master[11328]: [ID 310780 local6.debug] process 11360 exited, status 0 Jan 10 10:27:46 air master[11365]: [ID 392559 local6.debug] about to exec /opt/imap/bin/timsieved Jan 10 10:27:46 air sieve[11365]: [ID 518349 local6.debug] executed Jan 10 10:27:47 air ctl_cyrusdb[11362]: [ID 578205 local6.debug] archiving database file: /export/home/cyrus/imap/config/mailboxes.db Jan 10 10:27:47 air ctl_cyrusdb[11362]: [ID 448116 local6.debug] archiving log file: /export/home/cyrus/imap/config/db/log.01 Jan 10 10:27:48 air ctl_cyrusdb[11362]: [ID 127214 local6.notice] done checkpointing cyrus databases Jan 10 10:27:48 air master[11328]: [ID 310780 local6.debug] process 11362 exited, status 0 Jan 10 10:27:48 air master[11370]: [ID 392559 local6.debug] about to exec /opt/imap/bin/timsieved Jan 10 10:27:48 air sieve[11370]: [ID 518349 local6.debug] executed Jan 10 10:27:53 air ctl_deliver[11361]: [ID 275131 local6.notice] skiplist: recovered /export/home/cyrus/imap/config/deliver.db (53 records, 2834412 bytes) in 7 seconds Jan 10 10:27:53 air ctl_deliver[11361]: [ID 730478 local6.notice] duplicate_prune: pruning back 3 days Jan 10 10:27:53 air ctl_deliver[11361]: [ID 371192 local6.notice] duplicate_prune: purged 0 out of 53 entries Jan 10 10:27:53 air master[11328]: [ID 310780 local6.debug] process 11361 exited, status 0 Jan 10 10:30:21 air master[11383]: [ID 392559 local6.debug] about to exec /opt/imap/bin/lmtpd Jan 10 10:30:21 air lmtpunix[11383]: [ID 518349 local6.debug] executed Jan 10 10:30:21 air lmtpd[11383]: [ID 921384 local6.debug] accepted connection Jan 10 10:30:21 air lmtpd[11383]: [ID 685068 local6.debug] lmtp connection preauth'd as postman Jan 10 10:30:21 air lmtpd[11383]: [ID 100061 local6.debug] duplicate_check: [EMAIL PROTECTED] user.testuser2 0 Jan 10 10:30:21 air notifyd[11364]: [ID 921384 local6.debug] accepted connection Jan 10 10:30:21 air notifyd[11364]: [ID 414469 local6.debug] do_notify using method 'log'