-
Notifications
You must be signed in to change notification settings - Fork 168
Add specialized Networkmanager dispatch domains #1055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
|
I don't quite understand how to avoid the lint complain about the template-generated domain used in the |
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>
f8f2324 to
c73bdc4
Compare
| /etc/wicd/wireless-settings\.conf -- gen_context(system_u:object_r:NetworkManager_etc_rw_t, s0) | ||
| /etc/wicd/wired-settings\.conf -- gen_context(system_u:object_r:NetworkManager_etc_rw_t, s0) | ||
|
|
||
| /usr/lib/NetworkManager/dispatcher\.d(/.*)? -- gen_context(system_u:object_r:NetworkManager_initrc_exec_t,s0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with the original bin_t for generic dispatching. We should keep NetworkManager_initrc_exec_t for init/start scripts. Arguably the below nm-dispatcher fcs should probably be NetworkManager_exec_t instead.
| ######################################## | ||
| ## <summary> | ||
| ## Create a set of derived types for | ||
| ## networkmanager dispatcher scripts. | ||
| ## </summary> | ||
| ## <param name="prefix"> | ||
| ## <summary> | ||
| ## The prefix to be used for deriving type names. | ||
| ## </summary> | ||
| ## </param> | ||
| # | ||
| template(`networkmanager_dispatch_script',` | ||
| gen_require(` | ||
| attribute NetworkManager_dispatch_domains; | ||
| attribute NetworkManager_dispatch_exec_type; | ||
|
|
||
| type NetworkManager_t; | ||
| ') | ||
|
|
||
| type NetworkManager_dispatch_$1_t, NetworkManager_dispatch_domains; | ||
| domain_type(NetworkManager_dispatch_$1_t) | ||
| corecmd_shell_entry_type(NetworkManager_dispatch_$1_t) | ||
| role system_r types NetworkManager_dispatch_$1_t; | ||
|
|
||
| type NetworkManager_dispatch_$1_exec_t, NetworkManager_dispatch_exec_type; | ||
| domain_entry_file(NetworkManager_dispatch_$1_t, NetworkManager_dispatch_$1_exec_t) | ||
|
|
||
| allow NetworkManager_dispatch_$1_t NetworkManager_dispatch_$1_exec_t:file entrypoint; | ||
| domtrans_pattern(NetworkManager_t, NetworkManager_dispatch_$1_exec_t, NetworkManager_dispatch_$1_t) | ||
| ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a template, it should go at the top of the file.
| init_rw_inherited_stream_socket(NetworkManager_dispatch_domains) | ||
| init_use_inherited_script_ptys(NetworkManager_dispatch_domains) | ||
| kernel_read_system_state(NetworkManager_dispatch_domains) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in a separate block later in the file, i.e. a block for all rules that have NetworkManager_dispatch_domains as the subject/sources.
| userdom_dontaudit_use_unpriv_user_fds(NetworkManager_t) | ||
| userdom_dontaudit_use_user_ttys(NetworkManager_t) | ||
|
|
||
| exec_files_pattern(NetworkManager_t, NetworkManager_dispatch_exec_type, NetworkManager_dispatch_exec_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary since you already have a domtrans for each of the domains/entrypoints.
Currently, NetworkManager dispatch scripts are tagged as
NetworkManager_initrc_exec_t, and run in theNetworkManager_tdomain itself. However, those scripts may require permissions different than those ofNetworkManager_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_tin favor ofNetworkManager_initrc_exec_t. Alternatively, we could stop using (ab)usingNetworkManager_initrc_exec_t, and just usebin_teveywhere (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.confto its chroot.