I'm using Postfix 2.7.0 and Dovecot 1.2.9.

I don't understand why this machine (imap) is trying to send warning emails as if the recipient was local.

If I set relay_domains to "target.example.org", it works ok, I can send email to *...@gmail.com (or any other domain), from imap. If I set relay_domains to ldap:/etc/postfix/ldap-mapa-dominios.cf, it does not work, and the output from postmap -q some...@gmail.com ldap:/etc/postfix/ldap-mapa-dominios.cf is the *same* value I before set, which is "target.example.org". Because of that, if the imap machine tries to send an error msg (such as mailbox full), it treats the sender as local, so it tries to send locally the mailbox full message.


-> target.example.org is handled by this mail system (and LDAP has information about it). -> origin.example.org is NOT handled by this email system, on my tests, origin.example.org is GMail, Yahoo, and also subdomains within my network, NOT handled by this mail system or LDAP.

On the log attached, what I tried to do was: send mail from la...@origin.example.org to m...@target.example.org, and m...@target is overquota, so it should send email to la...@origin.example.org, but Dovecot thinks it's a local mail, I think (line 11).


# 01 imap dovecot: deliver(m...@target.domain.org): msgid=<722690f049ba7369963071195e38ae7a.squir...@webmail.origin.domain.org>: save failed to INBOX: Quota exceeded (mailbox for user is full) # 02 imap dovecot: deliver(m...@target.domain.org): msgid=<722690f049ba7369963071195e38ae7a.squir...@webmail.origin.domain.org>: rejected: Quota exceeded (mailbox for user is full) # 03 imap dovecot: deliver(m...@target.domain.org): Sending a rejection to m...@target.domain.org: Quota exceeded (mailbox for user is full)
# 04 imap postfix/pickup[12141]: EFA2340A70: uid=666 from=<>
# 05 imap postfix/cleanup[12201]: dict_ldap_debug: ldap_build_search_req ATTRS: associatedDomain # 06 imap postfix/cleanup[12201]: EFA2340A70: message-id=<dovecot-1288024761-91600...@imap> # 07 imap postfix/qmgr[12142]: EFA2340A70: from=<>, size=3150, nrcpt=1 (queue active) # 08 imap postfix/trivial-rewrite[12200]: dict_ldap_debug: ldap_build_search_req ATTRS: associatedDomain # 09 imap postfix/pipe[12203]: 67CBC40A6E: to=<m...@target.domain.org>, relay=dovecot, delay=0.59, delays=0.47/0.02/0/0.1, dsn=2.0.0, status=sent (delivered via dovecot service)
# 10 imap postfix/qmgr[12142]: 67CBC40A6E: removed
# 11 imap dovecot: deliver(la...@origin.domain.org): Loading modules from directory: /usr/lib/dovecot/modules/lda # 12 imap dovecot: deliver(la...@origin.domain.org): Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so # 13 imap dovecot: deliver(la...@origin.domain.org): Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so # 14 imap dovecot: auth(default): master in: user#0111#011la...@origin.domain.org#011service=deliver # 15 imap dovecot: auth(default): prefetch(la...@origin.domain.org): passdb didn't return userdb entries, trying the next userdb # 16 imap dovecot: auth(default): ldap(la...@origin.domain.org): user search: base=ou=origin.domain.org,ou=mail,ou=services,dc=example,dc=org scope=subtree filter=(& (cn=lauro)(objectclass=nisMailAlias)(ContaAtiva=TRUE) ) fields=rfc822MailMember,EmailQuota,EmailQuotaSpecial,eduPersonPrincipalName # 01 imap dovecot: auth(default): ldap(la...@origin.domain.org): ldap_search((& (cn=lauro)(objectclass=nisMailAlias)(ContaAtiva=TRUE) )) failed: No such object

------

main.cf
------

smtpd_banner = $myhostname
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = imap
alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-mapa-usuarios.cf
local_recipient_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-mapa-usuarios.cf
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_maps = ldap:/etc/postfix/ldap-mapa-usuarios.cf
relay_recipient_maps = ldap:/etc/postfix/ldap-mapa-usuarios.cf
mydestination = $myhostname, localhost.$mydomain, ldap:/etc/postfix/ldap-mapa-dominios.cf
relay_domains = ldap:/etc/postfix/ldap-mapa-dominios.cf
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
relay_host =
dovecot_destination_recipient_limit = 1
mailbox_transport = dovecot
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 123.123.12.71/32
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox =
smtpd_sasl_auth_enable = no
smtpd_sasl_type = cyrus
smtpd_sasl_path = smtpd
smtpd_sasl_authenticated_header = no
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
broken_sasl_auth_clients = no
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
smtpd_sender_restrictions =
mailbox_command =
smtp_use_tls = no
smtpd_tls_received_header = no
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_auth_only = no
tls_random_source = dev:/dev/urandom
message_size_limit = 30000000

-----
ldap-mapa-usuarios.cf

version = 3
server_host = ldap://x.x.x.x:389
search_base=ou=%d,ou=mail,ou=services,dc=example,dc=org
result_attribute=rfc822MailMember
query_filter=(& (cn=%u)(objectclass=nisMailAlias)(ContaAtiva=TRUE) )
scope = sub
debuglevel = 4
start_tls = no


ldap-mapa-dominios.cf (will return ONLY "target.example.org", "origin.example.org" is not registered in this LDAP tree, this domain is not handled by this mail service)

version = 3
server_host = ldap://x.x.x.x:389
search_base=ou=mail,ou=services,dc=example,dc=org
result_attribute=associatedDomain
query_filter=(objectclass=domainRelatedObject)
scope = sub
debuglevel = 4
start_tls = no


dovecot.conf
---------------------------
protocols = imap imaps managesieve
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
syslog_facility = mail
login_dir = /var/run/dovecot/login
login_user = dovecot
login_process_size = 64
login_log_format = %$: %s
mail_location = maildir:/var/mail/mailboxes/%d/%n~%d:INDEX=/var/mail/indexes/%d/%n~%d
mail_uid = vmail
mail_gid = mail
mail_privileged_group = mail
mail_debug = yes
max_mail_processes = 512
maildir_copy_preserve_filename = no

protocol imap {
  mail_plugins = quota imap_quota
}

#protocol pop3 {
#  pop3_uidl_format = %08Xu%08Xv
#  mail_plugins = quota
#}

protocol managesieve {
  login_executable = /usr/lib/dovecot/managesieve-login
  mail_executable = /usr/lib/dovecot/managesieve
  managesieve_logout_format = bytes=%i/%o
  managesieve_implementation_string = Cyrus timsieved v2.2.13
}

protocol lda {
  postmaster_address = postmas...@imap.mail.example.org
  mail_plugins = quota sieve
  auth_socket_path = /var/run/dovecot/auth-master
}
auth_username_chars = abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz01234567890...@~
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
auth default {
  mechanisms = plain
passdb checkpassword {
  args = /etc/dovecot/passdb.sh
}
userdb prefetch {
}
# The userdb below is used only by deliver.
userdb ldap {
  args = /etc/dovecot/dovecot-ldap-userdb.conf
}
  user = root
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail
      group = mail
    }
    client {
      path = /var/run/dovecot/auth-client
      mode = 0660
    }
  }
  !include_try /etc/dovecot/auth.d/*.auth
}
dict {
  #quota = mysql:/etc/dovecot/dovecot-dict-quota.conf
  #expire = db:/var/lib/dovecot/expire.db
}
plugin {

quota = maildir:DefaultQuota
quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95 %u
quota_warning2 = storage=90%% /usr/local/bin/quota-warning.sh 90 %u
  trash = /etc/dovecot/dovecot-trash.conf
  sieve=/var/mail/sieve_scripts/%d/%n~%d/.dovecot.sieve
  sieve_dir=/var/mail/sieve_scripts/%d/%n~%d/sieve
}
!include_try /etc/dovecot/conf.d/*.conf



dovecot-ldap-userdb.conf
--------------

hosts = a.b.c.d
tls = no
auth_bind = no
ldap_version = 3
base = ou=%d,ou=mail,ou=services,dc=example,dc=org
scope = subtree
deref = never
user_filter = (& (cn=%n)(objectclass=nisMailAlias)(ContaAtiva=TRUE) )
user_attrs = rfc822MailMember=user,EmailQuota=quota_rule=*:storage=%$M,EmailQuotaSpecial=quota_rule=*:storage=%$M,eduPersonPrincipalName=eppn


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Reply via email to