Skip to content

Workload Identity: Add support for BOT accounts - #9104

Draft
pbrezina wants to merge 8 commits into
SSSD:masterfrom
pbrezina:workload-identity
Draft

Workload Identity: Add support for BOT accounts#9104
pbrezina wants to merge 8 commits into
SSSD:masterfrom
pbrezina:workload-identity

Conversation

@pbrezina

Copy link
Copy Markdown
Member

This pull requests implements changes described at:

It adds per-domain support for special, ephemeral, bot accoutns to represent a workload identity that acts on behalf of a user. The idea is that and MCP server exchanges a user's OAuth2 token for an S4U2Proxy Kerberos ticket to access a Kerberized service (we target SSH specifically for the use case, but any service can be used), The ticket, however, is not issued for the real user but for an ephemeral BOT principal, including MCP server's and request's metadata in the ticket. SSSD is able to resolve the BOT account into the user account, keeping uid and gid but overriding username and shell (for logging purposes and for executing commands via ssh inside our own shell). The shell will be able to log the actions and filter the commands based on the ticket scope and configuration.


This PR is in draft mode, but I would like it to get reviewed continuously as I deliver individual pieces.

Currently implemented:

[x] nss is able to resolve bot accounts
[] support bot accounts in in-memory cache for a quick lookup in nss_sss.so
[] add support to kerberos localname plugin
[] read metadata from kerberos ticket and pass it to pam
[] pass metadata from pam to the overriden shell
[] implement kerberos plugins to automatically attach metadata to new tickets obtained on the ssh host
[] IPA part

This adds a helper that parses an ephemeral bot name
(BOT-$uid-$random[@realm|@Domain] into struct sss_bot.
Switch to enable bot accounts lookup.

:config: A new configuration option `bot_accounts_enabled` to enable bot
  accounts lookup for the domain.
The bot account name has uid encoded in the name, we extract the uid
and proceed with user-by-id lookup. The information that a bot account
was resolved is stored inside struct cache_req_result.

This commit adds a support for all domains without the possibility to
override it. The logic that switching cache_req lookup type has to be
moved to the inner parts of cache_req in order to support per-domain
option do enable/disable this feature. However, I'm leaving this commit
as well to showcase the idea and make the review little bit easier.
The bot accounts can be enabled or disabled with per-domain
configuration option. If the name looks like a bot account and the
domain enables it, the cache_req will switch to by-uid lookups.
Bot accounts shares the same uid as the user on behalf which they act,
storing them in memcache would corrupt it.
If a bot account was resolved, we want to keep the uid and gid, but
override the name and shell so the bot name can then be passed by ssh
to pam, and so ssh can invoke our confined shell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant