]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovs-ctl: fix system-id.conf owner
authorDavid Marchand <david.marchand@redhat.com>
Thu, 22 Nov 2018 15:37:57 +0000 (16:37 +0100)
committerBen Pfaff <blp@ovn.org>
Mon, 10 Dec 2018 21:02:55 +0000 (13:02 -0800)
As far as RPMs are concerned, system-id.conf file is declared as being
owned by openvswitch.
At the first ovs startup, ovs-ctl creates this file if none exists without
ensuring this.

We end up with an inconsistency:
$ rpm -V openvswitch
.....UG..  c /etc/openvswitch/system-id.conf

Fix this when ovs-ctl is the one who creates the file.

Note: this issue ends up being hidden after a RPM upgrade, since the
openvswitch user is enforced on the whole /etc/openvswitch directory as a
%post operation.

Acked-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
utilities/ovs-ctl.in
utilities/ovs-lib.in

index c92b270b9afd72118f1f5fc51a9316f52b0d6d00..9c2a092ea7331d3bf7d96b4ac28fe27c6a221715 100644 (file)
@@ -62,8 +62,10 @@ set_system_ids () {
                 # Migrate from old file name.
                 . "$uuid_file"
                 SYSTEM_ID=$INSTALLATION_UUID
+                run_as_ovsuser touch "$id_file"
                 echo "$SYSTEM_ID" > "$id_file"
             elif SYSTEM_ID=`uuidgen`; then
+                run_as_ovsuser touch "$id_file"
                 echo "$SYSTEM_ID" > "$id_file"
             else
                 log_failure_msg "missing uuidgen, could not generate system ID"
index 7df672c2c7bccb3ecd3d016c2dd22e173228560c..9a0af2e82ee12cbe606fc47146ada42dae57a691 100644 (file)
@@ -387,17 +387,21 @@ move_ip_routes () {
     done
 }
 
-ovsdb_tool () {
+run_as_ovsuser() {
     if [ "$OVS_USER" != "" ]; then
         local uid=$(id -u "${OVS_USER%:*}")
         local gid=$(id -g "${OVS_USER%:*}")
         local groups=$(id -G "${OVS_USER%:*}" | tr ' ' ',')
-        setpriv --reuid "$uid" --regid "$gid" --groups "$groups" ovsdb-tool -vconsole:off "$@"
+        setpriv --reuid "$uid" --regid "$gid" --groups "$groups" "$@"
     else
-        ovsdb-tool -vconsole:off "$@"
+        "$@"
     fi
 }
 
+ovsdb_tool () {
+    run_as_ovsuser ovsdb-tool -vconsole:off "$@"
+}
+
 create_db () {
     DB_FILE="$1"
     DB_SCHEMA="$2"