1 (edited by dabox 2017-01-24 21:35:18)

Topic: No more mail after upgrade

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6
- Linux/BSD distribution name and version: Debian 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? yes
- Related log if you're reporting an issue:
====
Hi since the update (only iredmail 0.9.6) i cannot send or received any mail , when i used the updateLDAPValues_095_1_to_096.py
i received this error

Traceback (most recent call last):
  File "updateLDAPValues_095_1_to_096.py", line 67, in <module>
    mail = _ldif2['mail'][0]
KeyError: 'mail'


extract of mail.log
warning: connect to Milter service inet:localhost:10001: Connection refused
Jan 24 14:24:01 qarth postfix/smtpd[5758]: warning: unknown[41.189.32.92]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
Jan 24 14:24:01 qarth postfix/smtpd[5758]: lost connection after AUTH from unknown[41.189.32.92]
Jan 24 14:24:01 qarth postfix/smtpd[5758]: disconnect from unknown[41.189.32.92]


And when i try to send a mail to one of the address on this server i received this message
Recipient address rejected: User unknown in virtual mailbox table

Can you help me ?
thanks in advance

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: No more mail after upgrade

dabox wrote:

Traceback (most recent call last):
  File "updateLDAPValues_095_1_to_096.py", line 67, in <module>
    mail = _ldif2['mail'][0]
KeyError: 'mail'

Every mail user must have the "mail" attribute, not sure why this one doesn't. What's the context output on command line?

dabox wrote:

warning: connect to Milter service inet:localhost:10001: Connection refused

iRedMail doesn't have milter service, and no program listening on port 10001. It must be an third-party program configured by the sysadmin.

3

Re: No more mail after upgrade

ZhangHuangbin wrote:
dabox wrote:

Traceback (most recent call last):
  File "updateLDAPValues_095_1_to_096.py", line 67, in <module>
    mail = _ldif2['mail'][0]
KeyError: 'mail'

Every mail user must have the "mail" attribute, not sure why this one doesn't. What's the context output on command line?
Hi thanks for responding , i just followed the tutorial and put: python updateLDAPValues_095_1_to_096.py

dabox wrote:

warning: connect to Milter service inet:localhost:10001: Connection refused

iRedMail doesn't have milter service, and no program listening on port 10001. It must be an third-party program configured by the sysadmin.

I didn't get this problem before
here my master.cf
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
#smtp      inet  n       -       -       -       -       smtpd
225      inet  n       -       -       -       -       smtpd
smtp      inet  n       -       -       -       1       postscreen
smtpd     pass  -       -       -       -       -       smtpd
dnsblog   unix  -       -       -       -       0       dnsblog
tlsproxy  unix  -       -       -       -       0       tlsproxy
#submission inet n       -       -       -       -       smtpd
subcleanup unix n       -       -       -       0       cleanup
   -o header_checks=pcre:/etc/postfix/smtp_header_checks
   -o cleanup_service_name=subcleanup
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix    -    n    n    -    2    pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
  -o content_filter=smtp-amavis:[127.0.0.1]:10026

# Use dovecot deliver program as LDA.
dovecot unix    -       n       n       -       -      pipe
    flags=DRh user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${domain} -m ${extension}

smtp-amavis unix -  -   -   -   4  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20
    -o smtp_tls_security_level=none
127.0.0.1:10025 inet n  -   -   -   -  smtpd
    -o content_filter=
    -o mynetworks_style=host
    -o mynetworks=127.0.0.0/8
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o strict_rfc821_envelopes=yes
    -o smtp_tls_security_level=none
    -o smtpd_tls_security_level=none
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_end_of_data_restrictions=
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

4

Re: No more mail after upgrade

i can add that i cannot access iredadmin web page anymore, the page is active for like 2 or 3 minute and no page anymore

5

Re: No more mail after upgrade

As mentioned in my previous reply, we need context output of running "updateLDAPValues_095_1_to_096.py", without the output, we cannot help much.

Also, port 10001 is your own program, seems it's not running. You should start it first.

6

Re: No more mail after upgrade

ZhangHuangbin wrote:

As mentioned in my previous reply, we need context output of running "updateLDAPValues_095_1_to_096.py", without the output, we cannot help much.

Also, port 10001 is your own program, seems it's not running. You should start it first.

what do you mean contact output ?
here my updateLDAP :
#!/usr/bin/env python
# encoding: utf-8

# Author:   Zhang Huangbin <zhb _at_ iredmail.org>
# Purpose:  Add `domainStatus=disabled` to all mail users/aliases/lists if
#           domain is disabled.
# Date:     Oct 21, 2016.

import sys
import ldap

# Note:
#   * bind_dn must have write privilege on LDAP server.
uri = 'ldap://127.0.0.1:389'
basedn = 'o=domains,dc=dmi,dc=com'
bind_dn = 'cn=vmailadmin,dc=dmi,dc=com'
bind_pw = 'XXXX'

# Initialize LDAP connection.
print "* Connecting to LDAP server: %s" % uri
conn = ldap.initialize(uri=uri, trace_level=0,)

print "* Authenticate as dn: %s" % bind_dn
conn.bind_s(bind_dn, bind_pw)

# Get all disabled domains.
print "* Get all disabled mail domains ..."

qf = "(&(objectClass=mailDomain)(accountStatus=disabled))"
qr_domains = conn.search_s(basedn,
                           ldap.SCOPE_ONELEVEL,
                           qf,
                           ['dn', 'domainName'])

if not qr_domains:
    print "* No disabled domain. Exit."
    sys.exit()

print "* Found %d disabled domains." % len(qr_domains)

qf = "(&"
qf += "(!(domainStatus=disabled))"
qf += "(|(objectClass=mailUser)(objectClass=mailAlias)(objectClass=mailList)(objectClass=mailExternalUser))"
qf += ")"

mod_attr = [(ldap.MOD_ADD, 'domainStatus', ['disabled'])]

for (dn, _ldif) in qr_domains:
    domain = _ldif['domainName'][0]

    # Get all mail accounts which don't have required mod_attr.
    qr_accounts = conn.search_s(basedn,
                                ldap.SCOPE_SUBTREE,
                                qf,
                                ['mail', 'domainStatus'])

    total = len(qr_accounts)
    if total:
        print "* Updating %d accounts(s) under domain %s." % (total, domain)
    else:
        print "* No update required for domain %s." % domain

    # Counter.
    count = 1

    for (dn, _ldif2) in qr_accounts:
        mail = _ldif2['mail'][0]

        try:
            print "* (%d of %d) Updating user: %s" % (count, total, mail)
            conn.modify_s(dn, mod_attr)
        except Exception, e:
            print "* (%d of %d) <<< ERROR >>> %s: %s" % (count, total, mail, repr(e))

        count += 1

conn.unbind()

7

Re: No more mail after upgrade

dabox wrote:

what do you mean contact output ?

context, not contact.
I mean the output lines above/after the error message.

8

Re: No more mail after upgrade

ZhangHuangbin wrote:
dabox wrote:

what do you mean contact output ?

context, not contact.
I mean the output lines above/after the error message.

my bad

root@qarth:~# python updateLDAPValues_095_1_to_096.py
* Connecting to LDAP server: ldap://127.0.0.1:389
* Authenticate as dn: cn=vmailadmin,dc=dmi-alfi,dc=fr
* Get all disabled mail domains ...
* Found 2 disabled domains.
* Updating 1 accounts(s) under domain dmi-alfi.fr.
Traceback (most recent call last):
  File "updateLDAPValues_095_1_to_096.py", line 67, in <module>
    mail = _ldif2['mail'][0]
KeyError: 'mail'

9

Re: No more mail after upgrade

dabox wrote:

* Updating 1 accounts(s) under domain dmi-alfi.fr.
Traceback (most recent call last):
  File "updateLDAPValues_095_1_to_096.py", line 67, in <module>
    mail = _ldif2['mail'][0]
KeyError: 'mail'

It turns out it's a bug of updateLDAPValues_095_1_to_096.py, and fixed moment ago. So sorry about this trouble.