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

时间:2016-07-10 15:33:26

标签: authentication active-directory ansible kerberos

我有三台3台Windows电脑。一个是Windows服务器2012,另外两个是Windows 7桌面。通过Ansible我可以通过他们的本地登录帐户单独管理所有3台Windows机器。 Ansible工作完美。

现在我在Windows Server 2012中配置AD,并且我将两台台式计算机连接到AD。通过Active Directory的管理员帐户,我可以登录所有3台Windows计算机。

在ansible中管理AD帐户我按照this documentaion.

中的说明安装了keberos

我的配置如下:

的/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的计算机。我想念的地方?

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

1 个答案:

答案 0 :(得分:1)

我在/etc/krb5.conf中注意到这两行:

krb4_convert = true
krb4_get_tickets = false

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

参考:http://localhost:9200