Description of problem: Detaching a filesystem-based Portable Service does not work: ``` [I] sam@ausecuma ~/s/portable-walkthrough (main)> sudo portablectl attach /opt/serialosc (Matching unit files with prefix 'serialosc'.) Created directory /etc/systemd/system.attached/serialosc.service.d. Written /etc/systemd/system.attached/serialosc.service.d/20-portable.conf. Created symlink /etc/systemd/system.attached/serialosc.service.d/10-profile.conf → /usr/lib/systemd/portable/profile/default/service.conf. Copied /opt/serialosc/usr/local/lib/systemd/system/serialosc.service → /etc/systemd/system.attached/serialosc.service. Created symlink /etc/portables/serialosc → /opt/serialosc. [I] sam@ausecuma ~/s/portable-walkthrough (main)> sudo portablectl detach /opt/serialosc DetachImage failed: Access denied ``` Disabling SELinux with `setenforce 0` works around the issue. Relevant audit.log entry appears to be this: ``` type=USER_AVC msg=audit(1652264980.399:749): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc: denied { status } for auid=n/a uid=0 gid=0 path="/etc/systemd/system.attached/serialosc.service" cmdline="/usr/lib/systemd/systemd-portabled" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:etc_runtime_t:s0 tclass=service permissive=0 exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'^]UID="root" AUID="unset" AUID="root" UID="root" GID="root" SAUID="root" ``` Related issue: https://bugzilla.redhat.com/show_bug.cgi?id=1922580 - I have confirmed that this bug is also still present in Fedora 35. Version-Release number of selected component (if applicable): > portablectl --version systemd 249 (v249.11-2.fc35) +PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified How reproducible: always. Steps to Reproduce: 1. Attach a portable service from filesystem (if you try to attach an image, you will hit https://bugzilla.redhat.com/show_bug.cgi?id=1922580) 2. Try to detach it. Actual results: Access denied error. Expected results: Service is detached.
I would like you to test a workaround. My assumptions are: 1) SELinux label on the systemd-portabled file was not changed: # ls -Z /usr/lib/systemd/systemd-portabled system_u:object_r:init_exec_t:s0 /usr/lib/systemd/systemd-portabled # 2) After starting the systemd-portabled service, the systemd-portabled process runs as init_t: system_u:system_r:init_t:s0 root 1448 1 0 05:22 ? 00:00:00 /usr/lib/systemd/systemd-portabled The workaround consists of the following commands: # chcon -t usr_t /usr/lib/systemd/systemd-portabled # systemctl restart systemd-portabled Purpose of the workaround is to run the systemd-portabled service as unconfined_service_t (instead of init_t) and see if that helps. Does the portablectl command mentioned above work now? Thank you.
Why a workaround? Because SELinux policy currently does not provide any special policy for the systemd-portabled program.
Hi Milos, Thanks for the workaround, I just tested this and the commands work without error now.
There are plans to confined the service, but probably only for F37.
This message is a reminder that Fedora Linux 35 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '35'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 35 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13. Fedora Linux 35 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.