-
Notifications
You must be signed in to change notification settings - Fork 161
systemd #1007
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?
systemd #1007
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,11 @@ tunable_policy(`allow_ssh_keysign',` | |
domtrans_pattern(ssh_t, ssh_keysign_exec_t, ssh_keysign_t) | ||
') | ||
|
||
ifdef(`init_systemd',` | ||
systemd_user_runtime_dir_unlink(ssh_agent_tmp_t, sock_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably allow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would you suggest doing that? Have userdom_user_tmp_file() add an attribute to it named user_tempfile and then have an interface to allow unlinking user_tempfile attribute? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that sounds good. |
||
systemd_user_sessions_manage_sock_file(ssh_agent_tmp_t) | ||
') | ||
|
||
tunable_policy(`use_nfs_home_dirs',` | ||
fs_manage_nfs_dirs(ssh_t) | ||
fs_manage_nfs_files(ssh_t) | ||
|
@@ -291,6 +296,7 @@ ifdef(`init_systemd',` | |
# dynamic users | ||
init_stream_connect(sshd_t) | ||
init_rw_stream_sockets(sshd_t) | ||
systemd_dgram_nspawn(sshd_t) | ||
systemd_write_inherited_logind_sessions_pipes(sshd_t) | ||
') | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -116,12 +116,23 @@ template(`systemd_role_template',` | |||
# container engines will move container processes to different slices | ||||
init_dbus_chat($1_systemd_t) | ||||
|
||||
# for services run by init such as /run/systemd/oom/io.system.ManagedOOM | ||||
init_unix_stream_socket_connectto($1_systemd_t) | ||||
|
||||
# the [email protected] unit is restarted when containers are created | ||||
systemd_get_user_manager_units_status($1_systemd_t) | ||||
systemd_start_user_manager_units($1_systemd_t) | ||||
systemd_stop_user_manager_units($1_systemd_t) | ||||
systemd_reload_user_manager_units($1_systemd_t) | ||||
|
||||
systemd_list_userdb_runtime_dirs($1_systemd_t) | ||||
systemd_stream_connect_homed($1_systemd_t) | ||||
|
||||
# for wireplumber | ||||
systemd_read_logind_runtime_files($3) | ||||
systemd_watch_logind_runtime_dirs($3) | ||||
|
||||
miscfiles_read_fonts($1_systemd_t) | ||||
miscfiles_watch_localization($1_systemd_t) | ||||
|
||||
mount_read_runtime_files($1_systemd_t) | ||||
|
@@ -131,19 +142,26 @@ template(`systemd_role_template',` | |||
seutil_search_default_contexts($1_systemd_t) | ||||
seutil_read_file_contexts($1_systemd_t) | ||||
|
||||
userdom_list_user_home_dirs($1_systemd_t) | ||||
userdom_watch_user_home_dirs($1_systemd_t) | ||||
userdom_list_user_home_content($1_systemd_t) | ||||
userdom_write_user_tmp_sockets($1_systemd_t) | ||||
|
||||
systemd_manage_conf_home_content($1_systemd_t) | ||||
systemd_manage_data_home_content($1_systemd_t) | ||||
|
||||
systemd_search_user_runtime_unit_dirs($1_systemd_t) | ||||
systemd_search_user_transient_unit_dirs($1_systemd_t) | ||||
systemd_read_user_units_files($1_systemd_t) | ||||
systemd_read_logind_state($1_systemd_t) | ||||
systemd_write_notify_socket($1_systemd_t) | ||||
|
||||
dbus_system_bus_client($1_systemd_t) | ||||
dbus_spec_session_bus_client($1, $1_systemd_t) | ||||
dbus_connect_spec_session_bus($1, $1_systemd_t) | ||||
|
||||
userdom_exec_user_bin_files($1_systemd_t) | ||||
userdom_list_user_tmp($1_systemd_t) | ||||
|
||||
# user systemd-tmpfiles rules | ||||
allow $1_systemd_tmpfiles_t $1_systemd_t:unix_stream_socket rw_socket_perms; | ||||
|
@@ -234,6 +252,7 @@ template(`systemd_role_template',` | |||
xdg_data_filetrans($1_systemd_t, systemd_data_home_t, dir, "systemd") | ||||
xdg_read_config_files($1_systemd_t) | ||||
xdg_read_data_files($1_systemd_t) | ||||
xdg_watch_cache_dirs($1_systemd_t) | ||||
') | ||||
|
||||
optional_policy(` | ||||
|
@@ -341,6 +360,25 @@ interface(`systemd_write_notify_socket',` | |||
allow $1 systemd_runtime_notify_t:sock_file write_sock_file_perms; | ||||
') | ||||
|
||||
####################################### | ||||
## <summary> | ||||
## Allow the specified domain to stat the | ||||
## systemd-notify socket | ||||
## </summary> | ||||
## <param name="domain"> | ||||
## <summary> | ||||
## Domain allowed access. | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_getattr_notify_socket',` | ||||
gen_require(` | ||||
type systemd_runtime_notify_t; | ||||
') | ||||
|
||||
allow $1 systemd_runtime_notify_t:sock_file getattr; | ||||
') | ||||
|
||||
###################################### | ||||
## <summary> | ||||
## Allow the target domain the permissions necessary | ||||
|
@@ -370,6 +408,29 @@ template(`systemd_user_send_systemd_notify',` | |||
allow $2 $1_systemd_t:unix_dgram_socket sendto; | ||||
') | ||||
|
||||
###################################### | ||||
## <summary> | ||||
## Allow the target domain to have unix stream sockets created for it | ||||
## </summary> | ||||
## <param name="prefix"> | ||||
## <summary> | ||||
## Prefix for the user domain. | ||||
## </summary> | ||||
## </param> | ||||
## <param name="domain"> | ||||
## <summary> | ||||
## Domain to allow the systemd user instance to monitor. | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
template(`systemd_user_create_unix_stream_socket',` | ||||
gen_require(` | ||||
type $1_systemd_t; | ||||
') | ||||
|
||||
allow $1_systemd_t $2:unix_stream_socket { create setopt bind listen }; | ||||
') | ||||
|
||||
###################################### | ||||
## <summary> | ||||
## Allow the target domain to be monitored and have its output | ||||
|
@@ -2955,6 +3016,83 @@ interface(`systemd_status_all_user_sessions',` | |||
allow $1 systemd_user_session_type:system status; | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## allow systemd --user to create stream sockets for a process | ||||
## </summary> | ||||
## <param name="domain"> | ||||
## <summary> | ||||
## Domain to own the socket | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_user_sessions_create_stream_socket',` | ||||
gen_require(` | ||||
attribute systemd_user_session_type; | ||||
') | ||||
|
||||
allow systemd_user_session_type $1:unix_stream_socket { create setopt bind listen }; | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## allow systemd --user to create stream socket file | ||||
## </summary> | ||||
## <param name="type"> | ||||
## <summary> | ||||
## type of the socket file | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_user_sessions_create_sock_file',` | ||||
gen_require(` | ||||
attribute systemd_user_session_type; | ||||
') | ||||
|
||||
allow systemd_user_session_type $1:sock_file { create getattr write }; | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## allow systemd --user to manage stream socket file | ||||
## </summary> | ||||
## <param name="type"> | ||||
## <summary> | ||||
## type of the socket file | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_user_sessions_manage_sock_file',` | ||||
gen_require(` | ||||
attribute systemd_user_session_type; | ||||
') | ||||
|
||||
allow systemd_user_session_type $1:sock_file manage_sock_file_perms; | ||||
') | ||||
Comment on lines
+3019
to
+3071
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These need to be changed into abstract socket and named socket activation, like is done with the pid 1 equivalents. Then the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this would definitely help readability of the policy too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? init_t doesn't seem to be able to do the same sorts of things. sesearch -A -s init_t -c sock_file -p createallow files_unconfined_type file_type:sock_file { append create execmod execute getattr ioctl link lock map mounton open quotaon read relabelfrom relabelto rename setattr unlink watch watch_mount watch_reads watch_sb watch_with_perm write }; sesearch -A -s init_t -c unix_stream_socket -p createallow unconfined_domain_type domain:unix_stream_socket { accept append bind connect connectto create getattr getopt ioctl listen lock map name_bind read recvfrom relabelfrom relabelto sendto setattr setopt shutdown write }; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. refpolicy/policy/modules/system/init.if Line 385 in 5a5814e
|
||||
|
||||
######################################## | ||||
## <summary> | ||||
## Unlink user runtime entries | ||||
## </summary> | ||||
## <param name="type"> | ||||
## <summary> | ||||
## Type to unlink | ||||
## </summary> | ||||
## </param> | ||||
## <param name="class"> | ||||
## <summary> | ||||
## class to unlink | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_user_runtime_dir_unlink',` | ||||
gen_require(` | ||||
type systemd_user_runtime_dir_t; | ||||
') | ||||
|
||||
allow systemd_user_runtime_dir_t $1:$2 unlink; | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## Execute systemd-sysusers in the | ||||
|
@@ -3019,3 +3157,52 @@ interface(`systemd_use_inherited_machined_ptys', ` | |||
allow $1 systemd_machined_t:fd use; | ||||
allow $1 systemd_machined_devpts_t:chr_file rw_inherited_term_perms; | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## run systemd-nspawn in systemd_nspawn_t domain | ||||
## </summary> | ||||
## <param name="domain"> | ||||
## <summary> | ||||
## Domain allowed access. | ||||
## </summary> | ||||
## </param> | ||||
## <param name="role"> | ||||
## <summary> | ||||
## The role of the object to create. | ||||
## </summary> | ||||
## </param> | ||||
## <param name="boolean"> | ||||
## <summary> | ||||
## boolean to allow this | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_run_nspawn', ` | ||||
gen_require(` | ||||
type systemd_nspawn_t, systemd_nspawn_exec_t; | ||||
') | ||||
|
||||
role $2 types systemd_nspawn_t; | ||||
tunable_policy(`$3', ` | ||||
domtrans_pattern($1, systemd_nspawn_exec_t, systemd_nspawn_t) | ||||
') | ||||
') | ||||
|
||||
######################################## | ||||
## <summary> | ||||
## send datagrams to systemd_nspawn_t | ||||
## </summary> | ||||
## <param name="domain"> | ||||
## <summary> | ||||
## Domain allowed access. | ||||
## </summary> | ||||
## </param> | ||||
# | ||||
interface(`systemd_dgram_nspawn', ` | ||||
gen_require(` | ||||
type systemd_nspawn_t, systemd_nspawn_var_run_t; | ||||
') | ||||
|
||||
dgram_send_pattern($1, systemd_nspawn_var_run_t, systemd_nspawn_var_run_t, systemd_nspawn_t) | ||||
') |
Uh oh!
There was an error while loading. Please reload this page.