Bug 1860423

Summary: AVC when restarting tripleo_redis.service
Product: Red Hat OpenStack Reporter: Emilien Macchi <emacchi>
Component: openstack-tripleo-heat-templatesAssignee: Emilien Macchi <emacchi>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: high Docs Contact:
Priority: high    
Version: 17.0 (Wallaby)CC: cgoncalves, cjeanner, jpichon, lhh, lvrabec, mburns
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-heat-templates-12.7.1-0.20201004002938.191ef2d.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:10:55 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 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