Roundcube: SMTP Error (-1): Connection to server failed.

Discussion in 'General' started by Rescue9, May 11, 2022.

  1. Rescue9

    Rescue9 Member

    When trying to send from Roundcube, I get the following error: SMTP Error (-1): Connection to server failed.

    I've done apt upgdate & apt upgrade and restarted to no avail. I've read the "Please read before posting!" thread and tried the Roundcube fixes but nothing has worked. Below are the logs. I stripped out some comments for length. I normally don't use Roundcube, but I know this was working around December or so.

    Thanks in advance for your help!

    htf_report.txt
    Code:
    ##### SERVER #####
    IP-address (as per hostname): [localhost]
    [WARN] could not determine server's ip address by ifconfig
    [INFO] OS version is Debian GNU/Linux 11 (bullseye)
     
    [INFO] uptime:  18:41:36 up 2 min,  1 user,  load average: 0.31, 0.27, 0.11
     
    [INFO] memory:
                   total        used        free      shared  buff/cache   available
    Mem:           7.8Gi       1.9Gi       4.9Gi        49Mi       990Mi       5.6Gi
    Swap:          511Mi          0B       511Mi
     
    [INFO] systemd failed services status:
      UNIT LOAD ACTIVE SUB DESCRIPTION
    0 loaded units listed.
    
    [INFO] ISPConfig is installed.
    
    ##### ISPCONFIG #####
    ISPConfig version is 3.2.8p1
    
    
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 7.4.29
    [INFO] php-cgi (used for cgi php in default vhost!) is version 7.4.29
    
    ##### PORT CHECK #####
    
    
    ##### MAIL SERVER CHECK #####
    
    
    ##### RUNNING SERVER PROCESSES #####
    
    [INFO] I found the following web server(s):
        Apache 2 (PID 927)
    [INFO] I found the following mail server(s):
        Postfix (PID 2318)
    [INFO] I found the following pop3 server(s):
        Dovecot (PID 650)
    [INFO] I found the following imap server(s):
        Dovecot (PID 650)
    [INFO] I found the following ftp server(s):
        PureFTP (PID 1256)
    
    ##### LISTENING PORTS #####
    (only        ()
    Local        (Address)
    [anywhere]:995        (650/dovecot)
    [localhost]:10024        (793/amavisd-new)
    [localhost]:10026        (793/amavisd-new)
    [anywhere]:587        (2318/master)
    [localhost]:6379        (706/redis-server)
    [localhost]:11211        (660/memcached)
    [anywhere]:110        (650/dovecot)
    [anywhere]:143        (650/dovecot)
    [anywhere]:465        (2318/master)
    [anywhere]:8082        (16681/seaf-server)
    [anywhere]:21        (1256/pure-ftpd)
    ***.***.***.***:53        (661/named)
    ***.***.***.***:53        (661/named)
    ***.***.***.***:53        (661/named)
    ***.***.***.***:53        (661/named)
    [localhost]:53        (661/named)
    [localhost]:53        (661/named)
    [localhost]:53        (661/named)
    [localhost]:53        (661/named)
    [anywhere]:22        (752/sshd:)
    [anywhere]:25        (2318/master)
    [localhost]:953        (661/named)
    [anywhere]:4190        (650/dovecot)
    [localhost]:8000        (16713/python3)
    [anywhere]:993        (650/dovecot)
    *:*:*:*::*:995        (650/dovecot)
    *:*:*:*::*:11332        (714/rspamd:)
    *:*:*:*::*:11333        (714/rspamd:)
    *:*:*:*::*:11334        (714/rspamd:)
    *:*:*:*::*:10023        (580/postgrey)
    *:*:*:*::*:10024        (793/amavisd-new)
    *:*:*:*::*:10026        (793/amavisd-new)
    *:*:*:*::*:3306        (951/mariadbd)
    *:*:*:*::*:6379        (706/redis-server)
    [localhost]10        (650/dovecot)
    [localhost]43        (650/dovecot)
    *:*:*:*::*:8080        (927/apache2)
    *:*:*:*::*:80        (927/apache2)
    *:*:*:*::*:8081        (927/apache2)
    *:*:*:*::*:21        (1256/pure-ftpd)
    *:*:*:*::*:53        (661/named)
    *:*:*:*::*:53        (661/named)
    *:*:*:*::*:53        (661/named)
    *:*:*:*::*:53        (661/named)
    *:*:*:*::*f03c:93ff:53        (661/named)
    *:*:*:*::*f03c:93ff:53        (661/named)
    *:*:*:*::*f03c:93ff:53        (661/named)
    *:*:*:*::*f03c:93ff:53        (661/named)
    *:*:*:*::*f03c:93ff:fe9b:53        (661/named)
    *:*:*:*::*f03c:93ff:fe9b:53        (661/named)
    *:*:*:*::*f03c:93ff:fe9b:53        (661/named)
    *:*:*:*::*f03c:93ff:fe9b:53        (661/named)
    *:*:*:*::*:22        (752/sshd:)
    *:*:*:*::*:953        (661/named)
    *:*:*:*::*:443        (927/apache2)
    *:*:*:*::*:4190        (650/dovecot)
    *:*:*:*::*:993        (650/dovecot)
    
    ##### IPTABLES #####
    Chain INPUT (policy DROP)
    target     prot opt source               destination         
    f2b-postfix-sasl  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 25
    f2b-dovecot  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 110,995,143,993,587,465,4190
    f2b-pure-ftpd  tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 21
    f2b-sshd   tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 22
    ufw-before-logging-input  all  --  [anywhere]/0            [anywhere]/0           
    ufw-before-input  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-input  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-logging-input  all  --  [anywhere]/0            [anywhere]/0           
    ufw-reject-input  all  --  [anywhere]/0            [anywhere]/0           
    ufw-track-input  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain FORWARD (policy DROP)
    target     prot opt source               destination         
    ufw-before-logging-forward  all  --  [anywhere]/0            [anywhere]/0           
    ufw-before-forward  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-forward  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-logging-forward  all  --  [anywhere]/0            [anywhere]/0           
    ufw-reject-forward  all  --  [anywhere]/0            [anywhere]/0           
    ufw-track-forward  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    ufw-before-logging-output  all  --  [anywhere]/0            [anywhere]/0           
    ufw-before-output  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-output  all  --  [anywhere]/0            [anywhere]/0           
    ufw-after-logging-output  all  --  [anywhere]/0            [anywhere]/0           
    ufw-reject-output  all  --  [anywhere]/0            [anywhere]/0           
    ufw-track-output  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain f2b-dovecot (1 references)
    target     prot opt source               destination         
    REJECT     all  --  ***.***.***.***           [anywhere]/0            reject-with icmp-port-unreachable
    REJECT     all  --  ***.***.***.***           [anywhere]/0            reject-with icmp-port-unreachable
    RETURN     all  --  [anywhere]/0            [anywhere]/0           
    
    Chain f2b-postfix-sasl (1 references)
    target     prot opt source               destination         
    REJECT     all  --  ***.***.***.***        [anywhere]/0            reject-with icmp-port-unreachable
    REJECT     all  --  ***.***.***.***        [anywhere]/0            reject-with icmp-port-unreachable
    REJECT     all  --  ***.***.***.***        [anywhere]/0            reject-with icmp-port-unreachable
    RETURN     all  --  [anywhere]/0            [anywhere]/0           
    
    Chain f2b-pure-ftpd (1 references)
    target     prot opt source               destination         
    REJECT     all  --  ***.***.***.***       [anywhere]/0            reject-with icmp-port-unreachable
    REJECT     all  --  ***.***.***.***         [anywhere]/0            reject-with icmp-port-unreachable
    RETURN     all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-after-forward (1 references)
    target     prot opt source               destination         
    
    Chain ufw-after-input (1 references)
    target     prot opt source               destination         
    ufw-skip-to-policy-input  udp  --  [anywhere]/0            [anywhere]/0            udp dpt:137
    ufw-skip-to-policy-input  udp  --  [anywhere]/0            [anywhere]/0            udp dpt:138
    ufw-skip-to-policy-input  tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:139
    ufw-skip-to-policy-input  tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:445
    ufw-skip-to-policy-input  udp  --  [anywhere]/0            [anywhere]/0            udp dpt:67
    ufw-skip-to-policy-input  udp  --  [anywhere]/0            [anywhere]/0            udp dpt:68
    ufw-skip-to-policy-input  all  --  [anywhere]/0            [anywhere]/0            ADDRTYPE match dst-type BROADCAST
    
    Chain ufw-after-logging-forward (1 references)
    target     prot opt source               destination         
    LOG        all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
    
    Chain ufw-after-logging-input (1 references)
    target     prot opt source               destination         
    LOG        all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
    
    Chain ufw-after-logging-output (1 references)
    target     prot opt source               destination         
    
    Chain ufw-after-output (1 references)
    target     prot opt source               destination         
    
    Chain ufw-before-forward (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0            ctstate RELATED,ESTABLISHED
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 3
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 11
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 12
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 8
    ufw-user-forward  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-before-input (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0           
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0            ctstate RELATED,ESTABLISHED
    ufw-logging-deny  all  --  [anywhere]/0            [anywhere]/0            ctstate INVALID
    DROP       all  --  [anywhere]/0            [anywhere]/0            ctstate INVALID
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 3
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 11
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 12
    ACCEPT     icmp --  [anywhere]/0            [anywhere]/0            icmptype 8
    ACCEPT     udp  --  [anywhere]/0            [anywhere]/0            udp spt:67 dpt:68
    ufw-not-local  all  --  [anywhere]/0            [anywhere]/0           
    ACCEPT     udp  --  [anywhere]/0            ***.***.***.***          udp dpt:5353
    ACCEPT     udp  --  [anywhere]/0            ***.***.***.***      udp dpt:1900
    ufw-user-input  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-before-logging-forward (1 references)
    target     prot opt source               destination         
    
    Chain ufw-before-logging-input (1 references)
    target     prot opt source               destination         
    
    Chain ufw-before-logging-output (1 references)
    target     prot opt source               destination         
    
    Chain ufw-before-output (1 references)
    target     prot opt source               destination         
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0           
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0            ctstate RELATED,ESTABLISHED
    ufw-user-output  all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-logging-allow (0 references)
    target     prot opt source               destination         
    LOG        all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW ALLOW] "
    
    Chain ufw-logging-deny (2 references)
    target     prot opt source               destination         
    RETURN     all  --  [anywhere]/0            [anywhere]/0            ctstate INVALID limit: avg 3/min burst 10
    LOG        all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
    
    Chain ufw-not-local (1 references)
    target     prot opt source               destination         
    RETURN     all  --  [anywhere]/0            [anywhere]/0            ADDRTYPE match dst-type LOCAL
    RETURN     all  --  [anywhere]/0            [anywhere]/0            ADDRTYPE match dst-type MULTICAST
    RETURN     all  --  [anywhere]/0            [anywhere]/0            ADDRTYPE match dst-type BROADCAST
    ufw-logging-deny  all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 10
    DROP       all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-reject-forward (1 references)
    target     prot opt source               destination         
    
    Chain ufw-reject-input (1 references)
    target     prot opt source               destination         
    
    Chain ufw-reject-output (1 references)
    target     prot opt source               destination         
    
    Chain ufw-skip-to-policy-forward (0 references)
    target     prot opt source               destination         
    DROP       all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-skip-to-policy-input (7 references)
    target     prot opt source               destination         
    DROP       all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-skip-to-policy-output (0 references)
    target     prot opt source               destination         
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-track-forward (1 references)
    target     prot opt source               destination         
    
    Chain ufw-track-input (1 references)
    target     prot opt source               destination         
    
    Chain ufw-track-output (1 references)
    target     prot opt source               destination         
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            ctstate NEW
    ACCEPT     udp  --  [anywhere]/0            [anywhere]/0            ctstate NEW
    
    Chain ufw-user-forward (1 references)
    target     prot opt source               destination         
    
    Chain ufw-user-input (1 references)
    target     prot opt source               destination         
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:21
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:22
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:25
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:53
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:80
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:110
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:143
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:443
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:465
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:587
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:993
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:995
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:3306
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:4190
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:8080
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:8081
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:8082
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            multiport dports 40110:40210
    ACCEPT     udp  --  [anywhere]/0            [anywhere]/0            udp dpt:53
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:20
    ACCEPT     tcp  --  [anywhere]/0            [anywhere]/0            tcp dpt:25565
    
    Chain ufw-user-limit (0 references)
    target     prot opt source               destination         
    LOG        all  --  [anywhere]/0            [anywhere]/0            limit: avg 3/min burst 5 LOG flags 0 level 4 prefix "[UFW LIMIT BLOCK] "
    REJECT     all  --  [anywhere]/0            [anywhere]/0            reject-with icmp-port-unreachable
    
    Chain ufw-user-limit-accept (0 references)
    target     prot opt source               destination         
    ACCEPT     all  --  [anywhere]/0            [anywhere]/0           
    
    Chain ufw-user-logging-forward (0 references)
    target     prot opt source               destination         
    
    Chain ufw-user-logging-input (0 references)
    target     prot opt source               destination         
    
    Chain ufw-user-logging-output (0 references)
    target     prot opt source               destination         
    
    Chain ufw-user-output (1 references)
    target     prot opt source               destination         
    
    ##### LET'S ENCRYPT #####
    acme.sh is installed in /root/.acme.sh/acme.sh
    
    

    /etc/roundcube/config.inc.php
    Code:
    <?php
    
    /*
    +-----------------------------------------------------------------------+
    | Local configuration for the Roundcube Webmail installation.           |
    +-----------------------------------------------------------------------+
    */
    
    $config = array();
    
    // Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database!
    include_once("/etc/roundcube/debian-db-roundcube.php");
    
    // The IMAP host chosen to perform the log-in.
    $config['default_host'] = '%n';
    
    // SMTP server host (for sending mails).
    $config['smtp_server'] = 'localhost';
    
    // SMTP port. Use 25 for cleartext, 465 for Implicit TLS, or 587 for STARTTLS (default)
    $config['smtp_port'] = 25;
    
    // SMTP username (if required) if you use %u as the username Roundcube
    // will use the current username for login
    $config['smtp_user'] = '%u';
    
    // SMTP password (if required) if you use %p as the password Roundcube
    // will use the current user's password for login
    $config['smtp_pass'] = '%p';
    
    // provide an URL where a user can get support for this Roundcube installation
    // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
    $config['support_url'] = '';
    
    // Name your service. This is displayed on the login screen and in the window title
    $config['product_name'] = 'Roundcube Webmail';
    
    // This key is used to encrypt the users imap password which is stored
    // YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
    $config['des_key'] = 'MySecretKeyGoesHereREMOVED';
    
    // List of active plugins (in plugins/ directory)
    // Debian: install roundcube-plugins first to have any
    $config['plugins'] = array(
    );
    
    // skin name: folder from skins/
    $config['skin'] = 'elastic';
    
    // Disable spellchecking
    // Debian: spellchecking needs additional packages to be installed, or calling external APIs
    //         see defaults.inc.php for additional informations
    $config['enable_spellcheck'] = false;
    
    /var/log/roundcube/errors.log
    Code:
    [11-May-2022 19:03:54 +0000]: <qo7v3rfq> PHP Error: Connection refused (POST /webmail/?_task=mail&_unlock=loading1652295834629&_framed=1&_action=send)
    [11-May-2022 19:03:54 +0000]: <qo7v3rfq> PHP Error: Failed to connect socket: Connection refused (POST /webmail/?_task=mail&_unlock=loading1652295834629&_framed=1&_action=send)
    [11-May-2022 19:03:54 +0000]: <qo7v3rfq> SMTP Error: Connection failed: Failed to connect socket: Connection refused in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1702 (POST /webmail/?_task=mail&_unlock=loading1652295834629&_framed=1&_action=send)
    
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    What is the status of postfix?
    Code:
    systemctl status postfix
     
  3. Rescue9

    Rescue9 Member

    Code:
    ● postfix.service - Postfix Mail Transport Agent
         Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
         Active: active (exited) since Wed 2022-05-11 18:39:24 UTC; 1h 38min ago
        Process: 2321 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 2321 (code=exited, status=0/SUCCESS)
            CPU: 1ms
    
    May 11 18:39:24 bishop systemd[1]: Starting Postfix Mail Transport Agent...
    May 11 18:39:24 bishop systemd[1]: Finished Postfix Mail Transport Agent.
    
    Server runs fine with all inbound pop, imap, and smtp connection from Outlook and other clients... just not with Roundcube.
     
  4. Rescue9

    Rescue9 Member

    I have no idea what happened.... but please mark this closed.
    On a hunch, I reran ispconfig_update.sh --force. Then logged into Roundcube again. When I tried to send, I got the standard "SMTP AUTH 250" error. I looked in /etc/roundcube/config.inc.php and noticed
    Code:
    $config['smtp_port'] = 587; 
    I changed that back to 25 and it worked. Again... not sure how, but alas... it's fixed.
     
    Th0m likes this.

Share This Page