RE: [Exim] Exim with vacation

Pàgina inicial
Delete this message
Reply to this message
Autor: Bernard Stern
Data:  
A: Johnson, Michael, 'J.Strohschnitter', debian_br, exim-users
Assumpte: RE: [Exim] Exim with vacation
On Wed, 17 Jul 2002 08:30:35 -0400 "Johnson, Michael" wrote:

> How would this work for virtual hosting? Would you have to do like a lsearch
> on the aliases file for that virtual domain?


I have written a set of perl scripts/cgis that enable our users to
setup vacation mail schedules in advance/immediately using a web
interface, which makes the whole $HOME stuff irrelevant. Using this
interface, users don't even to have unix logins (which most really
don't need). Authentication is done "a la mailman".

> -MJ


> Hi there,


> here is our configuration in exim.conf. The user just only has to create a
> file in his/her HomeFileSet, named .vacation filled with text.


> Add this into TRANSPORTS CONFIGURATION:


> ######################################################################
> #                       VACATION RESPONSE                            #
> ######################################################################
> vacation_transport:
>         driver = autoreply
>         user = ${local_part}
>         file = ${home}/.vacation
>         once = ${home}/vacation-once
>         log  = ${home}/vacation.log
>         return_message = true
>         text = "\
>         =============================================================\n\n\
>         Your Message\n\
>         =============================================================\n\n\n"
>         to = "${sender_address}"
>         subject =  "${if def:h_Subject: {VACATION: $h_Subject:} {ISome words
> ...}}"



exim 3 here, not yet migrated to exim 4.

I'd strongly advise that you took some precautions with the
original subject, as it can potentially contain non printable
characters thus ruining your intentions. I have the following:


vacation_delivery:
  driver  = autoreply
  from    = ${local_part}-vacation@$domain
  to      = $sender_address
  subject = ${if def:header_subject:\
                {${if match {$header_subject:} {^\\s*\$}\
                    {I am on vacation}\
                    {VACATION-RE: ${quote:${escape:${length_50:$header_subject:}}}}\
                  }\
                }\
                {I am on vacation}\
             }
  text = "\
    Dear $header_from:,\n\n\
    This is an automatic reply. Feel free to send additional mail,\n\
    as this one notice will be generated every one week only. The\n\
    following is a prerecorded message, sent for ${local_part}@${domain}.\n\n\
    =================================================================\n\n\
    "
  file_expand
  once_repeat = 7d
  return_message
  mode = 0660
  file = WITAN_USERS/${lc:$domain}/${lc:$local_part}/VAC_MSG
  log  = WITAN_USERS/${lc:$domain}/${lc:$local_part}/VAC_LOG
  once = WITAN_USERS/${lc:$domain}/${lc:$local_part}/VAC_ONCE



It also has the advantage to provide a valid subject if there is
no subject or if the subject is empty. The WITAN stuff is relevant
to the web interface stuff.


> And this into DIRECTORS CONFIGURATION:


> ######################################################################
> #                       VACATION RESPONSE                            #
> #                                 #
> ######################################################################
> vacation_user:
>         driver = localuser
>         transport = vacation_transport
>         user = ${local_part}
>         require_files = ${local_part}:${home}/.vacation
>         no_expn
>         no_verify
>         unseen



Here also, I'd strongly advise you to make a few preliminary
checks to avoid unecessary vacation messages to lists... such
behaviour very quickly gets your users off lists, and angry
messages to yourself (assuming you are the local postmaster).
Here is what I do:

vacation_users:
  driver = smartuser
  suffix = +*
  suffix_optional
  require_files = WITAN_USERS/${lc:$domain}/${lc:$local_part}/VAC_MSG
  condition = "${if and { H_TO_CC_MATCH_LOCALPART \
                          SENDER_NOT_NIL          \
                          H_SUBJ_NOT_CIRCULAR     \
                          H_FROM_NOT_MATCH_ADMINS \
                          SENDER_NOT_MATCH_ADMINS \
                          PRECEDENCE_NOT_JUNK     \
                        }  \
                    {yes}  \
                    {no}   \
                }"
  transport = vacation_delivery
  user = WITAN_UID
  group = WITAN_GID
  unseen


Naturally you'll want to replace the macros with your local
config stuff. For instance, I have

SENDER_NOT_NIL          = {!eq{$sender_address}{}}
H_SUBJ_NOT_CIRCULAR     = {!match{${lc:$header_subject:}}{circular}}
H_FROM_NOT_MATCH_ADMINS = {!match{${lc:$header_from:}}{root}}     \
                          {!match{${lc:$header_from:}}{daemon}}   \
                          {!match{${lc:$header_from:}}{server}}   \
                          {!match{${lc:$header_from:}}{-admin}}   \
                          {!match{${lc:$header_from:}}{-request}} \
                          {!match{${lc:$header_from:}}{-owner}}   \
                          {!match{${lc:$header_from:}}{owner-}}




If you're interested in the Witan stuff, this is what I reply usually
to interested people (note, however, that this "standard reply" is
now rather dated; Witan is running at our site since about one year;
note, also, that is little more that a dev version and is likely to
remain so, as I have no time at all to allocate to this project):


The current version is available at

http://www.switch.ch/misc/stern/witan-0.20.tar.gz

However, you'd like to read about the following, which I uncovered later
on when I tried to install the thing on one of our linux boxes.

MMhhhh... it is running at our site since about 6 months. However...
there is a big however, unfortunately. I have developped this under
sun solaris, works like a charm as mentionned, and then I tried to
install it on a Debian box. It won't work "as is" because when
firing up the cgis, which are perl scripts, the kernel finds there
is a security issue. I searched the web and found out about the "race
problem":

http://www.evolt.org/article/UNIX_File_Permissions_and_Setuid_Part_1/18/224/
http://www.evolt.org/article/UNIX_File_Permissions_and_Setuid_Part_2/18/263/

So a C wrapper around the perl scripts would solve this problem.
I could borrow similar such wrappers from other GPL software and
mention the origin of the borrowed software. This is not the
problem (actually I have contacted the mailman cabal (the mailman
core programmers), and the author, Barry Warsaw, does not see
a problem as long as my code is GPL, which it is). The problem
is that my software should ship with a configure.in and a set
of Makefile.in files for other to be able to install it without
hassles. I don't have any experience in this field and clearly
I cannot start this from scratch.

Since the web server on which my vacation mail web interface runs
in not open to the wild internet, the security issue involved
is drastically reduced.

If you know the Autoconf and Automake stuff, then you can
help here, or maybe you know someone who can help. Here at
my company there is no such knowledge.



Regards,

Bernard Stern, SWITCH

____________S_W_I_T_CH___Swiss Academic_______________________________________
        mail: SWITCH Head Office       a          Tel: +41 1 268 1520
              Limmatquai 138           n          Fax: +41 1 268 1568
              CH-8001 Zurich           d        e-mail: stern@???
________________________________________Reseach Network_______________________