[exim] sieve filters from (ldap-)database

Top Page
Delete this message
Reply to this message
Author: Timo Boettcher
Date:  
To: exim-users
Subject: [exim] sieve filters from (ldap-)database
Hi,

I am trying to filter my mail with sieve-filters which I load from a
ldap-db. Loading the filter from the db and filtering works fine, but
when I to save the fildered mail to some folder or subfolder, it gets
lost (I still see it, but my imap server (courier-imap-3) doesn't).

What I found so far is:
Courier-imap uses "." as path-separator for subfolders, and sieve
seems to use "/", so for INBOX/subfolder I end up with
~/.maildir/INBOX/subfolder/mymail instead of
~/.maildir/.subfolder/mymail
I tried to solve that with some string-expansion on $address_file
in the forward_address_file transport when I actually deliver the
mail, but I hope there is a better way to do that...

TIA



userforward:
  driver = redirect
  condition = "${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?mailmessagestore?base}}"
  local_part_suffix = +* : -*
  local_part_suffix_optional
  data = "#Sieve filter\n${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?mailfilter?base}}"
  allow_filter
  user = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?uidnumber?sub?(objectclass=mailuser)} {$value} fail}
  group = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?gidnumber?sub?(objectclass=mailuser)} {$value} fail}
  no_verify
  no_expn
  check_ancestor
  syntax_errors_to = real-${local_part}@${domain}
  syntax_errors_text = "\
    This is  an automatically  generated message.  An error has\n\
    been found in your .forward file.  Details of the error are\n\
    reported below. While this error persists, you will receive\n\
    a copy of this message for  every message that is addressed\n\
    to you. If your .forward file is a filter file, or if it is\n\
    a  non-filter  file   that  contains  no  valid  forwarding\n\
    addresses,  a copy of each incoming message  will be put in\n\
    your mailbox.  If a non-filter file  contains  at least one\n\
    valid forwarding address,  forwarding to the valid addresss\n\
    will happen,  and those will  be the  only  deliveries that\n\
    will occur."
  forbid_include
  forbid_filter_lookup
  forbid_filter_perl
  forbid_filter_readfile
  forbid_filter_readsocket
  forbid_filter_reply
  forbid_filter_run
  forbid_pipe
  file_transport = forward_address_file



local_delivery:
  driver = appendfile
  maildir_format = true
  create_directory = true
  directory = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?mailmessagestore?sub?(objectclass=mailuser)}\
              {$value} fail}
  directory_mode = 0700
  user = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?uidnumber?sub?(objectclass=mailuser)} {$value} fail}
  group = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?gidnumber?sub?(objectclass=mailuser)} {$value} fail}
  mode = 0600
  delivery_date_add
  envelope_to_add
  return_path_add



forward_address_file:
  driver = appendfile
  maildir_format = true
  maildir_tag = ,S=$message_size
  create_directory = true
  directory_mode = 0700
  mode = 0600
  delivery_date_add
  envelope_to_add
  return_path_add
  directory = ${lookup ldap{user=LDAP_USER pass=LDAP_PASS\
              ldap://LDAP_HOST/uid=${quote_ldap_dn:${local_part}},\
              dc=${quote_ldap_dn:${domain}},ou=domains,LDAP_BASE\
              ?mailmessagestore?sub?(objectclass=mailuser)}\
              {$value/$address_file} fail}





Timo