Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1913414

Summary: SELinux is preventing systemd-journal-upload from 'name_connect' accesses on the tcp_socket port 19532
Product: Red Hat Enterprise Linux 8 Reporter: Anthony Zone <azone>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: dtardon, lvrabec, mmalik, plautrba, qguo, ssekidde, systemd-maint-list
Target Milestone: rcKeywords: Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-76.el8 Doc Type: Bug Fix
Doc Text:
Cause: The systemd-journal-upload service was unable to connect to port 19532/tcp Consequence: The systemd-journal-upload service failed to start. Fix: A new policy was added for the systemd-journal-upload service. The port 19532/tcp is labeled with the journal_remote_port_t type. Result: The systemd-journal-upload service now connects to port 19532/tcp and starts properly.
Story Points: ---
Clone Of:
: 2085369 (view as bug list) Environment:
Last Closed: 2021-11-09 19:42:29 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:
Bug Depends On:    
Bug Blocks: 2085369    

Description Anthony Zone 2021-01-06 17:54:06 UTC
Description of problem:

    Installing systemd-journal-upload and attempting to configure and start it leads to an AVC denial:

    type=AVC msg=audit(1609881810.697:656): avc:  denied  { name_connect } for  pid=4815 comm="systemd-journal" dest=19532 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0


Version-Release number of selected component (if applicable):

    # rpm -qa | grep -iE 'selinux|systemd'
    libselinux-2.9-4.el8_3.x86_64
    systemd-libs-239-41.el8_3.1.x86_64
    rpm-plugin-selinux-4.14.3-4.el8.x86_64
    selinux-policy-targeted-3.14.3-54.el8.noarch
    systemd-pam-239-41.el8_3.1.x86_64
    systemd-journal-remote-239-41.el8_3.1.x86_64
    rpm-plugin-systemd-inhibit-4.14.3-4.el8.x86_64
    python3-systemd-234-8.el8.x86_64
    python3-libselinux-2.9-4.el8_3.x86_64
    systemd-239-41.el8_3.1.x86_64
    systemd-udev-239-41.el8_3.1.x86_64
    selinux-policy-3.14.3-54.el8.noarch
    libselinux-utils-2.9-4.el8_3.x86_64


How reproducible:

    Every time.

Steps to Reproduce:

    1. Install systemd-journal-upload
    2. Configure to forward
    3. systemctl start systemd-journal-upload
    4. Fails with AVC denial

Actual results:

Fails to start with AVC denial:

    type=AVC msg=audit(1609881810.697:656): avc:  denied  { name_connect } for  pid=4815 comm="systemd-journal" dest=19532 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0

Expected results:

Starts without having to do any SELinux changes.

Additional info:

Issue can be solved either with:

    setsebool nis_enabled on

Or creating rule:

    allow init_t unreserved_port_t:tcp_socket name_connect;

Comment 1 Milos Malik 2021-01-08 12:40:12 UTC
Maybe SELinux policy can label the 19532/tcp port with something more specific:

# man systemd-journal-upload | col -b | grep -B 3 19532
       -u, --url=[https://]URL[:PORT], --url=[http://]URL[:PORT]
	   Upload to the specified address.  URL may specify either just the hostname or both
	   the protocol and hostname.  https is the default. The port number may be specified
	   after a colon (":"), otherwise 19532 will be used by default.
#

Comment 3 Zdenek Pytela 2021-07-09 18:39:33 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/801

It contains 2 commits, 1 applies to RHEL 9 only.

Comment 12 Zdenek Pytela 2021-07-29 07:10:37 UTC
I've submitted a Fedora PR to address the new issues:
https://github.com/fedora-selinux/selinux-policy/pull/815

Comment 14 Zdenek Pytela 2021-08-06 17:05:39 UTC
Commit to backport:

commit 15f0cbb953bc7a9e9b2858bf9b31ed8c234147bb (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Thu Jul 29 09:05:55 2021 +0200

    Update the policy for systemd-journal-upload

Comment 26 errata-xmlrpc 2021-11-09 19:42:29 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 (selinux-policy bug fix and enhancement update), 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-2021:4420