【问题标题】:Unable to allocate new TLS context无法分配新的 TLS 上下文
【发布时间】:2021-10-06 23:13:32
【问题描述】:

我在 Server 2019 上有 postfix 3.3.0 和 Active Directory。我希望连接安全并验证服务器证书。

尝试发送电子邮件时,我无法在syslog 中看到它。

postfix/submission/smtpd[7432]: warning: dict_ldap_set_tls_options: Unable to allocate new TLS context -1: Can't contact LDAP server

这是/etc/postfix/ldap-users.cf的内容

bind = yes
bind_dn = {valid bind account}
bind_pw = {valid bind password}
version = 3
timeout = 20

size_limit = 1
expansion_limit = 0

start_tls = yes
tls_require_cert = yes
tls_ca_cert_file = /var/spool/postfix/mydomain.tld.crt

server_host = ldap://dc.mydomain.tld/
search_base = dc=mydomain,dc=tld
scope = sub
query_filter = (&(objectClass=person)(mail=%s))

result_attribute = mail
result_format = %s

使用此配置,postmap -q test@mydomain.tld ldap:/etc/postfix/ldap-users.cf 可以工作。 openssl s_client -starttls ldap -connect dc.mydomain.tld:389 也有效(没有验证错误)。即使使用tls_require_cert = no,它仍然失败。当start_tls = no 时,一切正常。

在我指定tls_ca_cert_file 之前,我将我的.crt 导入ca-certificates。我收到的错误是postfix/postmap[4994]: error: dict_ldap_connect: Unable to set STARTTLS: -11: Connect error。似乎 Postfix 没有从计算机证书存储中读取。在使用我的home 中的tls_ca_cert_file 进行测试后,它变成了我现在遇到的错误,-1。我首先尝试从/etc/postfix,然后现在 chroot home(基于 Internet 建议 Postfix 无法访问它)。

【问题讨论】:

    标签: active-directory postfix-mta starttls


    【解决方案1】:

    我意识到我犯了从股票存储库安装的经典错误,最终得到了一个旧版本。我最终从源代码编译了 Postfix。

    sudo groupadd postfix
    sudo groupadd postdrop
    sudo useradd -c "Postfix Daemon User" -d /var/spool/postfix -g postfix -s /bin/false -u 32 postfix
    wget http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-3.6.2.tar.gz
    tar xzf postfix-3.6.2.tar.gz
    sudo apt-get install libdb-dev gcc m4 make libsasl2-dev openssl libssl-dev libldb-dev libldap2-dev
    cd postfix-3.6.2/
    make makefiles CCARGS="-I/usr/include/openssl -I/usr/include/sasl/ -DUSE_TLS -DHAS_LDAP -DUSE_SASL_AUTH -DUSE_CYRUS_SASL" AUXLIBS="-lssl -lcrypto -lldap -llber -lsasl2"
    make
    sudo make install
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-01
      • 2019-09-11
      • 1970-01-01
      • 1970-01-01
      • 2012-04-12
      • 2013-10-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多