** Description changed: + [ Impact ] + When using sss_override on systems joined to Active Directory via SSSD, overrides do not take effect when logging in or querying via User Principal Name (UPN) if the UPN and sAMAccountName differ. Additionally, querying the UPN returns the original high UID/GID and taints the SSSD cache, reverting lookups for the sAMAccountName back to the un- overridden IDs until the cache is invalidated. This issue has been raised for RHEL [0] and fixed upstream [1]. - Package: sssd 2.9.4-1.1ubuntu6.8 + Package: sssd 2.9.4-1.1ubuntu6.9 Release: Ubuntu 24.04 - To reproduce: + [ Test Plan ] - Configure an Active Directory account in sssd whose sAMAccountName and - UPN differ, e.g., + Launch a Samba AD DC and an SSSD client as LXD containers. Run these + commands on the host: ```bash - export SAN=testuser - export [email protected] + lxc launch ubuntu:noble ad-server + lxc launch ubuntu:noble ad-client + lxc exec ad-server -- cloud-init status --wait + lxc exec ad-client -- cloud-init status --wait ``` - Apply an override using the sAMAccountName and restart SSSD: + Copy the reproducer scripts into the containers: ```bash - sudo sss_override user-add testuser -u 2000 -g 2000 - sudo systemctl restart sssd + lxc file push setup-server.sh ad-server/root/ + lxc file push setup-client.sh ad-client/root/ + lxc file push reproduce.sh ad-client/root/ ``` - Check the override works for the sAMAccountName: + Run the setup scripts as root, and give the SSSD client the DC address. + + On ad-server (`lxc shell ad-server`), provision the domain: ```bash - id testuser + bash setup-server.sh ``` - Expected: `uid=2000`, `gid=2000`. The patch should not change this - behaviour. - - Query using the UPN: + On ad-client (`lxc shell ad-client`), join the domain. Replace `<DC IPv4 + address>` with the address on the `DC address:` line printed by `setup- + server.sh`: ```bash - id [email protected] + bash setup-client.sh <DC IPv4 address> ``` - Unpatched output: the original un-overridden UID/GID. - - Query the sAMAccountName again: + On ad-client, run the reproducer: ```bash - id testuser + bash reproduce.sh ``` - Unpatched output: the original UID/GID. The cache is tainted until it is - cleared with `sudo sss_cache -u testuser`. + The script adds an override for `[email protected]` if it is + missing, then runs four lookups. Unpatched output: - I plan to submit an SRU of the upstream backported patch [2]. + ```text + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + uid=<ORIGINAL_UID>([email protected]) gid=<ORIGINAL_GID>(domain [email protected]) groups=<ORIGINAL_GID>(domain [email protected]) + uid=<ORIGINAL_UID>([email protected]) gid=<ORIGINAL_GID>(domain [email protected]) groups=<ORIGINAL_GID>(domain [email protected]) + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + ``` + + The first line is `id [email protected]`, the sAMAccountName: + the override applies, so the uid and gid are 2000. The second line is + `id [email protected]`, the UPN: it returns the un-overridden + ids, so the UPN lookup bypassed the override. The third line repeats `id + [email protected]`: it also returns the un-overridden ids, + because the UPN lookup wrote a cache entry that the sAMAccountName + lookup reuses. The fourth line follows `sss_cache -u testuser@ad- + domain.internal`, which expires that entry, and the override applies + again. That recovery is what identifies the cache entry written by the + UPN lookup as the cause. + + The un-overridden ids derive from the domain SID, so they differ between + labs; they are the `<ORIGINAL_UID>` and `<ORIGINAL_GID>` placeholders + above. The un-overridden gid is the id of the domain users group, which + is why the same placeholder appears inside `groups=`. `id` prints no + group name for gid 2000 because no group with that id exists. + + With the patched package all four lookups return uid 2000 and gid 2000: + + ```text + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + uid=2000([email protected]) gid=2000 groups=2000,<ORIGINAL_GID>(domain [email protected]) + ``` + + [ Where problems could occur ] + + The changes being made are all called only in the code path leading + through the the lookup_fn field of `struct cache_req_plugin + cache_req_user_by_upn`. Any regressions in this code path risk breaking + anything looks up a user from the cache by UPN. + + * If the information returned by the patched code is incorrect, it's + possible that a user could effectively lose or gain permissions based + upon what sssd reports about them. + + * If the returned information is incomplete some calls that work when + using the sAMAccountName would not work with UPN, as in the original + bug. + + + [ Other Info ] + + * One of the upstream patches in the series [2] was dropped as it only + touches tests under `src/tests/system` which are not included in the src + tarball for 2.9.4. [0]: https://redhat.atlassian.net/browse/RHEL-72935 [1]: https://github.com/SSSD/sssd/pull/7998 [2]: https://github.com/SSSD/sssd/pull/8324
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2174674 Title: sss_overide gives wrong uid/gid when UPN and sAMAccountName differ To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/sssd/+bug/2174674/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
