RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1460642 - the connect_ports plugin does not produce any report when matching AVC appears
Summary: the connect_ports plugin does not produce any report when matching AVC appears
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: setroubleshoot-plugins
Version: 7.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Vit Mojzis
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-12 10:13 UTC by Milos Malik
Modified: 2018-10-30 09:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:47:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3101 0 None None None 2018-10-30 09:47:55 UTC

Description Milos Malik 2017-06-12 10:13:09 UTC
Description of problem:
* the output of sealert -l '*' does not contain any report from the connect_ports plugin, even if the right AVC appeared (AVC that matched conditions of the plugin)

Version-Release number of selected component (if applicable):
setroubleshoot-server-3.2.28-3.el7.x86_64
setroubleshoot-plugins-3.0.65-1.el7.noarch

How reproducible:
* always

Steps to Reproduce:
# seinfo --portcon=789
	portcon tcp 512-1023 system_u:object_r:hi_reserved_port_t:s0
	portcon udp 512-1023 system_u:object_r:hi_reserved_port_t:s0
# sesearch -s auditctl_t -t hi_reserved_port_t -c tcp_socket -p name_connect -A -C -D

# setenforce 0
# runcon system_u:system_r:auditctl_t:s0 bash -c 'nc localhost 789'
Ncat: Connection refused.
# setenforce 1
# ausearch -m avc -i -ts recent # only showing the right AVC
----
type=PROCTITLE msg=audit(06/12/2017 06:02:50.418:380) : proctitle=bash -c nc localhost 789 
type=SYSCALL msg=audit(06/12/2017 06:02:50.418:380) : arch=x86_64 syscall=connect success=no exit=EINPROGRESS(Operation now in progress) a0=0x3 a1=0xc8c050 a2=0x1c a3=0x7ffd48c65930 items=0 ppid=9122 pid=27030 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=3 comm=nc exe=/usr/bin/ncat subj=system_u:system_r:auditctl_t:s0 key=(null) 
type=AVC msg=audit(06/12/2017 06:02:50.418:380) : avc:  denied  { name_connect } for  pid=27030 comm=nc dest=789 scontext=system_u:system_r:auditctl_t:s0 tcontext=system_u:object_r:hi_reserved_port_t:s0 tclass=tcp_socket 
type=AVC msg=audit(06/12/2017 06:02:50.418:380) : avc:  denied  { connect } for  pid=27030 comm=nc scontext=system_u:system_r:auditctl_t:s0 tcontext=system_u:system_r:auditctl_t:s0 tclass=tcp_socket 
----

Actual results:
# sealert -l '*' | grep -i plugin
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
*****  Plugin catchall (100. confidence) suggests   **************************
#

Expected results:
* at least 1 report comes from the connect_ports plugin

Comment 2 Vit Mojzis 2018-08-06 14:12:24 UTC
The AVC in bug description should not trigger the connect_ports plugin since there needs to be at least one "allowed target type" for the source domain (type to which the domain has access to). Otherwise the suggestion is not valid.

#sesearch -A  -p name_connect -s auditctl_t -C
None

The plugin works properly with the following AVC:

type=AVC msg=audit(1533554112.594:1026): avc:  denied  { name_connect } for  pid=8115 comm="nc" dest=789 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:hi_reserved_port_t:s0 tclass=tcp_socket

Current "correct" behaviour is actually caused by an exception in "allowed_target_types" (triggered when search() returns None)
line: 
wtypes = [x[TARGET] for x in [y for y in search([ALLOW], {SOURCE: self.scontext.type, CLASS: self.tclass, PERMS: self.access}) if y["enabled"]]]

which should be handled properly.
The following patch should fix the issue:

https://github.com/fedora-selinux/setroubleshoot/pull/73

Comment 7 errata-xmlrpc 2018-10-30 09:47:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3101


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