AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 859339
Accepted
Dimitrios Desyllas
Dimitrios Desyllas
Asked: 2017-07-05 09:38:04 +0800 CST2017-07-05 09:38:04 +0800 CST 2017-07-05 09:38:04 +0800 CST

Haproxy 负载平衡 IMAP、POP3、SMTP:无法使用错误模式的代理“imap”,需要:http,有:tcp

  • 772

我尝试通过 haproxy 将所有传入的电子邮件流量反向代理到 我的 debian 服务器中的mailcow-dockerized解决方案:

配置haproxy.cfg是:

global
    log /dev/log    local0
    log /dev/log    local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private

    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL). This list is from:
    #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
    ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
    ssl-default-bind-options no-sslv3

defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http


frontnend smtp
   bind *:25
   default_backend smtp_public

frontend submission
  bind *:587
  default_backend smtp_submission

frontend smtp_ssl
   bind *:449
   default_backend smtp_ssl

frontend pop3
  bind *:995
  default_backend pop3_

frontend imap
  bind *:993
  default_backend imap

backend smtp_public 
   mode tcp
   option tcplog
   server docker 127.0.0.1:2525 check

backend smtp_ssl
   mode tcp
   option tcplog
   server docker 127.0.0.1:2465

backend smtp_submission
   mode tcp
   option tcplog
   server docker 127.0.0.1:2587

backend pop3_
   mode tcp
   option tcplog
   server docker 127.0.0.1:2995

backend imap
   mode tcp
   option tcplog
   server docker 127.0.0.1:2993

运行的图像是:

ec79939443d4        mailcow/acme:1.3        "/srv/docker-entry..."   46 hours ago        Up 46 hours                                                           
29c295d44767        mailcow/rspamd:1.1      "/docker-entrypoin..."   46 hours ago        Up 46 hours                                                           
2d09fd009c39        nginx:mainline-alpine   "/bin/sh -c 'envsu..."   46 hours ago        Up 46 hours (healthy)   80/tcp, 0.0.0.0:8080->8080/tcp                
a00d9477c464        mailcow/fail2ban:1.0    "python2 -u /logwa..."   46 hours ago        Up 46 hours                                                           
6fdf54789459        mailcow/phpfpm:1.0      "/docker-entrypoin..."   46 hours ago        Up 46 hours             9000/tcp                                      
091d621123aa        mailcow/sogo:1.0        "/bin/sh -c 'exec ..."   46 hours ago        Up 46 hours                                                           
1028c60923a0        redis:alpine            "docker-entrypoint..."   46 hours ago        Up 46 hours             6379/tcp                                      
827c20cee898        mailcow/dovecot:1.0     "/docker-entrypoin..."   46 hours ago        Up 46 hours             24/tcp, 10001/tcp, 0.0.0.0:2110->110/tcp, 0.0.
76a977a8064e        mailcow/postfix:1.0     "/bin/sh -c 'exec ..."   46 hours ago        Up 46 hours             588/tcp, 0.0.0.0:2525->25/tcp, 0.0.0.0:2465->4
2299076f475f        memcached:alpine        "docker-entrypoint..."   46 hours ago        Up 46 hours             11211/tcp                                     
03b56dcc1563        mailcow/unbound:1.0     "/docker-entrypoin..."   46 hours ago        Up 46 hours (healthy)   53/tcp, 53/udp                                
21f5a3673f3f        mariadb:10.1            "docker-entrypoint..."   46 hours ago        Up 46 hours (healthy)   3306/tcp                                      
e2af96428a94        robbertkl/ipv6nat       "/docker-ipv6nat -..."   46 hours ago        Up 46 hours                                                           
97fcf9ad82ad        mailcow/clamd:1.0       "/bootstrap.sh"          46 hours ago        Up 46 hours             3310/tcp 

但我收到以下错误:

Ιούλ 04 17:28:51 DockerMailserver haproxy[58310]: [ALERT] 184/172851 (58310) : Unable to use proxy 'imap' with wrong mode, required: http, has: tcp.
Ιούλ 04 17:28:51 DockerMailserver haproxy[58310]: [ALERT] 184/172851 (58310) : You may want to use 'mode http'.
Ιούλ 04 17:28:51 DockerMailserver haproxy[58310]: [ALERT] 184/172851 (58310) : Proxy 'imap': unable to find required default_backend: 'imap'.
Ιούλ 04 17:28:51 DockerMailserver haproxy[58310]: [ALERT] 184/172851 (58310) : Fatal errors found in configuration.
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: haproxy.service holdoff time over, scheduling restart.
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: Stopping HAProxy Load Balancer...
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: Starting HAProxy Load Balancer...
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: haproxy.service start request repeated too quickly, refusing to start.
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: Failed to start HAProxy Load Balancer.
Ιούλ 04 17:28:51 DockerMailserver systemd[1]: Unit haproxy.service entered failed state.

各位大侠知道如何解决这个错误吗?

smtp
  • 1 1 个回答
  • 6913 Views

1 个回答

  • Voted
  1. Best Answer
    Andy Shinn
    2017-07-05T10:05:21+08:002017-07-05T10:05:21+08:00

    根据文档,mode可以在所有部分(backend、、、、frontend)defaults上设置listen。你有一个defaults部分mode http。这是否适用于frontend未指定模式的部分?

    尝试mode tcp为使用后端的前端指定mode tcp.

    • 4

相关问题

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 如何将 SMTP 直接从 IIS 6.0 服务器中继到 Exchange 2003 服务器

  • 使用 telnet 或 netcat 发送带有附件的电子邮件

  • 我应该使用什么策略在 linux 上安装 smtp 服务器?用于多线程服务

  • 适用于 Linux 的 SMTP 服务器,配置简单

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve