在名称不匹配的情况下,将SASL授权给LDAP后面的HAPROXY

MYEXAMPLE.ORG中的我的kerberos域,但服务器位于dmz-int.example.org dns区域。

LDAP服务器是b1.dmz-int.example.org; 其keytab包括:

 udo ktutil -k /etc/krb5.keytab列表
 /etc/krb5.keytab的:

 Vnotypes主要别名
   7 arcfour-hmac-md5 [email protected]
   7 aes128-cts-hmac-sha1-96 [email protected]
   7 aes256-cts-hmac-sha1-96 [email protected]
   7 arcfour-hmac-md5 host / [email protected]
   7 aes128-cts-hmac-sha1-96 host / [email protected]
   7 aes256-cts-hmac-sha1-96 host / [email protected]
   7 arcfour-hmac-md5 ldap / [email protected]
   7 aes128-cts-hmac-sha1-96 ldap / [email protected]
   7 aes256-cts-hmac-sha1-96 ldap / [email protected]
   7 arcfour-hmac-md5 ldap / [email protected]
   7 aes128-cts-hmac-sha1-96 ldap / [email protected]
   7 aes256-cts-hmac-sha1-96 ldap / [email protected]
   7 arcfour-hmac-md5 ldap / [email protected]
   7 aes128-cts-hmac-sha1-96 ldap / [email protected]
   7 aes256-cts-hmac-sha1-96 ldap / [email protected]

ldap2.myexample.orgldap2.myexample.orgCNAME

现在我可以连接到GSSAPI到LDAP服务器:

 $ kinit $ ldapsearch -ZZ -h b1.dmz-int.example.org 'uid=test' SASL/GSSAPI authentication started SASL username: [email protected] SASL SSF: 56 SASL data security layer installed. [...] $ ldapsearch -ZZ -h ldap2.myexample.org 'uid=test' SASL/GSSAPI authentication started SASL username: [email protected] SASL SSF: 56 SASL data security layer installed. [...] $ klist Credentials cache: FILE:/tmp/krb5cc_1000 Principal: [email protected] Issued Expires Principal Sep 6 09:03:35 2016 Sep 6 19:03:32 2016 krbtgt/[email protected] Sep 6 09:03:39 2016 Sep 6 19:03:32 2016 ldap/[email protected] 

看起来很好

现在来代理。

代理logging是ldap.dmz-int.example.org ,它的CNAMEldap.myexample.org

代理是HAPROXY层4端口389和636.没有SASL它工作正常。

 $ ldapsearch -ZZ -h ldap.myexample.org'uid = test'
 SASL / GSSAPI身份validation已启动
 ldap_sasl_interactive_bind_s:本地错误(-2)
        其他信息:SASL(-1):通用故障:GSSAPI错误:其他故障(请参见文本)(未find匹配凭证(ldap / [email protected])
 $ ldapsearch -h ldap.dmz-int.example.org'uid = test'
 SASL / GSSAPI身份validation已启动
 ldap_sasl_interactive_bind_s:本地错误(-2)
        其他信息:SASL(-1):通用故障:GSSAPI错误:其他故障(请参见文本)(未find匹配凭证(ldap / [email protected]

现在SASL不起作用。 在服务器密钥表中是否需要额外的SPN ? 我需要一些DNS修复? 为什么代理查询查找: ldap/[email protected]主体,而不是ldap/[email protected]

作为参考,请遵循haproxy conf文件:

 $ cat /etc/haproxy/haproxy.cfg
全球
        日志/ dev / log local0
 #log / dev / log local1通知
         chroot / var / lib / haproxy
        统计socket /run/haproxy/admin.sock模式660级别pipe理员
        统计超时30秒
        用户haproxy
        组haproxy
        守护进程

         #默认的SSL资料位置
         ca-base / etc / ssl / certs
         crt-base / etc / ssl / private

         #在启用了SSL的侦听套接字上使用的默认密码。
         #有关更多信息,请参阅密码(1SSL)。 此列表来自:
         #https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
         ECDH + AES126:DH + AES256:ECDH + 3DES:DH + 3DES:RSA + AESGCM:RSA + AES:RSA + 3DES :A零位:MD5:DSS
         ssl-default-bind-options no-sslv3

 #LDAP和LDAP / STARTTLS
前端ldap_service_front
  日志全球
  模式tcp
  绑定*:389
  描述LDAP服务
  选项套接字统计
  选项tcpka
  选项tcplog
  超时客户端10s
   default_backend ldap_service_back

后端ldap_service_back
  日志全球
  服务器ldap-1 b1.myexample.org:389检查下降1上升1内部2s
  服务器ldap-2 b2.myexample.org:389检查下降1上升1内部2s
  模式tcp
  平衡最less
  选项tcpka
  选项ldap-check
  超时服务器10s
  超时连接1s

您会在[libdefaults][appdefaults]的相应部分中想ignore_acceptor_hostname = true

ignore_acceptor_hostname
在接受基于主机的服务主体的GSSAPI或krb5安全上下文时,忽略调用应用程序传递的任何主机名,并允许客户端对匹配服务名称和领域名称(如果给定)的keytab中的任何服务主体进行身份validation。 此选项可以提高多宿主主机上服务器应用程序的pipe理灵活性,但可能会影响虚拟主机环境的安全性。
默认值是false。 新版本1.10。