Skip to content

Commit 27988a6

Browse files
Add more Windows Kerberos delegation info (#2779) (#2798)
Adds more information on testing Kerberos delegation on Windows. It includes a klist.exe example command for showing how to retrieve a service ticket for a specific service. (cherry picked from commit 21a526c) Co-authored-by: Jordan Borean <[email protected]>
1 parent 1e61074 commit 27988a6

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

docs/docsite/rst/os_guide/windows_winrm_kerberos.rst

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ Kerberos delegation allows the credentials to traverse multiple hops. This is us
178178
* request the connection plugin to allow delegation to the server
179179
* the AD user is not marked as sensitive and cannot be delegated and is not a member of the ``Protected Users`` group
180180
* depending on the ``krb5.conf`` configuration, the target server may need to allow unconstrained delegation through its AD object delegation settings
181+
* the target resource to delegate to must be accessible with Kerberos authentication
181182
182183
To request a forwardable TGT, either add the ``-f`` flag to the ``kinit`` command or set the ``forwardable = true`` option in the ``[libdefaults]`` section of the ``krb5.conf`` file. If you are using the ``psrp`` or ``winrm`` connection plugin to retrieve the TGT from the user's password in the inventory, it will automatically request a forwardable TGT if the connection plugin is configured to use delegation.
183184
@@ -243,7 +244,7 @@ To verify that delegation is working, you can use the ``klist.exe`` command on t
243244
244245
.. code-block:: shell
245246
246-
$ ansible WINHOST -m ansible.windows.win_command -a klist.exe
247+
$ ansible WINHOST -m ansible.windows.win_command -a C:/Windows/System32/klist.exe
247248
248249
WINHOST | CHANGED | rc=0 >>
249250
@@ -266,7 +267,7 @@ If anything goes wrong, the output for ``klist.exe`` will not have the ``forward
266267
267268
.. code-block:: shell
268269
269-
$ ansible WINHOST -m ansible.windows.win_command -a klist.exe
270+
$ ansible WINHOST -m ansible.windows.win_command -a C:/Windows/System32/klist.exe
270271
271272
WINHOST | CHANGED | rc=0 >>
272273
@@ -285,6 +286,34 @@ If anything goes wrong, the output for ``klist.exe`` will not have the ``forward
285286
Cache Flags: 0x8 -> ASC
286287
Kdc Called:
287288
289+
It is also important to ensure that the target resource to delegate to will work with Kerberos authentication. This means that the target server must have a Service Principal Name (``SPN``) registered in Active Directory (``AD``) and that the outbound authentication attempt on Windows uses the hostname and not an IP address/alias. For example, you should access a fileshare using the path ``\\server.fqdn.com\share`` and not ``\\192.168.1.2\share``. To verify that an SPN is registered and the session Ansible runs under can delegate using Kerberos, you can use the following ``klist.exe`` command to request a service ticket for the target server.
290+
291+
.. code-block:: shell
292+
293+
$ ansible WINHOST -m ansible.windows.win_command -a 'C:/Windows/System32/klist.exe get cifs/fs.my.domain.com'
294+
295+
WINHOST | CHANGED | rc=0 >>
296+
297+
Current LogonId is 0:0x225639b
298+
A ticket to cifs/fs.my.domain.com has been retrieved successfully.
299+
300+
Cached Tickets: (2)
301+
302+
...
303+
304+
#2> Client: username @ MY.DOMAIN.COM
305+
Server: cifs/fs.my.domain.com @ MY.DOMAIN.COM
306+
KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96
307+
Ticket Flags 0x60a50000 -> forwardable forwarded renewable pre_authent ok_as_delegate name_canonicalize
308+
Start Time: 8/30/2024 14:16:24 (local)
309+
End Time: 8/31/2024 0:16:12 (local)
310+
Renew Time: 0
311+
Session Key Type: AES-256-CTS-HMAC-SHA1-96
312+
Cache Flags: 0x8 -> ASC
313+
Kdc Called: dc01.my.domain.com
314+
315+
.. note::
316+
The SPN prefix for the target server depends on the service you are trying to access. The ``cifs`` service if used for file shares, ``http`` for web services, and so on. Make sure to use the correct prefix for testing our Kerberos delegation.
288317
289318
Troubleshooting Kerberos
290319
------------------------

0 commit comments

Comments
 (0)