Bug 1860423 - AVC when restarting tripleo_redis.service
Summary: AVC when restarting tripleo_redis.service
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates
Version: 17.0 (Wallaby)
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Emilien Macchi
QA Contact: David Rosenfeld
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-24 14:10 UTC by Emilien Macchi
Modified: 2022-09-21 12:11 UTC (History)
6 users (show)

Fixed In Version: openstack-tripleo-heat-templates-12.7.1-0.20201004002938.191ef2d.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-21 12:10:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github redhat-openstack openstack-selinux pull 68 0 None closed os-redis: allow init_t to unlink socket files 2020-11-25 11:51:02 UTC
OpenStack gerrit 743149 0 None MERGED Remove redundant file management for /run/redis 2020-11-25 11:51:02 UTC
Red Hat Issue Tracker OSP-14671 0 None None None 2022-04-13 19:54:34 UTC
Red Hat Product Errata RHEA-2022:6543 0 None None None 2022-09-21 12:11:55 UTC

Description Emilien Macchi 2020-07-24 14:10:33 UTC
Description of problem:

Restarting tripleo_redis.service causes an AVC if SElinux is enforced:

type=AVC msg=audit(1595596546.420:1482): avc:  denied  { unlink } for  pid=1 comm="systemd" name="redis.sock" dev="tmpfs" ino=419874 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:container_file_t:s0 tclass=sock_file permissive=0

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


How reproducible:

Deploy Redis via TripleO with SElinux enforced, and try to restart tripleo_redis.service with systemctl.

Steps to Reproduce:
1. Deploy Redis via TripleO
2. systemctl restart tripleo_redis.service

Actual results:

AVC in audit.log

Expected results:

No AVC
Additional info:

Comment 1 Julie Pichon 2020-07-24 15:04:57 UTC
The patch looks correct though I'd like to see Cedric's input on it first as the init_t part is strange.

I noticed Cedric brought this up on #tripleo:

 deployment/database/redis-container-puppet.yaml:                  ExecStartPre: /bin/chcon -t container_file_t /run/redis

and you said removing it made no difference. Just to double-check, could it be that /run/redis wasn't restored to its original context before trying again? ($ restorecon -F /run/redis) (result can be confirmed with ls -Z /run/redis).

It would be good to reproduce the error in permissive mode and attach the permissive audit.log to the bug as well.

Comment 2 Cédric Jeanneret 2020-07-27 05:57:23 UTC
Let's start by dropping this block first:
https://github.com/openstack/tripleo-heat-templates/blob/master/deployment/database/redis-container-puppet.yaml#L170-L172

It's redundant and therefore useless, and instruct systemd to create AND remove /run/redis on service start and stop. More than probably the root cause of the issue - this location is managed by tmpdir, and the container has the :z flag, so both ExecStartPre and RuntimeDirectory are useless.

Comment 3 Cédric Jeanneret 2020-10-20 09:44:49 UTC
Wallaby/osp-17? Modified without Fixed In Version? Care to update it? Thanks :).

Comment 5 Julie Pichon 2020-10-20 13:03:14 UTC
The patch resolving this was a THT patch -> https://review.opendev.org/743149 , the openstack-selinux PR is closed :) I can't see the patch due to opendev maintenance though... but since it merged in July, I picked a recent THT NVR for 17 instead. Hopefully that works for you Cedric, otherwise let me know and I can try and dig out something more precise.

Comment 13 errata-xmlrpc 2022-09-21 12:10:55 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 (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), 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/RHEA-2022:6543


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