在 Ansible 中,附加到 Active Directory 的计算机的凭据被拒绝

In Ansible, Credentials were rejected for Computers Attached to Active Directory

我有三台 3 Windows 台电脑。一个是 Windows server 2012,另外两个是 Windows 7 Desktop。通过 Ansible,我可以通过本地登录帐户单独管理所有 3 windows 台机器。 Ansible 完美运行。

现在我在windows server 2012 中配置了AD,并将两台台式机加入到AD 中。通过 Active Directory 的管理员帐户,我可以通过所有 3 Windows 台机器登录。

为了在 ansible 中管理 AD 帐户,我安装了 keberos,如 this documentaion.

中所述

我的配置如下:

/etc/krb5.conf

[libdefaults]

default_realm = NAANAL.IN

[realms]

NAANAL.IN = {
    kdc = WIN2012.naanal.in
    default_domain = naanal.in
}

[domain_realm]

.naanal.in = NAANAL.IN

[login]

krb4_convert = true
krb4_get_tickets = false

连接和票证详细信息:

kinit Administrator@NAANAL.IN
Password for Administrator@NAANAL.IN:



klist
Ticket cache: FILE:/tmp/krb5cc_1000
Default principal: Administrator@NAANAL.IN

Valid starting       Expires              Service principal
2016-07-10T20:41:25  2016-07-11T06:41:25  krbtgt/NAANAL.IN@NAANAL.IN
    renew until 2016-07-11T20:40:33

现在我只是尝试通过 ping 我的所有 windows 机器 帐户 Administrator@NAANAL.IN

这是我的配置和输出:

主机

[windows]
192.168.1.13  -> Windows 7 Desktop Attached to AD
192.168.1.23  -> Windows 7 Desktop Attached to AD
172.30.64.77  -> Windows 2012 with AD

group_vars/windows.yaml

ansible_user: Administrator@NAANAL.IN
ansible_password: p@ssw0rd1
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore

而我运行ansible windows -i hosts -m win_ping

192.168.1.13 | UNREACHABLE! => {
"changed": false,
"msg": "ssl: the specified credentials were rejected by the server",
"unreachable": true
}
192.168.1.23 | UNREACHABLE! => {
"changed": false,
"msg": "ssl: the specified credentials were rejected by the server",
"unreachable": true
}
172.30.64.77 | SUCCESS => {
"changed": false,
"ping": "pong"
}

即在 Ansible 中,我无法通过 AD 用户帐户登录到附加到 AD 的计算机。我错过了什么?

注意: 我在桌面中启用了远程连接。还尝试禁用防火墙。

我注意到你的 /etc/krb5.conf 中有这两行:

krb4_convert = true
krb4_get_tickets = false

它们实际上是告诉 Kerberos 转换守护进程获取 V4 票证,然后告诉它不要接受 v4 票证。除了代码中的矛盾之外,所有版本的 Active Directory 都只使用过 Kerberos v5。从 krb5.ini.

中删除这些行

参考:https://web.mit.edu/kerberos/krb5-1.4/krb5-1.4.1/doc/krb5-admin/login.html