[exim] Delivering virtual mail as a real user

Pàgina inicial
Delete this message
Reply to this message
Autor: Jason Lixfeld
Data:  
A: exim-users
Assumpte: [exim] Delivering virtual mail as a real user
I'm trying to figure out how to deliver mail as a specific user out of
LDAP.

The routers and transports are listed below, as are the ldifs for the
alias and the real user the alias points to.

The message hits the virtual_aliases router, the mailLocalAddress is
returned and the message is redirected and processed now by the
virtual_user router which delivers based on the virtual_delivery
transport -- this is where the problem is. I've tried a bunch of user
= and group = options, but I can't get it to work. The reason why is
because local_part of the email address in question here testuser but
is not actually the username of the real user. the real username is
testuser.discord.ca. Another user might have a real name of
joeuser.thisdomain.tld so the suffix after testuser will not always be
constant. If there was a way in the virtual_delivery transport to tell
the user = and group = to run as the user mailLocalAddress
testuser.discord.ca, my problems would be solved. I'm sure there is a
way, I'm just missing it.

Any way to write arbitrary variables or something that I can pass to
different transports? In the listed virtual_transport below, you'll
see some of the attempts I've made to try to get this work work.

Anyone have any ideas?

ldif:

dn:cn=testalias,o=discord.ca,cn=hosting,dc=ebit,dc=ca
cn: testalias
objectClass: top
objectClass: organizationalRole
objectClass: CourierMailAlias
objectClass: inetLocalMailRecipient
mail: testalias@???
mailLocalAddress: jason@???
mailLocalAddress: testuser.discord.ca

dn:uid=testuser.discord.ca,ou=users,dc=ebit,dc=ca
cn: testuser.discord.ca
uid: testuser.discord.ca
uidNumber: 10000
gidNumber: 10000
gecos: Test User
mailbox: /usr/home/discord.ca/testuser/Maildir/
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: CourierMailAccount
objectClass: top
loginShell: /usr/local/bin/bash
homeDirectory: /usr/home/discord.ca/testuser
userPassword: {MD5}XZxoxsUO09AqL89U9jmTtg==
mail: testuser@???

virtual_aliases:
driver = redirect
allow_fail
allow_defer
hide data = ${lookup ldap {user="cn=joeuser,dc=ebit,dc=ca" pass=mykey
ldap:///cn=$local_part,o=$domain,cn=hosting,dc=ebit,dc=ca?
mailLocalAddress?}}

virtualuser:
driver = accept
check_local_user
local_part_suffix = +* : -*
local_part_suffix_optional
transport = virtual_delivery
cannot_route_message = Unknown user
no_more

virtual_delivery:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
mode = 0660
#hide user = ${lookup ldap {user="cn=joeuser,dc=ebit,dc=ca"
pass=mykey
ldap:///uid=${quote_ldap:$local_part.$domain},ou=users,dc=ebit,dc=ca?
uid?}}
#hide group = ${lookup ldap {user="cn=joeuser,dc=ebit,dc=ca"
pass=mykey
ldap:///uid=${quote_ldap:$local_part.$domain},ou=users,dc=ebit,dc=ca?
gid?}}
#user = $local_user_uid
#group = $local_user_gid
hide directory = ${lookup ldap {user="cn=joeuser,dc=ebit,dc=ca"
pass=mykey ldap:///uid=$local_part,ou=users,dc=ebit,dc=ca?mailbox?}}
create_directory
maildir_format=true
maildir_tag= ,S=$message_size