-
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
Conversation
Signed-off-by: Russell Coker <[email protected]>
@pebenito Does this need anything else? |
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.
cc @0xC0ncord for thoughts on systemd --user
changes.
######################################## | ||
## <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; | ||
') |
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.
These need to be changed into abstract socket and named socket activation, like is done with the pid 1 equivalents. Then the sock_file
can go with the named socket activation interface.
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.
Doing this would definitely help readability of the policy too.
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.
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 create
allow 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 };
allow filesystem_unconfined_type filesystem_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 };
allow init_t init_mountpoint_type:sock_file { create open }; [ init_create_mountpoints ]:True
allow kern_unconfined unlabeled_t: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 create
allow 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 };
root@xev:/home#
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.
refpolicy/policy/modules/system/init.if
Line 385 in 5a5814e
interface(`init_abstract_socket_activation',` |
') | ||
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably allow systemd --user
to clean up any user temp file instead.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that sounds good.
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.
Just a couple comments. The rest of the systemd --user
changes look good.
######################################## | ||
## <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; | ||
') |
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.
Doing this would definitely help readability of the policy too.
…spawn Signed-off-by: Russell Coker <[email protected]>
No description provided.