Bug 2113068 - RHV 4.4 SP1+ logrotate fails for ovn due to incorrect permissions of /var/log/ovn
Summary: RHV 4.4 SP1+ logrotate fails for ovn due to incorrect permissions of /var/lo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: openvswitch
Version: 4.5.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ovirt-4.5.2
: ---
Assignee: Ales Musil
QA Contact: Michael Burman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-01 20:55 UTC by Sean Haselden
Modified: 2022-10-12 10:02 UTC (History)
6 users (show)

Fixed In Version: ovirt-openvswitch-2.15-4.el8ev
Doc Type: Release Note
Doc Text:
With this release, permissions for the /var/log/ovn directory are updated correctly during the upgrade of OVS/OVN 2.11 to OVS 2.15/OVN 2021.
Clone Of:
Environment:
Last Closed: 2022-09-08 11:29:03 UTC
oVirt Team: Network
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github oVirt ovirt-openvswitch pull 10 0 None open Fix owner for log/lib directories 2022-08-02 08:05:08 UTC
Red Hat Issue Tracker RHV-47782 0 None None None 2022-08-01 20:59:12 UTC
Red Hat Product Errata RHBA-2022:6394 0 None None None 2022-09-08 11:29:13 UTC

Description Sean Haselden 2022-08-01 20:55:22 UTC
Description of problem:

Logrotate of /etc/logrotate.d/ovn fails with: 
error: failed to rename /var/log/ovn/ovn-controller.log to /var/log/ovn/ovn-controller.log-20220801: Permission denied

Permissions of /var/log/ovn are set to root:root: 
ls -la /var/log/ | grep ovn
drwxr-xr-x.  2 root        root            32 Jun 22 17:54 ovn

We can see that the installation of the ovn rpm modifies the /etc/logrotate.d/ovn file to first su to openvswitch:openvswitch before attempting to rotate: 

[root@rhevh-25 log]# rpm -qi --scripts ovn-2021-21.12.0-46.el8fdp.x86_64
postinstall scriptlet (using /bin/sh):
if [ $1 -eq 1 ]; then
    sed -i 's:^#OVN_USER_ID=:OVN_USER_ID=:' /etc/sysconfig/ovn
    sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' /etc/logrotate.d/ovn
fi
postuninstall program: /bin/sh


This causes a permissions mismatch because the directory is owned by root:root and doesn't have write permissions.







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


How reproducible:

We have a lab system showing this issue with: 
redhat-release-virtualization-host-4.5.0-5.el8ev.x86_64 with:
ovn-2021-host-21.12.0-46.el8fdp.x86_64
ovn-2021-21.12.0-46.el8fdp.x86_64


Customer environment: 
redhat-release-virtualization-host-4.5.1-1.el8ev.x86_64 with: 
ovn-2021-21.12.0-73.el8fdp.x86_64                           
ovn-2021-host-21.12.0-73.el8fdp.x86_64                     



Steps to Reproduce:
1. /usr/sbin/logrotate  /etc/logrotate.conf --force > /tmp/rotate 2>&1
2. Check /tmp/rotate for error 
3.

Actual results:
error: failed to rename /var/log/ovn/ovn-controller.log to /var/log/ovn/ovn-controller.log-20220801: Permission denied
/var/log/ovn/ovn-controller.log cannot be rotated 


Expected results:
/var/log/ovn/ovn-controller.log should be rotated 

Additional info:

On a lab system we see this process running with the --log-file argument to /var/log/ovn:
openvsw+    1695       1  0 Jun22 ?        00:01:45 ovn-controller unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --private-key=/etc/pki/vdsm/keys/vdsmkey.pem --certificate=/etc/pki/vdsm/certs/vdsmcert.pem --ca-cert=/etc/pki/vdsm/certs/cacert.pem --user openvswitch:openvswitch --no-chdir --log-file=/var/log/ovn/ovn-controller.log --pidfile=/run/ovn/ovn-controller.pid --detach

Suspect the /var/log/ovn directory isn't being created properly with openvswitch:openvswitch 


In our customers case, they ran chown openvswitch:root /var/log/ovn and this allowed the file to be rotated.

Comment 5 Michael Burman 2022-08-07 16:25:18 UTC
Verified on - ovirt-openvswitch-2.15-4.el8ev.noarch 

Upgraded from:
rhvm-4.4.10.7-0.4.el8ev.noarch
ovirt-openvswitch-2.11-1.el8ev.noarch
vdsm-4.40.100.2-1.el8ev.x86_64

To:
rhvm-4.5.2.1-0.1.el8ev.noarch
ovirt-openvswitch-2.15-4.el8ev.noarch
vdsm-4.50.2.2-1.el8ev.x86_64

After upgrade, the permissions has been fixed:
ls -la /var/log/ | grep ovn
drwxr-xr-x.  2 openvswitch openvswitch     32 Aug  7 19:08 ovn

rpm -q ovirt-openvswitch
ovirt-openvswitch-2.15-4.el8ev.noarch

Comment 7 Casper (RHV QE bot) 2022-09-06 11:30:53 UTC
This bug has low overall severity and is not going to be further verified by QE. If you believe special care is required, feel free to properly align relevant severity, flags and keywords to raise PM_Score or use one of the Bumps ('PrioBumpField', 'PrioBumpGSS', 'PrioBumpPM', 'PrioBumpQA') in Keywords to raise it's PM_Score above verification threashold (1000).

Comment 10 errata-xmlrpc 2022-09-08 11:29:03 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 (RHV Engine and Host Common Packages 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-2022:6394


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