Re: [exim] peel off a layer

Pàgina inicial
Delete this message
Reply to this message
Autor: Magnus Holmgren
Data:  
A: exim-users
Assumpte: Re: [exim] peel off a layer
On Wednesday 28 March 2007 16:45, Ronan McGlue wrote:
> I want to set up and 'easy' way for users to submit messages for
> whitelisting / blacklisting and spamassassin submission.
>
> The easiest way i can think of ( ~ 4000 active users) who will be on an
> exchange server within 3 months, is to just get them to forward the
> message(s) to an address ie notspam@qub or spam@qub. What i will then
> have to do is parse it, see who it is from and then submit it using the
> appropriate hook in SA.
>
> So i need to peel of the forwarding encapsulation in exim, how feasible
> is this, and how accurate will it be to the original message?!


I'm not saying that this is the best way or even a good way, but a possible
way of doing it within Exim could be with help of the MIME ACL. Example:

In the RCPT ACL:

  accept  acl = our_user
          domains = kibibyte.se
          local_parts = ham : spam
          set acl_m_learn = ${if !def:acl_m_learn {$local_part} \
                  {error}}


(The our_user ACL checks that the sender is a local or authenticated user.)

In the MIME ACL:

  deny    condition = ${if eq {$acl_m_learn}{error}}
          message = "You cannot learn a message as ham and spam simultaneously."
  accept  condition = ${if def:acl_m_learn}
          condition = ${if eq{$mime_content_type}{message/rfc822}}
          !condition = $mime_is_rfc822
          decode = /var/spool/exim4/$acl_m_learn/$message_exim_id-$mime_part_count


(/var/spool/exim4/spam and /var/spool/exim4/ham should be created in advance.
Non-Debian users would likely replace "exim4" with just "exim".)
Here, other checks can be implemented to ensure that the attached message is
suitable for feeding to sa-learn (or spamc -L).

Last, a router:

learn_attached:
  driver = redirect
  condition = ${if def:acl_m_learn \
                   {${run {/bin/sh -c "sa-learn --$acl_m_learn /var/spool/$acl_m_learn/$message_exim_id-*"}{1}{1}}}}
  data = :blackhole:


A glob expansion operator had been useful here (I didn't want to create a new
subdirectory for every message). Instead of blackholing the carrier message,
it could be saved somewhere, or an autoreply be sent (but that would probably
become annoying). Instead of sa-learn --$acl_m_learn, spamc -L $acl_m_learn
might be used instead, but then each message has to be passed separately on
stdin. Instead of using a router, the attached messages could be passed to
sa-learn right in the MIME ACL, but that would make load control harder.

Again, this is just a silly example.

-- 
Magnus Holmgren        holmgren@???
                       (No Cc of list mail needed, thanks)


"Exim is better at being younger, whereas sendmail is better for
Scrabble (50 point bonus for clearing your rack)" -- Dave Evans