Skip to content

feat(selinux): make Trivalent policy role-agnostic#1593

Merged
RoyalOughtness merged 2 commits intosecureblue:livefrom
HastD:trivalent-confined
Nov 11, 2025
Merged

feat(selinux): make Trivalent policy role-agnostic#1593
RoyalOughtness merged 2 commits intosecureblue:livefrom
HastD:trivalent-confined

Conversation

@HastD
Copy link
Copy Markdown
Collaborator

@HastD HastD commented Nov 9, 2025

Currently the Trivalent SELinux policy implicitly assumes that the user is unconfined, and doesn't work for confined users. This modifies the policy to work for confined users as well.

The trivalent_t and trivalent_script_t domains are replaced by trivalent_domain and trivalent_script_domain attributes, containing domains $1_trivalent_t and $1_trivalent_script_t, respectively, for each role $1_r permitted to run Trivalent.

The use of domain prefixes allows for role-dependent domain transitions, so for example staff_trivalent_t can be authorized to run something as staff_$2_t. This will be useful once the new flatpak policy is in use, and I included commented-out lines that will allow for Trivalent-flatpak integration to keep working after we switch to that policy.

Currently the Trivalent SELinux policy implicitly assumes that the user
is unconfined, and doesn't work for confined users. This modifies the
policy to work for confined users as well.

The `trivalent_t` and `trivalent_script_t` domains are replaced by
`trivalent_domain` and `trivalent_script_domain` attributes, containing
domains `$1_trivalent_t` and `$1_trivalent_script_t`, respectively, for
each role `$1_r` permitted to run Trivalent.

The use of domain prefixes allows for role-dependent domain transitions,
so for example `staff_trivalent_t` can be authorized to run something as
`staff_$2_t`. This will be useful once the new flatpak policy is in use,
and I included commented-out lines that will allow for Trivalent-flatpak
integration to keep working after we switch to that policy.

Signed-off-by: Daniel Hast <[email protected]>
Copy link
Copy Markdown
Collaborator

@WavyEbuilder WavyEbuilder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome change to me. The use of a typeattribute here isn't a huge deal, but it's expensive for something you don't need it for (typeattributes are expensive). Why not just put all accesses in the trivalent_role_template template, and grant $1_trivalent_t access? Same applies for the trivalent script domain.

Copy link
Copy Markdown
Collaborator

@WavyEbuilder WavyEbuilder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved because of rationale for wanting to provide trivalent_domain to make it easier for others to add rules.

@RoyalOughtness RoyalOughtness enabled auto-merge (squash) November 11, 2025 21:01
@RoyalOughtness RoyalOughtness merged commit d2b6929 into secureblue:live Nov 11, 2025
19 checks passed
@HastD HastD deleted the trivalent-confined branch November 11, 2025 21:14
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.

3 participants