Eu tenho esse trabalho, e aqui está o que eu fiz.
Primeiro, em TODOS os roteadores que lidam com usuários locais, defina a variável exim address_data como $ {local_part}:
real_local:
driver = accept
domains = +local_domains
local_part_prefix = real-
check_local_user
transport = LOCAL_DELIVERY
# Set this so acl can use it
address_data = ${local_part}
Em seguida, configure uma acl para verificar o remetente em relação ao usuário autenticado:
acl_smtp_mail = acl_check_sender_vs_auth
E faça com que esse novo acl compare o usuário autenticado com o valor da variável address_data e garanta que seja o mesmo:
# Ensure that the MAIL FROM: address matches what the authenticated
# user is, if authentiation is used
acl_check_sender_vs_auth:
accept
authenticated = *
# verify MUST be above condition to resolve $sender_address_data
verify = sender
condition = ${if eqi{$authenticated_id}{$sender_address_data}{yes}{no}}
endpass
logwrite = AUTH OK - authenticated user '$authenticated_id' sending email from '$sender_address', which belongs to '$sender_address_data'
deny
authenticated = *
# verify MUST be above condition to resolve $sender_address_data
verify = sender
!condition = ${if eqi{$authenticated_id}{$sender_address_data}{yes}{no}}
message = User '$authenticated_id' tried to send mail from '$sender_address', but that email address belongs to someone else
logwrite = AUTH ERROR - authenticated user '$authenticated_id' tried sending from '$sender_address', but that address belongs to '$sender_address_data'
accept