Mailproblems after restore

Discussion in 'Installation/Configuration' started by FiF3000, Sep 7, 2015.

  1. FiF3000

    FiF3000 New Member

    I had to restore a backup after a crash on my system. So far most of the things seem to work, except emails.

    This is what I have done:

    - Set up a new system (Debian 7.8)
    - Set up ISPConfig with this manual (Apache2, BIND, Dovecot, ISPConfig 3)
    (https://www.howtoforge.com/perfect-server-debian-wheezy-apache2-bind-dovecot-ispconfig-3-p3)
    - Replace /etc/passwd + shadow + group + gshadow with the backuped ones
    - Replace /etc/apache2 files with the backuped ones
    - Restore /var/www/virtual files
    - Restore /var/lib/mysql files

    Apache is working, mysql is working, ISPConfig is working - but emails wont be delivered or received.

    I noticed that the User-IDs have changed due tue the replacement of /etc/passwd. I had to "chown" some files for postfix etc and I guess I maybe have to change some more (which I dont know).

    I also tried to change some config files to get it to work. I cant reconstructure all the settings I have changed and tried.

    Any help appreciated. If you need more config infos, please let me know.

    Code:
    Sep  7 09:04:14 venus postfix/scache[2782]: statistics: start interval Sep  7 09:00:53
    Sep  7 09:04:14 venus postfix/scache[2782]: statistics: domain lookup hits=0 miss=2 success=0%
    Sep  7 09:04:14 venus postfix/scache[2782]: statistics: address lookup hits=0 miss=2 success=0%
    Sep  7 09:05:01 venus dovecot: imap-login: Disconnected (disconnected before greeting, waited 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<Jv9C3iIfVwB/AAAB>
    Sep  7 09:05:01 venus dovecot: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<zBVD3iIfzgB/AAAB>
    Sep  7 09:05:01 venus postfix/smtpd[3020]: connect from localhost.localdomain[127.0.0.1]
    Sep  7 09:05:01 venus postfix/smtpd[3020]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    Sep  7 09:05:01 venus postfix/smtpd[3020]: disconnect from localhost.localdomain[127.0.0.1]
    
    Code:
    Sep  7 09:15:58 venus postfix/error[3788]: 8B5B311C278A: to=<[email protected]>, relay=none, delay=205688, delays=205683/4.9/0/0.13, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)
    
    Code:
    Sep  7 09:25:53 venus postfix/smtp[4380]: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused
    Sep  7 09:25:53 venus postfix/smtp[4380]: 4FEEA11C29D9: to=<[email protected]>, relay=none, delay=2106, delays=2106/0.04/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)
    
    Code:
    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    IP-address(es) (as per ifconfig): ***.***.***.***
    [INFO] ISPConfig is installed.
    
    ##### ISPCONFIG #####
    ISPConfig version is 3.0.5.4p8
    
    
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 5.4.44-0+deb7u1
    [INFO] php-cgi (used for cgi php in default vhost!) is version 5.4.44-0+deb7u1
    
    ##### PORT CHECK #####
    
    
    ##### MAIL SERVER CHECK #####
    
    
    ##### RUNNING SERVER PROCESSES #####
    
    [INFO] I found the following web server(s):
        Apache 2 (PID 2484)
    [INFO] I found the following mail server(s):
        Postfix (PID 4165)
    [INFO] I found the following pop3 server(s):
        Dovecot (PID 3869)
    [INFO] I found the following imap server(s):
        Dovecot (PID 3869)
    [INFO] I found the following ftp server(s):
        PureFTP (PID 3843)
    
    ##### LISTENING PORTS #####
    (only        ()
    Local        (Address)
    [localhost]:10025        (4165/master)
    [anywhere]:3306        (3517/mysqld)
    [anywhere]:587        (4165/master)
    [localhost]:11211        (3136/memcached)
    [anywhere]:110        (3869/dovecot)
    [anywhere]:143        (3869/dovecot)
    [anywhere]:10000        (3767/perl)
    [anywhere]:465        (4165/master)
    ***.***.***.***:40021        (7895/pure-ftpd)
    [anywhere]:21        (3843/pure-ftpd)
    [anywhere]:22        (3340/sshd)
    [anywhere]:25        (4165/master)
    [anywhere]:993        (3869/dovecot)
    [anywhere]:995        (3869/dovecot)
    *:*:*:*::*:587        (4165/master)
    [localhost]10        (3869/dovecot)
    [localhost]43        (3869/dovecot)
    *:*:*:*::*:8080        (2484/apache2)
    *:*:*:*::*:80        (2484/apache2)
    *:*:*:*::*:465        (4165/master)
    *:*:*:*::*:8081        (2484/apache2)
    *:*:*:*::*:21        (3843/pure-ftpd)
    *:*:*:*::*:22        (3340/sshd)
    *:*:*:*::*:25        (4165/master)
    *:*:*:*::*:443        (2484/apache2)
    *:*:*:*::*:993        (3869/dovecot)
    *:*:*:*::*:995        (3869/dovecot)
    
    
    
    
    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination        
    fail2ban-dovecot-pop3imap  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 110,995,143,993
    fail2ban-pureftpd  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 21
    fail2ban-sasl  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 25
    fail2ban-ssh  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 22
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination        
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination        
    
    Chain fail2ban-dovecot-pop3imap (1 references)
    target     prot opt source               destination        
    RETURN     all  --  [anywhere]/0            [anywhere]/0          
    
    Chain fail2ban-pureftpd (1 references)
    target     prot opt source               destination        
    RETURN     all  --  [anywhere]/0            [anywhere]/0          
    
    Chain fail2ban-sasl (1 references)
    target     prot opt source               destination        
    RETURN     all  --  [anywhere]/0            [anywhere]/0          
    
    Chain fail2ban-ssh (1 references)
    target     prot opt source               destination        
    RETURN     all  --  [anywhere]/0            [anywhere]/0           
     
  2. FiF3000

    FiF3000 New Member

    /etc/postfix/master.cnf
    Code:
    
    #
    # Postfix master process configuration file.  For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # 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       -       n       -       -       smtpd
    submission inet n       -       -       -       -       smtpd
      -o smtpd_tls_security_level=encrypt
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    smtps     inet  n       -       -       -       -       smtpd
      -o smtpd_tls_wrappermode=yes
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    #628       inet  n       -       -       -       -       qmqpd
    pickup    fifo  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      fifo  n       -       n       300     1       qmgr
    #qmgr     fifo  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
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay     unix  -       -       -       -       -       smtp
        -o smtp_fallback_relay=
    #       -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 vmail ${extension} ${recipient} ${user} ${nexthop} ${sender}
    #
    # ====================================================================
    #
    # 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}
    
    dovecot   unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
    amavis unix - - - - 2 smtp
            -o smtp_data_done_timeout=1200
            -o smtp_send_xforward_command=yes
    
    127.0.0.1:10025 inet n - - - - smtpd
            -o content_filter=
            -o local_recipient_maps=
            -o relay_recipient_maps=
            -o smtpd_restriction_classes=
            -o smtpd_client_restrictions=
            -o smtpd_helo_restrictions=
            -o smtpd_sender_restrictions=
            -o smtpd_recipient_restrictions=permit_mynetworks,reject
            -o mynetworks=127.0.0.0/8
            -o strict_rfc821_envelopes=yes
            -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
    
    
     
  3. FiF3000

    FiF3000 New Member

    amavis was not running. Still I have the same problem

    -> /var/lib/amavis auf user "amavis.amavis" geändert und amavis neu gestartet

    restart the services.
     
  4. FiF3000

    FiF3000 New Member

    So, I am getting closer. After the new installed ISPConfig I restored my mysql-db so the password for the user "ispconfig" does not match anymore.

    How can I change the password for the user "ispconfig" and for all the services, using this data? (like /etc/amavis/conf.d/50-user)? Is there some script I can use or do I have to do this by hand?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Change the password in mysql "mysql.user" table to match the password that you can find in the ispconfig config.inc.php file.
     
    FiF3000 likes this.
  6. FiF3000

    FiF3000 New Member

    Thanks you, this now did the job. I also changed the password from config.inc.php in /etc/amavis/conf.d/50-user - restarted the services and postque -f is now running and flushing all the mails out :)
     
  7. FiF3000

    FiF3000 New Member

    I created a new db using ispconfig for one user. somehow I get these errors now again - even it was working and the pw in 50-user and /etc/postfix/mysql-virtual_relaydomains.cf and mysql.user is the same as in config.inc.php. All I can remember of what I have done so far is adding a new mysql db via ISPConfig interface.

    Code:
    Sep  7 21:08:20 venus amavis[28878]: (28878-01) (!)connect_to_sql: unable to connect to DSN 'DBI:mysql:database=dbispconfig;host=127.0.0.1;port=3306': Access denied for user 'ispconfig'@'localhost' (using password: YES)
    Sep  7 21:08:20 venus amavis[28878]: (28878-01) (!!)TROUBLE in process_request: connect_to_sql: unable to connect to any dataset at (eval 111) line 247.
    Sep  7 21:08:20 venus amavis[28878]: (28878-01) (!)Requesting process rundown after fatal error
    Sep  7 21:08:20 venus postfix/smtp[29239]: 7300F11C0947: to=<root@localhost>, relay=127.0.0.1[127.0.0.1]:10024, delay=305, delays=305/0.01/0.01/0.1, dsn=4.3.2, status=deferred (host 127.0.0.1[127.0.0.1] said: 421 4.3.2 Service shutting down, closing channel (in reply to RCPT TO command))
    Sep  7 21:08:20 venus postfix/smtp[29239]: warning: connect to mysql server 127.0.0.1: Access denied for user 'ispconfig'@'localhost' (using password: YES)
    Sep  7 21:08:20 venus postfix/smtp[29239]: warning: mysql:/etc/postfix/mysql-virtual_relaydomains.cf: table lookup problem
    Sep  7 21:08:20 venus postfix/smtp[29239]: warning: 7300F11C0947: flush service failure
    Sep  7 21:08:27 venus dovecot: auth-worker(29253): Error: mysql(localhost): Connect failed to database (dbispconfig): Access denied for user 'ispconfig'@'localhost' (using password: YES) - waiting for 1 seconds before retry
    
     
  8. FiF3000

    FiF3000 New Member

    And I cant login to ISPConfig control panel anymore....
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Creating a mysql dB in isp config is not related. The error means that the mysql password of the isp config user in the Amavisd config file is wrong.
     
  10. FiF3000

    FiF3000 New Member

    ok, but I didnt change it and it is the same in
    • /etc/amavis/conf.d/50-user
    • /usr/local/ispconfig/server/lib/config.inc.php
    • /etc/postfix/mysql-virtual_relaydomains.cf
    • /usr/local/ispconfig/server/lib/config.inc.php
    • table mysql.user for user ispconfig
    all of them. I just double checked.
    Thats so weird now.
     
  11. FiF3000

    FiF3000 New Member

    I changed the passwort manually
    Code:
     update user SET Password = md5('secretpassword') where User = 'ispconfig';
    
    When I try to login with "secretpassword" I get
    Code:
    mysql -h localhost -u ispconfig -p dbispconfig
    Enter password:
    ERROR 1045 (28000): Access denied for user 'ispconfig'@'localhost' (using password: YES)
    
    Did I set the password in a wrong way?
     
  12. FiF3000

    FiF3000 New Member

    I found out, that the db privileges for the user ispconfig where different than from the rest of the users, so I changed the select privileges etc. to "Yes". After restarting mysql I am now able to connect manually to the db:

    Code:
     mysql -h localhost -u ispconfig -p dbispconfig
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2235
    Server version: 5.5.44-0+deb7u1 (Debian)
    
    And I changed the password in all these files:
    • /etc/amavis/conf.d/50-user
    • /usr/local/ispconfig/server/lib/config.inc.php
    • /etc/postfix/mysql-virtual_relaydomains.cf
    • /etc/pure-ftpd/db/mysql.conf
    • /etc/dovecot/dovecot-sql.conf
    And restarted amavis, postfix, dovecot - still I get these errors:

    Code:
    Sep  8 08:36:13 venus dovecot: auth-worker(9574): Error: mysql(localhost): Connect failed to database (dbispconfig): Access denied for user 'ispconfig'@'localhost' (using password: YES) - waiting for 1 seconds before retry
    
    What am I missing here?
     
    Last edited: Sep 8, 2015
  13. FiF3000

    FiF3000 New Member

    Working again. First I did this:

    Code:
    cd /tmp
    wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
    tar xvfz ISPConfig-3-stable.tar.gz
    cd ispconfig3_install/install
    php -q update.php
    then I re-updated the password in the DB using
    Code:
    UPDATE `mysql`.`user` SET `Password` = password('newpassword') WHERE `user`.`Host` = 'localhost' AND `user`.`User` = 'ispconfig';
     

Share This Page