Bug 1880171 - Upgrading host (or checking for updates) fails after 4.4.2 ovirt-engine upgrade
Summary: Upgrading host (or checking for updates) fails after 4.4.2 ovirt-engine upgrade
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: ovirt-host-deploy-ansible
Version: 4.4.2.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ovirt-4.4.3
: ---
Assignee: Martin Necas
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On:
Blocks: 1886333
TreeView+ depends on / blocked
 
Reported: 2020-09-17 20:09 UTC by Rik Theys
Modified: 2020-11-11 06:48 UTC (History)
6 users (show)

Fixed In Version: ansible-runner-service-1.0.6
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1886333 (view as bug list)
Environment:
Last Closed: 2020-11-11 06:42:12 UTC
oVirt Team: Infra
Embargoed:
pm-rhel: ovirt-4.4+
aoconnor: blocker+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ansible ansible-runner-service pull 87 0 None closed Packaging: use permanent selinux label on logs 2021-01-26 16:07:44 UTC

Description Rik Theys 2020-09-17 20:09:23 UTC
Hi,

Description of problem:

After upgrading my ovirt-engine to 4.4.2, I can no longer upgrade a host, or have it checked for updates.

The culprit seems to be a wrong label and/or selinux policy change for /var/log/ovirt-engine/ansible-runner-service.log.

The default label for this file is var_log_t. When this label is applied to the file, checking for updates/upgrading a host fails. When the label is changed to 
httpd_log_t, it works again.

So either the log file should have an updated selinux label in the policy, or the selinux policy should be updated to allow httpd_t to open the var_log_t file.

Regards,
Rik

Version-Release number of selected component (if applicable):
ovirt-engine-tools-4.4.2.6-1.el8.noarch

How reproducible:


Steps to Reproduce:
1. Upgrade engine to 4.4.2
2. Try to check for updates on a host
3.

Actual results:
Fails and the following selinux AVC is logged:

type=AVC msg=audit(1600372500.464:14501): avc:  denied  { open } for  pid=3713150 comm="httpd" path="/var/log/ovirt-engine/ansible-runner-service.log" dev="dm-0" ino=917760 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=1



Expected results:
Check for updates (or upgrading a host) works 

Additional info:

Comment 1 Martin Perina 2020-09-18 10:26:37 UTC
Are you sure that you have finished upgrading oVirt 4.4.2 properly according to upgrade guide?

https://www.ovirt.org/documentation/upgrade_guide/#Updating_the_Red_Hat_Virtualization_Manager_minor_updates

Have you executed 'yum update' after engine-setup to finish upgrading non oVirt packages? 
In this particular case could you please check that you are using ansible-runner-service-1.0.5?

Comment 2 RHEL Program Management 2020-09-18 10:26:46 UTC
The documentation text flag should only be set after 'doc text' field is provided. Please provide the documentation text and set the flag to '?' again.

Comment 3 Rik Theys 2020-09-18 10:35:42 UTC
(In reply to Martin Perina from comment #1)
> Are you sure that you have finished upgrading oVirt 4.4.2 properly according
> to upgrade guide?
> 
> https://www.ovirt.org/documentation/upgrade_guide/
> #Updating_the_Red_Hat_Virtualization_Manager_minor_updates
> 
> Have you executed 'yum update' after engine-setup to finish upgrading non
> oVirt packages? 
> In this particular case could you please check that you are using
> ansible-runner-service-1.0.5?

Yes, I'm running ansible-runner-service-1.0.5

This update was installed on 2020-07-29 already, where I upgraded the engine to 4.4.2 yesterday

I see that the chcon is run from the postinst of that package. It does however not seem to add it as an exception to the policy, so any restorecon runs will override the change again. It's not listed in the 'semanage fcontext --list -C' output.
That output does include some other exceptions however.


Regards,
Rik

Comment 4 Morten Stevens 2020-09-19 16:18:43 UTC
I'm able to reproduce this. I think this is a very critical issue, because it is not possible to add new hosts to a 4.4.2 cluster with selinux enabled.

type=AVC msg=audit(1600526662.121:136): avc:  denied  { open } for  pid=1548 comm="httpd" path="/var/log/ovirt-engine/ansible-runner-service.log" dev="dm-0" ino=36140918 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=0

Workaround:

1) Turn selinux off: setenforce 0
2) Add new hosts to the engine / check for updates
3) Turn selinux on: setenforce 1

Comment 5 Rik Theys 2020-09-19 19:46:09 UTC
Hi Morton,

(In reply to Morten Stevens from comment #4)
> I'm able to reproduce this. I think this is a very critical issue, because
> it is not possible to add new hosts to a 4.4.2 cluster with selinux enabled.
> 
> type=AVC msg=audit(1600526662.121:136): avc:  denied  { open } for  pid=1548
> comm="httpd" path="/var/log/ovirt-engine/ansible-runner-service.log"
> dev="dm-0" ino=36140918 scontext=system_u:system_r:httpd_t:s0
> tcontext=system_u:object_r:var_log_t:s0 tclass=file permissive=0
> 
> Workaround:
> 
> 1) Turn selinux off: setenforce 0
> 2) Add new hosts to the engine / check for updates
> 3) Turn selinux on: setenforce 1

A better workaround is to manually relabel the file (as the postinst of ansible-runner-service does):

chcon -t httpd_log_t /var/log/ovirt-engine/ansible-runner-service.log

Regards,
Rik

Comment 7 Petr Matyáš 2020-10-13 11:45:31 UTC
Verified with ansible-runner-service-1.0.6-2.el8ev.noarch

Comment 8 Peter Larsen 2020-10-21 15:06:53 UTC
Since the error message in 4.4.2 refers to the file that cannot be written to, a different error message should be returned to the user in case ansible cannot launch?

Comment 9 Sandro Bonazzola 2020-11-11 06:42:12 UTC
This bugzilla is included in oVirt 4.4.3 release, published on November 10th 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.3 release, it has been closed with a resolution of CURRENT RELEASE.

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


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