Bug 1908527 - openvswitch service triggers SELinux alerts: fsetid
Summary: openvswitch service triggers SELinux alerts: fsetid
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 33
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-16 23:17 UTC by Vadim Rutkovsky
Modified: 2021-11-30 18:44 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-30 18:44:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vadim Rutkovsky 2020-12-16 23:17:56 UTC
Description of problem:

Dec 16 22:47:09 fedora audit[798]: AVC avc:  denied  { fsetid } for  pid=798 comm="install" capability=4  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0

Version-Release number of selected component (if applicable):
openvswitch-2.14.0-2.fc33.x86_64
selinux-policy-3.14.6-31.fc33.noarch
selinux-policy-targeted-3.14.6-31.fc33.noarch

How reproducible:
Always

Comment 1 Zdenek Pytela 2020-12-16 23:35:04 UTC
Hi,

The fsetid capability is required for:

      CAP_FSETID
              * Don't clear set-user-ID and set-group-ID mode bits when a file is modified;
              * set the set-group-ID bit for a file whose GID does not match the filesystem  or
                any of the supplementary GIDs of the calling process.

Will you be able to identify which files are affected?

# remove syscall auditing suppression
auditctl -d never,task
# enable full path auditing
auditctl -w /etc/shadow -p w
<reproduce>
# list audit records
ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today

Comment 2 Milos Malik 2020-12-17 11:57:04 UTC
# service openvswitch start
Redirecting to /bin/systemctl start openvswitch.service
# service openvswitch status
Redirecting to /bin/systemctl status openvswitch.service
● openvswitch.service - Open vSwitch
     Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; disabled; vendor preset: disa>
     Active: active (exited) since Thu 2020-12-17 06:53:53 EST; 1s ago
    Process: 2637 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 2637 (code=exited, status=0/SUCCESS)
        CPU: 1ms
...

leads to following SELinux denials:
----
type=PROCTITLE msg=audit(12/17/2020 06:53:53.116:453) : proctitle=install -d -m 755 -o openvswitch -g hugetlbfs /var/run/openvswitch 
type=PATH msg=audit(12/17/2020 06:53:53.116:453) : item=0 name=(null) inode=1245 dev=00:1a mode=dir,700 ouid=openvswitch ogid=hugetlbfs rdev=00:00 obj=system_u:object_r:openvswitch_var_run_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=SYSCALL msg=audit(12/17/2020 06:53:53.116:453) : arch=x86_64 syscall=fchmod success=yes exit=0 a0=0x5 a1=0755 a2=0x0 a3=0x1000 items=1 ppid=2504 pid=2549 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=install exe=/usr/bin/install subj=system_u:system_r:openvswitch_t:s0 key=(null) 
type=AVC msg=audit(12/17/2020 06:53:53.116:453) : avc:  denied  { fsetid } for  pid=2549 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
type=AVC msg=audit(12/17/2020 06:53:53.116:453) : avc:  denied  { fsetid } for  pid=2549 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
----

# rpm -qa selinux\* openvswitch\* | sort
openvswitch-2.14.0-3.fc34.x86_64
selinux-policy-3.14.7-7.fc34.noarch
selinux-policy-targeted-3.14.7-7.fc34.noarch
#

Comment 4 Vadim Rutkovsky 2021-01-11 10:22:47 UTC
(In reply to Zdenek Pytela from comment #1)
> Will you be able to identify which files are affected?
> 
> # remove syscall auditing suppression
> auditctl -d never,task
> # enable full path auditing
> auditctl -w /etc/shadow -p w
> <reproduce>
> # list audit records
> ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today

Here's what I get:

----
type=AVC msg=audit(01/11/21 10:16:31.622:135) : avc:  denied  { fsetid } for  pid=816 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
----
type=AVC msg=audit(01/11/21 10:16:31.622:136) : avc:  denied  { fsetid } for  pid=816 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
----
type=AVC msg=audit(01/11/21 10:17:20.505:362) : avc:  granted  { setsecparam } for  pid=7683 comm=tuned scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=security 
----
type=PROCTITLE msg=audit(01/11/21 10:17:28.045:396) : proctitle=/usr/libexec/platform-python -Es /usr/sbin/tuned --no-dbus 
type=SYSCALL msg=audit(01/11/21 10:17:28.045:396) : arch=x86_64 syscall=write success=yes exit=3 a0=0x5 a1=0x7fae440142c0 a2=0x3 a3=0x7fae55fafc78 items=0 ppid=1 pid=7683 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=tuned exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:spc_t:s0 key=(null) 
type=AVC msg=audit(01/11/21 10:17:28.045:396) : avc:  granted  { setsecparam } for  pid=7683 comm=tuned scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=security 
----
type=AVC msg=audit(01/11/21 10:18:56.250:131) : avc:  denied  { fsetid } for  pid=812 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
----
type=AVC msg=audit(01/11/21 10:18:56.250:132) : avc:  denied  { fsetid } for  pid=812 comm=install capability=fsetid  scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 
----
type=AVC msg=audit(01/11/21 10:18:59.378:166) : avc:  denied  { name_bind } for  pid=1335 comm=rpcbind src=64764 scontext=system_u:system_r:rpcbind_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=udp_socket permissive=0 
----
type=AVC msg=audit(01/11/21 10:19:43.549:342) : avc:  granted  { setsecparam } for  pid=7397 comm=tuned scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=security

So, it seems `tuned` is attempting to rewrite group ID for /usr/libexec/platform-python3.6?

Comment 5 Zdenek Pytela 2021-01-11 12:29:59 UTC
Hi,

There are 3 distinct denials. In this bz, we focus on the fsetid. The others are unrelated: the name_bind one is under investigation in bz#1758147, setsecparam is granted.

Withouth the PATH record, it is not clear just from audit what is happening there. We probably need to debug deeper (strace, gdb).

Comment 6 Zdenek Pytela 2021-02-11 18:25:25 UTC
Vadim,

There are no additional audit records in your output so we cannot troubleshoot further. Note the steps in #c1 were not meant for permanent changes, perhaps you rebooted in the meantime?

We can followup on Milos's findings in #c2: Can you switch the system to permissive mode and list the directory?

setenforce 0
...start the service...
ls -lZa /var/run/openvswitch

Is it possible the directory already existed before, with different permissions?

Comment 7 Zdenek Pytela 2021-03-16 19:30:34 UTC
I suppose this bz can also be a dup of
https://bugzilla.redhat.com/show_bug.cgi?id=1931470

If you don't have any additional data to debug on, let's wait on the development: it has been reported as a bug in XFS and there is a patch already:

https://lore.kernel.org/linux-xfs/20210316173226.2220046-1-omosnace@redhat.com/T/

Comment 8 Zdenek Pytela 2021-05-06 19:57:12 UTC
I've backported the dontaudit rule from rawhide:
https://github.com/fedora-selinux/selinux-policy/pull/726

Comment 9 Ben Cotton 2021-11-04 14:03:51 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
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
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2021-11-04 14:32:56 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
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
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Ben Cotton 2021-11-04 15:30:42 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
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
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Ben Cotton 2021-11-30 18:44:47 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 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 please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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