0

I'm using exim4 on Debian 8. I'm using maildir. I have an Exim Filter file that tries to store incoming mail in folders named by their domain.

The problem is that when Exim creates a new directory the permissions are 700 but they need to be 770.

The router:

v_user_filters:
  driver = redirect
  domains = dsearch;/etc/exim4/virtual_domains
  local_parts = lsearch;/etc/exim4/virtual_domains/$domain/passwords
  user = virtual
  group = virtual
  check_owner = false
  file = /home/virtual/$domain/$local_part/filter.forward
  no_verify
  no_expn
  check_ancestor
  allow_filter
  forbid_smtp_code = true
  directory_transport = address_directory
  file_transport = address_file
  pipe_transport = address_pipe
  reply_transport = address_reply

The transport:

address_file:
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add
  directory_mode = 0770

Note the directory_mode which apparently does this:

If appendfile creates any directories as a result of the create_directory option, their mode is specified by this option.

The filter:

# exim filter
# File by domain.

if ${sg{${sg{$reply_address}{^.*?@}{}}}{>\$}{}} matches "^[a-zA-Z0-9-](\.[a-zA-Z
then
    # This horrible regex substitution:
    # inner sg: strip off everything from beginning of reply_address to and incl @
    # middle sg: strip off trailing > if found
    # outer sg: convert dots to - since dots mean sub-folders and we don't want example/com we want example-com 
    save /home/virtual/$domain/$local_part/.${sg{${sg{${sg{$reply_address}{^.*?@
    finish
endif

1 Answer 1

0

The problem is that when Exim creates a new directory the permissions are 700 but they need to be 770.

No they doesn't.

Your problem is that exim and POP/IMAP servers have different effective UIDs. So you place them both to the same group and want them cooperate via same GID.

There is less complicated approach with lot of benefits. Use LDA from the POP/IMAP bundle. In case of dovecot there is deliver utility that can be invoked from the exim's transport:

begin transports
local:
  driver          = pipe
  user            = dovenull
  command         = /path/dovecot/deliver -d $local_part@$domain -f $sender_address
  temp_errors     = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78
  envelope_to_add
  return_path_add
  delivery_date_add
  log_output


begin routers
. . . . .
local_user:
  driver    = accept
  domains = dsearch;/etc/exim4/virtual_domains
  local_parts = lsearch;/etc/exim4/virtual_domains/$domain/passwords
  transport = local
. . . . .

Now all messages for local users will be delivered by dovecot's LDA to the location defined by mail_location = maildir:/var/mail/%d/%n

If you want further filtering/sorting you have to use sieve instead of the exim's filters.

1
  • Thanks for your suggestion but it's interoperability with other systems that define the need for the group permissions, dovecot works fine. Jun 14, 2016 at 20:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .