0

Have been trying to solve an issue for two weeks with no success. So I will break it into smaller questions in hope to understand the process and find a solution.

We have a Windows AD domain with some Linux (Debian) clients joined via sssd. The domain joined Linux clients send security events to the DC Server (Event IDs: 4624, 4768, 4769, 4770, 4634, 4661, 4623). All events are populating on the AD. So the devices are communicating. Our issue lies in some of the values (fields) within these events (TargetUserName for example shows hostname instead of username - we need it to show username so our SSO Agent can read the user status).

Question 1: How/where are the events generated on the Linux Client? I want to know which file(S) generate the security events mentioned above so I can take a closer look and modify if needed.

Question 2: Which method does the Linux client tell the KDC (AD) that a domain user logged in/out/is active/changed groups etc? Does it use the keytab (/etc/krb5.keytab) for the host for communication or does it use the user token file generated under /tmp/krb5cc_****_ ?

I can provide the sssd, smbclient, krb5 whatever config files here if needed.

shafuq
  • 103
  • 4

1 Answers1

1

Question 1: How/where are the events generated on the Linux Client? I want to know which file(S) generate the security events mentioned above so I can take a closer look and modify if needed.

AD clients do not send any security events explicitly. (Allowing them to generate arbitrary events would be... insecure.) Anything that is logged as an event at a DC is logged by the DC itself and is the result of some other action done by the client to the DC.

For example, the DC will only log event 4768 when it handles an actual Kerberos AS-REQ message (to issue an initial Kerberos ticket); if a client authenticates e.g. using the older Netlogon protocol instead of Kerberos, the DC won't log 4768.

Our issue lies in some of the values (fields) within these events (TargetUserName for example shows hostname instead of username - we need it to show username so our SSO Agent can read the user status).

The user ID logged in that event is not arbitrarily chosen by the client, but is the exact user ID whose credentials were just verified by the DC. So if the user ID is "computer$", that literally means the DC issued a ticket for the machine account "computer$" and not for any person account.

Question 2: Which method does the Linux client tell the KDC (AD) that a domain user logged in/out/is active/changed groups etc?

AD doesn't do central session accounting, so there are no actual "logged in" events being sent – the closest is an "authenticated via Kerberos" or "authenticated via Netlogon protocol" event indicating that credentials were verified, but it doesn't really indicate that a session was set up. Similarly, there are no "is active" or "logged out" events at all, a user is logged in as long as they have a valid Kerberos TGT.

If you're seeing login/logout events from Windows clients, they most likely correspond to a session being created on the DC, not on the client; more specifically I suspect that they correspond to the Windows client connecting to the Sysvol file share hosted on your DC in order to download User GPO files. A Linux client running Winbind won't look at GPO at all; though a client running SSSD might.

There are no "group change" events – the DC informs clients about what groups a user is member of, not the other way around. (Local group membership is not reported to DCs and doesn't influence any security decisions outside of the local machine – when accessing e.g. a file server over SMB, only the DC-provided groups listed in your Kerberos ticket's PAC are used.)

Does it use the keytab (/etc/krb5.keytab) for the host for communication or does it use the user token file generated under /tmp/krb5cc_****_ ?

Both. An AD client uses its machine credentials (krb5.keytab or LSA "machine password") for retrieving user information (such as mapping usernames to UIDs and back) and downloading machine-level Group Policy, while programs invoked by the user will rely on the user's own Kerberos credentials ($KRB5CCNAME or per-user LSA creds) to access file servers, perform web SSO, etc.

One major difference is that in most Linux AD clients, standard communications with the LDAP directory are handled by a single service (SSSD or Winbind) which then always uses machine credentials to retrieve information, e.g. if you run ls -la to list files, their owner UIDs/GIDs are translated by SSSD/Winbind using the machine credentials – whereas in Windows the same communications are done directly by the process that needs the data, e.g. if you're adding a user to file ACLs through the "Security" tab, it is Explorer.exe that performs the actual LDAP search and does so using the user's credentials.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • Really appreciate your thorough answer and knowledge. It's hard for me to describe the issue when I can't wrap my head around it myself. – shafuq Oct 13 '22 at 08:13
  • From what I understand from your reply the DC gathers (for example) event ID 4768 when the client issues an initial kerberos ticket. This event (I assume) to be the one the SSO agent uses to tell if the user is still active. The SSO has a timeout configuration that I adjusted to 30 minutes. Once the 30 minutes is over IF the user has not communicated with the DC the user object drops. Meaning my firewall no longer can handle that user since the SSO doesn't have the object any longer. <-- This is one of the two issues I'm trying to solve and the reason behind these questions. – shafuq Oct 13 '22 at 08:19
  • There are tons of these events on the DC Event Viewer. The difference is between Windows and Linux logs. The Windows events almost always have the username in them.. But the linux ones have machine_name$ instead. This is why I was trying to find what I can do to modify the logs. But from your answer it seems I can't modiy because the machine is sending the AS-REQ not the user. For me to solve the problems I need a way for the domain user that is logged on to the Linux computer to send the mentioned kerberos tickets-tgt (like AS-REQ and such). – shafuq Oct 13 '22 at 08:24
  • We have SSSD here as I stated. You say sssd (and winbind) uses machine credentials by default. Is there a way I can use user creds instead? – shafuq Oct 13 '22 at 08:25