Skip to content

Add specialized Networkmanager dispatch domains - #1055

Open
aerusso wants to merge 3 commits into
SELinuxProject:mainfrom
aerusso:mrs/networkmanager-dispatch
Open

Add specialized Networkmanager dispatch domains#1055
aerusso wants to merge 3 commits into
SELinuxProject:mainfrom
aerusso:mrs/networkmanager-dispatch

Conversation

@aerusso

@aerusso aerusso commented Jan 11, 2026

Copy link
Copy Markdown
Contributor

Currently, NetworkManager dispatch scripts are tagged as NetworkManager_initrc_exec_t, and run in the NetworkManager_t domain itself. However, those scripts may require permissions different than those of NetworkManager_t.

This patch introduces an interface to generate domains for these specialized scripts, and grants permission for NetworkManager to transition into them, as well as communicate with it.

This patch also removes some old, incompatible tagging that used bin_t in favor of NetworkManager_initrc_exec_t. Alternatively, we could stop using (ab)using NetworkManager_initrc_exec_t, and just use bin_t eveywhere (the more I think about it, the more I prefer this, but I don't understand the choice, so maybe I'm missing something).

The last commit actually does something useful and creates a domain for the postfix NetworkManager dispatcher script so that it can properly propagate changes in /etc/resolv.conf to its chroot.

@aerusso

aerusso commented Jan 11, 2026

Copy link
Copy Markdown
Contributor Author

I don't quite understand how to avoid the lint complain about the template-generated domain used in the .fc file, or how to avoid the "foo used but not required" nit, given that it seems to understand that the domain was created in the same.

Comment thread policy/modules/services/networkmanager.if Outdated
@aerusso
aerusso force-pushed the mrs/networkmanager-dispatch branch from f8f2324 to c73bdc4 Compare January 13, 2026 03:56
Comment thread policy/modules/services/networkmanager.fc Outdated
Comment thread policy/modules/services/networkmanager.if Outdated
Comment thread policy/modules/services/networkmanager.te Outdated
Comment thread policy/modules/services/networkmanager.te Outdated
Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
Currently, NetworkManager dispatch scripts are tagged as
NetworkManager_initrc_exec_t, and run in the NetworkManager_t domain
itself.  However, those scripts may require permissions different than
those of NetworkManager_t.

This patch introduces an interface to generate domains for these
specialized scripts, and grants permission for NetworkManager to
transition into them, as well as communicate with them.

Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
postfix has a NetworkManager dispatch unit that copies /etc/resolv.conf
into its jail on some networking events.  This requires specialized
permissions beyond what NetworkManager is granted via the
NetworkManager_initrc_exec_t mechanism.

This patch creates a specialized NetworkManager dispatch domain that is
granted the appropriate additional authority.

Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
@aerusso
aerusso force-pushed the mrs/networkmanager-dispatch branch from c73bdc4 to a78def2 Compare August 16, 2026 14:49
@aerusso

aerusso commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Another thing that fell off my radar, sorry.


type NetworkManager_dispatch_$1_t, NetworkManager_dispatch_domains;
domain_type(NetworkManager_dispatch_$1_t)
corecmd_shell_entry_type(NetworkManager_dispatch_$1_t)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem right. The transition should hit when NM does the exec on the script. The entrypoint would be the script too. The shell doesn't come in until after the transition.


/usr/lib/NetworkManager/nm-dispatcher.* -- gen_context(system_u:object_r:NetworkManager_initrc_exec_t,s0)
/usr/lib/networkmanager/nm-dispatcher.* -- gen_context(system_u:object_r:NetworkManager_initrc_exec_t,s0)
/usr/lib/NetworkManager/dispatcher\.d(/.*)? -- gen_context(system_u:object_r:NetworkManager_exec_t,s0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the default for these should be bin_t.

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.

2 participants