Linux客户端尝试通过定位DNS名称(corp.example.com)进行AD身份验证时遇到问题.我有2个域控制器服务器DC1(10.0.0.3/24),DC2(10.1.0.3/24)这两个域控制器用于corp.example.com.在开始之前,每个Linux客户端都有明确定义的2个AD服务器IP地址中的1个.我经历了用域名(corp.example.com)替换IP地址,如下面的配置中所示.经过测试,效果很好.但是,通过关闭其中一个Dome Controller服务器来测试故障转移会导致某些Linux客户端无法进行身份验证和超时.当我认为这是一个网络问题时,请查看我最初发布的
DC/DNS failover with global/common DNS roundrobin.
在Linux客户端上:
/etc/openldap/ldap.conf中
uri ldap://DC1 ldap://DC2 base dc=corp,dc=example,dc=com
的/etc/krb5.conf
[libdefaults] default_realm = corp.example.com clockskew = 300 dns_lookup_kdc # default_realm = EXAMPLE.COM [realms] corp.example.com= { kdc = corp.example.com default_domain = corp.example.com kpasswd_server = corp.example.com admin_server = corp.example.com } # EXAMPLE.COM = { # kdc = kerberos.example.com # admin_server = kerberos.example.com # } [logging] kdc = FILE:/var/log/krb5/krb5kdc.log admin_server = FILE:/var/log/krb5/kadmind.log default = SYSLOG:NOTICE:DAEMON [domain_realm] .corp.example.com = corp.example.com .corp = corp.example.com [appdefaults] pam = { ticket_lifetime = 1d renew_lifetime = 1d forwardable = true proxiable = false minimum_uid = 1 external = sshd use_shmem = sshd clockskew = 300 retain_after_close = false }
/etc/resolve.conf
search corp.example.com nameserver 10.0.0.3 nameserver 10.1.0.3
这就是我在syslog-ng中看到的
Nov 30 09:04:56 linux_client nscd: nss_ldap: failed to bind to LDAP server ldap://ad3: Can't contact LDAP server Nov 30 09:04:59 linux_client sshd[15585]: nss_ldap: failed to bind to LDAP server ldap://ad3: Can't contact LDAP server Nov 30 08:50:19 linux_client sshd[15242]: Accepted keyboard-interactive/pam for jim from 10.0.0.231 port 61288 ssh2 Nov 30 08:52:02 linux_client sshd[15284]: nss_ldap: could not search LDAP server - Server is unavailable Nov 30 08:53:09 linux_client sshd[15284]: pam_unix2(sshd:auth): conversation failed Nov 30 08:53:16 linux_client sshd[15284]: error: ssh_msg_send: write Nov 30 08:53:26 linux_client sshd[15284]: pam_krb5[15284]: authentication fails for 'jim' (jim@corp.example.com): Authentication failure (Cannot read password) Nov 30 08:53:26 linux_client sshd[15284]: error: ssh_msg_send: write Nov 30 08:56:02 linux_client sshd[15289]: nss_ldap: could not search LDAP server - Server is unavailable Nov 30 08:56:27 linux_client sshd[15289]: pam_krb5[15289]: authentication succeeds for 'jim' (jim@corp.example.com) Nov 30 08:57:12 linux_client sshd[15289]: nss_ldap: could not search LDAP server - Server is unavailable Nov 30 08:57:18 linux_client sshd[15289]: _rebind_proc Nov 30 08:57:31 linux_client sshd[15289]: _rebind_proc Nov 30 08:57:34 linux_client sshd[15289]: _rebind_proc Nov 30 08:57:34 linux_client sshd[15289]: pam_ldap: ldap_result Timed out Nov 30 08:57:34 linux_client sshd[15289]: error: ssh_msg_send: write
我看起来好像没有尝试其他DC?
解决方法
/etc/openldap/ldap.conf不是使用DNS来故障转移域控制器,而是允许您使用空格分隔的ldap服务器列表.您仍然可以使用主机名而不是实际的IP地址.
例如:URI ldap://dc01.corp.example.com ldap://dc02.corp.example.com
有关更多信息,请参阅:http://linux.die.net/man/5/ldap.conf
我还注意到上面的2个IP地址位于不同的子网中.确保您的客户对两者都有通信.你已经调查了网络问题所以你可能没事,但我想提一下以防万一.