Bug 2088703

Summary: usbguard can not log to audit log (audit_write denied)
Product: [Fedora] Fedora Reporter: Rik Theys <rik.theys>
Component: usbguardAssignee: Attila Lakatos <alakatos>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: alakatos, dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, pkoncity, rsroka, vmojzis, zfridric, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-25 15:26:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rik Theys 2022-05-20 07:18:46 UTC
Description of problem:

usbguard can be configured to log to the linux audit log instead of a dedicated log file by setting the AuditBackend parameter in usbguard-daemon.conf to 'LinuxAudit'

When usbguard is configured like this, the following selinux denials are logged:

time->Fri May 20 08:39:02 2022
type=AVC msg=audit(1653028742.119:1055): avc:  denied  { audit_write } for  pid=343284 comm="usbguard-daemon" capability=29  scontext=system_u:system_r:usbguard_t:s0 tcontext=system_u:system_r:usbguard_t:s0 tclass=capability permissive=0



Version-Release number of selected component (if applicable):
selinux-policy-targeted-36.8-2.fc36.noarch
usbguard-1.1.0-3.fc36.x86_64


How reproducible:

Always

Steps to Reproduce:
1. Update /etc/usbguard/usbguard-daemon.conf abd set AuditBackend to LinuxAudit
2. Trigger a usbguard message (plug in a USB device)
3.

Actual results:
SElinux denial message in audit log

Expected results:
usbguard audit information in audit log

Additional info:

Comment 1 Milos Malik 2022-05-20 07:34:03 UTC
The following SELinux denial appeared multiple times in enforcing mode:
----
type=PROCTITLE msg=audit(05/20/2022 03:30:34.235:587) : proctitle=/usr/sbin/usbguard-daemon -f -s -c /etc/usbguard/usbguard-daemon.conf 
type=SOCKADDR msg=audit(05/20/2022 03:30:34.235:587) : saddr={ saddr_fam=netlink nlnk-fam=16 nlnk-pid=0 } 
type=SYSCALL msg=audit(05/20/2022 03:30:34.235:587) : arch=x86_64 syscall=sendto success=yes exit=668 a0=0xa a1=0x7fff5fe9bf50 a2=0x29c a3=0x0 items=0 ppid=1 pid=2797 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=usbguard-daemon exe=/usr/sbin/usbguard-daemon subj=system_u:system_r:usbguard_t:s0 key=(null) 
type=AVC msg=audit(05/20/2022 03:30:34.235:587) : avc:  denied  { audit_write } for  pid=2797 comm=usbguard-daemon capability=audit_write  scontext=system_u:system_r:usbguard_t:s0 tcontext=system_u:system_r:usbguard_t:s0 tclass=capability permissive=0 
----

Reproducer:
1) update /etc/usbguard/usbguard-daemon.conf file and set AuditBackend to LinuxAudit
2) (re)start the usbguard service

This BZ should be reassigned to the usbguard component, because it ships its own policy:

# rpm -qa selinux\* usbguard\* | sort
selinux-policy-37.1-1.fc37.noarch
selinux-policy-targeted-37.1-1.fc37.noarch
usbguard-1.1.0-3.fc37.x86_64
usbguard-selinux-1.1.0-3.fc37.noarch
#

Comment 2 Milos Malik 2022-05-20 07:35:27 UTC
The following SELinux denial appeared in permissive mode:
----
type=PROCTITLE msg=audit(05/20/2022 03:34:18.741:606) : proctitle=/usr/sbin/usbguard-daemon -f -s -c /etc/usbguard/usbguard-daemon.conf 
type=SOCKADDR msg=audit(05/20/2022 03:34:18.741:606) : saddr={ saddr_fam=netlink nlnk-fam=16 nlnk-pid=0 } 
type=SYSCALL msg=audit(05/20/2022 03:34:18.741:606) : arch=x86_64 syscall=sendto success=yes exit=652 a0=0xa a1=0x7fff3effc5f0 a2=0x28c a3=0x0 items=0 ppid=1 pid=2847 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=usbguard-daemon exe=/usr/sbin/usbguard-daemon subj=system_u:system_r:usbguard_t:s0 key=(null) 
type=AVC msg=audit(05/20/2022 03:34:18.741:606) : avc:  denied  { audit_write } for  pid=2847 comm=usbguard-daemon capability=audit_write  scontext=system_u:system_r:usbguard_t:s0 tcontext=system_u:system_r:usbguard_t:s0 tclass=capability permissive=1 
----

Comment 3 Zdenek Pytela 2022-05-23 07:31:27 UTC
Switching the component, consider using logging_send_audit_msgs() if appropriate.

Comment 4 Ben Cotton 2023-04-25 17:12:28 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
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 '36'.

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. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 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.

Comment 5 Ludek Smid 2023-05-25 15:26:31 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 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.