HAProxy Active Directory - 如何解决“主机名与证书中的通用名称不匹配”错误

问题描述 投票:0回答:0

我有许多应用程序只能指向单个 Active Directory 服务器以进行 LDAP 身份验证。为了在身份验证中提供冗余,我一直在研究一种解决方案,以在服务器发生故障或因维护而中断时代理域服务器。

我有一个 HAProxy 配置工作

frontend ad_fe
    log global
    bind *:636
    mode tcp
    option tcplog
    default_backend ad_be

backend ad_be
    log global
    mode tcp
    server server01 server01.mydomain.net:636 ca-file /certs/ad_ca_cert.crt check
    server server02 server02.mydomain.net:636 ca-file /certs/ad_ca_cert.crt check
    server server03 server03.mydomain.net:636 ca-file /certs/ad_ca_cert.crt check backup

    option       tcp-check
    tcp-check    connect port 636 ssl
    tcp-check    send-binary 300c0201          # LDAP bind request "<ROOT>" simple
    tcp-check    send-binary 01                # message ID
    tcp-check    send-binary 6007              # protocol Op
    tcp-check    send-binary 0201              # bind request
    tcp-check    send-binary 03                # LDAP v3
    tcp-check    send-binary 04008000          # name, simple authentication
    tcp-check    expect binary 0a0100          # bind response + result code: success
    tcp-check    send-binary 30050201034200    # unbind request

代理服务器正在运行,SSL 直通正在运行。问题是我的 LDAP 查询现在被定向到代理,当 LDAP 服务器收到请求并且无法将主机名与证书匹配时出现错误

TLS: hostname (proxy.mydomain.net) does not match common name in certificate

我可以更新本地主机文件以将正确的服务器名称映射到代理,但是当 server2 或 server3 被命中时它仍然失败。

有没有办法重写服务器 FQDN 以便 LDAP 服务器接收正确的主机名?这不是在 HTTP 模式下运行,所以通常的标头重写不存在,我一直无法找到另一种方法。 HAProxy 是这项工作的最佳工具吗?

haproxy
© www.soinside.com 2019 - 2024. All rights reserved.