Hi guys,

I'm trying to configure my postfix to use a different relayhost if the
sender of the email is in ldap.

My ldap entry is:

dn: SenderHost=exampleSender,o=AllHost
objectClass=provider
domains: example1.org
domains: example2.org
domains: example3.org

The "domain" attribute is multivalue. If the "mail from" of email is
"*...@example1.org", "*...@example2.org" or  "*...@example3.org" the relay host
is not the default relayhost.

My configuration is:

(main.cf)
relayhost = [127.0.0.1]:2500
sender_dependent_relayhost_maps =
ldap:/opt/postfix/etc/ldap/ldap_relaymaps.cf
smtpd_recipient_restrictions = check_recipient_access
ldap:/opt/postfix/etc/ldap/ldap_mailboxlocali.cf, reject

(/opt/postfix/etc/ldap/ldap_relaymaps.cf)
server_host = ldap://x.x.x.x
server_port = 389
search_base = SenderHost=exampleSender,o=AllHost
scope = sub
query_filter = (&(domains=%d)(objectClass=provider))
result_attribute = domains
result_format =  %s [127.0.0.1]:2501

In this way, if my search ldap return attributes, it should use
example1.org [127.0.0.1]:2501 in sender_dependent_relayhost_maps. Is it
correct?

But in this way, it doesn't work ( I think because "domains" is a multi
values attribute).

In my log i have:
Dec  3 00:31:54 sword postfix/cleanup[11868]: F3F9FC36F0: message-id=<>
Dec  3 00:31:54 sword postfix/qmgr[11863]: F3F9FC36F0:
from=<pi...@example1.org>, size=174, nrcpt=1 (queue active)
Dec  3 00:31:54 sword postfix/smtp[11869]: fatal: valid hostname or
network address required in server description: example1.org
[127.0.0.1]:2501,example2.org [127.0.0.1]:2501,example3.org [127.0.0.1]:2501
Dec  3 00:31:55 sword postfix/qmgr[11863]: warning: private/smtp socket:
malformed response
Dec  3 00:31:55 sword postfix/qmgr[11863]: warning: transport smtp
failure -- see a previous warning/fatal/panic logfile record for the
problem description
Dec  3 00:31:55 sword postfix/qmgr[11863]: warning: connect to transport
private/retry: Connection refused
Dec  3 00:31:55 sword postfix/master[11862]: warning: process
/opt/postfix/usr/libexec/smtp pid 11869 exit status 1
Dec  3 00:31:55 sword postfix/master[11862]: warning:
/opt/postfix/usr/libexec/smtp: bad command startup -- throttling
Dec  3 00:31:55 sword postfix/qmgr[11863]: F3F9FC36F0: to=<u...@green.it>,
relay=none, delay=4.9, delays=3.9/1/0/0, dsn=4.3.0, status=deferred
(mail transport unavailable)

How can i solve this problem??

Thanks

Reply via email to