Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.9] Bug 2098099: configure-ovs: clone connection to avoid selinux problems #3188

Merged
merged 1 commit into from Jun 22, 2022

Conversation

jcaamano
Copy link
Contributor

On older releases, /etc/NetworkManager/systemConnectionsMerged is not
correctly registered in selinux as a location for NM to manage its
connection profiles. So instead of copying files there and restorecon,
rely always on nmcli clone to copy a connection and let that handle selinux
attributes.

Signed-off-by: Jaime Caamaño Ruiz jcaamano@redhat.com

- What I did

- How to verify it

- Description for the changelog

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 14, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2022

@jcaamano: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

In response to this:

configure-ovs: clone connection to avoid selinux problems

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 14, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jcaamano
Copy link
Contributor Author

/test 4.9-upgrade-from-stable-4.8-e2e-aws-ovn-upgrade
/test e2e-aws-ovn-workers-rhel8
/test e2e-metal-ipi-ovn-dualstack
/test e2e-metal-ipi-ovn-ipv6
/test e2e-ovn-step-registry

@rbbratta
Copy link
Contributor

Seems to work with static IP.

-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  292 Jun 14 14:40 /etc/NetworkManager/system-connections/br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  292 Jun 14 14:40 /etc/NetworkManager/systemConnectionsMerged/br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_var_run_t:s0 527 Jun 14 21:33 /etc/NetworkManager/systemConnectionsMerged/ovs-if-br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_var_run_t:s0 324 Jun 14 21:33 /etc/NetworkManager/systemConnectionsMerged/ovs-if-phys0.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  186 Jun 14 14:40 /etc/NetworkManager/systemConnectionsMerged/ovs-port-br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  187 Jun 14 14:40 /etc/NetworkManager/systemConnectionsMerged/ovs-port-phys0.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  527 Jun 14 21:33 /etc/NetworkManager/system-connections/ovs-if-br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  324 Jun 14 21:33 /etc/NetworkManager/system-connections/ovs-if-phys0.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  186 Jun 14 14:40 /etc/NetworkManager/system-connections/ovs-port-br-ex.nmconnection
-rw-------. 1 root root system_u:object_r:NetworkManager_etc_rw_t:s0  187 Jun 14 14:40 /etc/NetworkManager/system-connections/ovs-port-phys0.nmconnection
303-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + break
304-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + '[' 0 -eq 0 ']'
305-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + echo 'Brought up connection ovs-if-br-ex successfully'
306-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: Brought up connection ovs-if-br-ex successfully
307:Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + nmcli c mod ovs-if-br-ex connection.autoconnect yes
308-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + '[' -f /etc/ovnk/extra_bridge ']'
309-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + persist_nm_conn_files
310-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + update_nm_conn_files br-ex phys0
311-Jun 14 14:40:56 compute-1 configure-ovs.sh[1336]: + bridge_name=br-ex
--
599-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + local active_state=activated
600-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + '[' activated '!=' activated ']'
601-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + echo 'Connection ovs-if-br-ex already activated'
602-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: Connection ovs-if-br-ex already activated
603:Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + nmcli c mod ovs-if-br-ex connection.autoconnect yes
604-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + '[' -f /etc/ovnk/extra_bridge ']'
605-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + persist_nm_conn_files
606-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + update_nm_conn_files br-ex phys0
607-Jun 14 21:33:45 compute-1 configure-ovs.sh[1563]: + bridge_name=br-ex

/etc/NetworkManager/systemConnectionsMerged is not correctly registered
in selinux as a location for NM to manage its connection profiles so
attempting to update a profile through NM after manually copying and
doing a restorecon from that location fails. So instead of copying files
there and restorecon manuall, rely on `nmcli clone` to copy a connection
and let that handle selinux attributes.

Signed-off-by: Jaime Caamaño Ruiz <jcaamano@redhat.com>
@jcaamano
Copy link
Contributor Author

Only updated comments and commit message.

@jcaamano jcaamano changed the title configure-ovs: clone connection to avoid selinux problems Bug 2089763: configure-ovs: clone connection to avoid selinux problems Jun 15, 2022
@jcaamano jcaamano marked this pull request as ready for review June 15, 2022 14:13
@openshift-ci openshift-ci bot added bugzilla/severity-urgent Referenced Bugzilla bug's severity is urgent for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 15, 2022
@jcaamano
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2022

@jcaamano: This pull request references Bugzilla bug 2089763, which is invalid:

  • expected the bug to be in one of the following states: NEW, ASSIGNED, ON_DEV, POST, POST, but it is ON_QA instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 2089763: configure-ovs: clone connection to avoid selinux problems

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2022

@jcaamano: This pull request references Bugzilla bug 2089763, which is invalid:

  • expected the bug to be in one of the following states: NEW, ASSIGNED, ON_DEV, POST, POST, but it is ON_QA instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested a review from sinnykumari June 15, 2022 14:15
@jcaamano jcaamano changed the title Bug 2089763: configure-ovs: clone connection to avoid selinux problems [release-4.9] Bug 2089763: configure-ovs: clone connection to avoid selinux problems Jun 15, 2022
@jcaamano
Copy link
Contributor Author

/test 4.9-upgrade-from-stable-4.8-e2e-aws-ovn-upgrade
/test e2e-aws-ovn-workers-rhel8
/test e2e-metal-ipi-ovn-dualstack
/test e2e-metal-ipi-ovn-ipv6
/test e2e-ovn-step-registry

@jcaamano
Copy link
Contributor Author

/test e2e-aws-ovn-workers-rhel8
/test e2e-metal-ipi-ovn-dualstack
/test e2e-metal-ipi-ovn-ipv6

@rbbratta
Copy link
Contributor

/bugzilla refresh

@openshift-ci openshift-ci bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 16, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 16, 2022

@rbbratta: This pull request references Bugzilla bug 2089763, which is valid.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.z) matches configured target release for branch (4.9.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
  • dependent bug Bugzilla bug 2089757 is in the state CLOSED (ERRATA), which is one of the valid states (VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE))
  • dependent Bugzilla bug 2089757 targets the "4.10.z" release, which is one of the valid target releases: 4.10.0, 4.10.z
  • bug has dependents

Requesting review from QA contact:
/cc @rbbratta

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested a review from rbbratta June 16, 2022 16:39
@rbbratta
Copy link
Contributor

/label cherry-pick-approved

@openshift-ci openshift-ci bot added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Jun 16, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2022

@jcaamano: This pull request references Bugzilla bug 2095264, which is invalid:

  • expected Bugzilla bug 2095264 to depend on a bug targeting a release in 4.10.0, 4.10.z and in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE), but no dependents were found

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jcaamano jcaamano changed the title [release-4.9] Bug 2095264: configure-ovs: clone connection to avoid selinux problems [release-4.9] Bug 2098099: configure-ovs: clone connection to avoid selinux problems Jun 17, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2022

@jcaamano: This pull request references Bugzilla bug 2098099, which is invalid:

  • expected dependent Bugzilla bug 2098097 to be in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE), but it is NEW instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

[release-4.9] Bug 2098099: configure-ovs: clone connection to avoid selinux problems

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jcaamano
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2022

@jcaamano: This pull request references Bugzilla bug 2098099, which is invalid:

  • expected dependent Bugzilla bug 2098097 to be in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE), but it is NEW instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jcaamano
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2022

@jcaamano: This pull request references Bugzilla bug 2098099, which is invalid:

  • expected dependent Bugzilla bug 2098097 to be in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE), but it is NEW instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kikisdeliveryservice
Copy link
Contributor

Did this get a backport into 4.10 yet? I don't see a pr attached to that BZ (which is blocking this 4.9 BZ): https://bugzilla.redhat.com/show_bug.cgi?id=2098097

@jcaamano
Copy link
Contributor Author

Did this get a backport into 4.10 yet? I don't see a pr attached to that BZ (which is blocking this 4.9 BZ): https://bugzilla.redhat.com/show_bug.cgi?id=2098097

We don't require code changes in 4.10 or 4.11 as we don't have the problem there.

@jcaamano
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci openshift-ci bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 17, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 17, 2022

@jcaamano: This pull request references Bugzilla bug 2098099, which is valid.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.z) matches configured target release for branch (4.9.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
  • dependent bug Bugzilla bug 2098097 is in the state VERIFIED, which is one of the valid states (VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), CLOSED (CURRENTRELEASE))
  • dependent Bugzilla bug 2098097 targets the "4.10.z" release, which is one of the valid target releases: 4.10.0, 4.10.z
  • bug has dependents

Requesting review from QA contact:
/cc @anuragthehatter

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

# NM selinux attributes vs using restorecon on systemConnectionsMerged
nmcli conn clone "${old_conn}" "${ovs_interface}"
shopt -s nullglob
new_conn_files=(${NM_CONN_PATH}/"${ovs_interface}"*)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to use an array here of files, cant you just set a new_conn_file var and onl in 242 use your ! -f check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doing the same that we were doing when we cloned old_conn with old_conn_files before, as it is the same problem.
I guess this is done to avoid assuming the precise file name, nmconnection vs no nmconnection. It could be done different but I took what was already there.

# modify file to work with OVS and have unique settings
sed -i '/^\[connection\]$/,/^\[/ s/^uuid=.*$/uuid='"$br_iface_uuid"'/' ${new_conn_file}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this? My guess is because cloning automatically provides a new uuid? But we cloned in the old code, so this must have been here for a reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we did not always clone, first there was the copy attempt with which we would end up with the same uuid.
But now we always clone, so always get a fresh uuid.

sed -i '/^multi-connect=.*$/d' ${new_conn_file}
sed -i '/^autoconnect=.*$/d' ${new_conn_file}
sed -i '/^\[connection\]$/a autoconnect=false' ${new_conn_file}
sed -i '/^\[connection\]$/,/^\[/ s/^type=.*$/type=ovs-interface/' ${new_conn_file}
sed -i '/^\[connection\]$/,/^\[/ s/^id=.*$/id='"$ovs_interface"'/' ${new_conn_file}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nmcli conn clone "${old_conn}" "${ovs_interface}" already produces a connection with id="${ovs_interface}"

@vfreex
Copy link

vfreex commented Jun 22, 2022

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2022

@jcaamano: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-disruptive 68668e0 link false /test e2e-aws-disruptive
ci/prow/e2e-aws-ovn-workers-rhel8 68668e0 link false /test e2e-aws-ovn-workers-rhel8
ci/prow/e2e-aws-workers-rhel8 68668e0 link false /test e2e-aws-workers-rhel8
ci/prow/okd-e2e-upgrade 68668e0 link false /test okd-e2e-upgrade
ci/prow/okd-e2e-gcp-op 68668e0 link false /test okd-e2e-gcp-op
ci/prow/e2e-aws-upgrade-single-node 68668e0 link false /test e2e-aws-upgrade-single-node
ci/prow/okd-e2e-aws 68668e0 link false /test okd-e2e-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@trozet
Copy link
Contributor

trozet commented Jun 22, 2022

/lgtm

@jcaamano
Copy link
Contributor Author

Back-port risk assessment does not make sense on this PR as it is not a back-port and the problem is specific to the 4.9 release.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 22, 2022
@yuqi-zhang
Copy link
Contributor

/approve
/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Jun 22, 2022
Copy link
Contributor

@sinnykumari sinnykumari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since basic MCO tests are green and networking team has reviewed the PR
/label backport-risk-assessed

@sinnykumari
Copy link
Contributor

You were quick Jerry! 😆

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcaamano, sinnykumari, trozet, yuqi-zhang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [sinnykumari,yuqi-zhang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 22, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcaamano, sinnykumari, trozet, yuqi-zhang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [sinnykumari,yuqi-zhang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot merged commit 8a66d29 into openshift:release-4.9 Jun 22, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2022

@jcaamano: All pull requests linked via external trackers have merged:

Bugzilla bug 2098099 has been moved to the MODIFIED state.

In response to this:

[release-4.9] Bug 2098099: configure-ovs: clone connection to avoid selinux problems

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. bugzilla/severity-urgent Referenced Bugzilla bug's severity is urgent for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants