Bug 1615048 - Users can't modify their own systemd unit files
Summary: Users can't modify their own systemd unit files
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 28
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-11 19:00 UTC by Robin Powell
Modified: 2018-09-11 16:55 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.14.1-42.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-11 16:55:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Robin Powell 2018-08-11 19:00:32 UTC
User systemd unit files are forced to the systemd_unit_file_t type:

policy/modules/system/systemd.fc
2:HOME_DIR/\.config/systemd/user(/.*)?          gen_context(system_u:object_r:systemd_unit_file_t,s0)

But, attempting to edit them gives (this is as staff_t, but it's the same as user_t):

type=AVC msg=audit(1534012749.473:23309811): avc:  denied  { write } for  pid=1085 comm="vim" name="glekitufa.service" dev="vde" ino=141294043 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1
type=AVC msg=audit(1534012749.473:23309812): avc:  denied  { write } for  pid=1085 comm="vim" name="user" dev="vde" ino=141291633 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1534012749.473:23309812): avc:  denied  { add_name } for  pid=1085 comm="vim" name="4913" scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1534012749.473:23309812): avc:  denied  { create } for  pid=1085 comm="vim" name="4913" scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1
type=AVC msg=audit(1534012749.474:23309813): avc:  denied  { setattr } for  pid=1085 comm="vim" name="4913" dev="vde" ino=141291520 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1
type=AVC msg=audit(1534012749.474:23309814): avc:  denied  { remove_name } for  pid=1085 comm="vim" name="4913" dev="vde" ino=141291520 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1534012749.474:23309814): avc:  denied  { unlink } for  pid=1085 comm="vim" name="4913" dev="vde" ino=141291520 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1
type=AVC msg=audit(1534012749.475:23309815): avc:  denied  { rename } for  pid=1085 comm="vim" name="glekitufa.service" dev="vde" ino=141294043 scontext=staff_u:staff_r:staff_t:s0 tcontext=staff_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1

Looking at the policy, the only relevant bits are:

policy/modules/roles/unprivuser.te
109:    systemd_read_unit_files(user_t)
110:    systemd_exec_systemctl(user_t)

policy/modules/roles/staff.te
264:    systemd_read_unit_files(staff_t)
265:    systemd_config_all_services(staff_t)
266:    systemd_exec_systemctl(staff_t)
267:    systemd_hwdb_mmap_config(staff_t)

Not sure what the right solution is; I'll be curious to see what you come up with.

Comment 1 Fedora Update System 2018-09-06 21:56:51 UTC
selinux-policy-3.14.1-42.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2d1b09d217

Comment 2 Fedora Update System 2018-09-07 17:12:18 UTC
selinux-policy-3.14.1-42.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2d1b09d217

Comment 3 Fedora Update System 2018-09-11 16:55:31 UTC
selinux-policy-3.14.1-42.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.