Skip to content

[release-4.18] OCPBUGS-86845: Apply password only if changes exist#6113

Open
openshift-cherrypick-robot wants to merge 2 commits into
openshift:release-4.18from
openshift-cherrypick-robot:cherry-pick-6097-to-release-4.18
Open

[release-4.18] OCPBUGS-86845: Apply password only if changes exist#6113
openshift-cherrypick-robot wants to merge 2 commits into
openshift:release-4.18from
openshift-cherrypick-robot:cherry-pick-6097-to-release-4.18

Conversation

@openshift-cherrypick-robot
Copy link
Copy Markdown

This is an automated cherry-pick of #6097

/assign pablintino

pablintino and others added 2 commits June 2, 2026 07:15
This bugfix ensures that the MCD only runs `usermod` if the password
hash has actually changed and not in every update. This aligns the
behavior we currently have for SSH passwords.

Signed-off-by: Pablo Rodriguez Nava <git@amail.pablintino.eu>
When usermod -P is used, the last password change field is changed. When
the MachineConfig is rolled back, this value remains the same even
though the actual password value has been changed back to its previous
value. Consequently, the E2E test should only compare the password hashes instead of the full line.

Assisted-By: Claude Opus 4.6
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 56c2a586-8ffa-4857-801f-f734089de24f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: openshift-cherrypick-robot
Once this PR has been reviewed and has the lgtm label, please assign cheesesashimi for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

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

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@openshift-cherrypick-robot: Jira Issue OCPBUGS-86650 has been cloned as Jira Issue OCPBUGS-86845. Will retitle bug to link to clone.
/retitle [release-4.18] OCPBUGS-86845: Apply password only if changes exist

Details

In response to this:

This is an automated cherry-pick of #6097

/assign pablintino

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot changed the title [release-4.18] OCPBUGS-86650: Apply password only if changes exist [release-4.18] OCPBUGS-86845: Apply password only if changes exist Jun 2, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 2, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-86845, which is invalid:

  • expected dependent Jira Issue OCPBUGS-86650 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is ON_QA instead

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

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This is an automated cherry-pick of #6097

/assign pablintino

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 2, 2026

@openshift-cherrypick-robot: all tests passed!

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07 HarshwardhanPatil07 left a comment

Choose a reason for hiding this comment

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

Pre-merge Verification: Passed

Clusterversion: 4.18.0-0-2026-06-03-054617-test-ci-ln-mkg3kpt-latest
Platform: AWS

Steps Performed:

  1. Applied the MC
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ cat <<EOF | oc apply -f -
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  name: 99-worker-core-password-test
  labels:
    machineconfiguration.openshift.io/role: worker
spec:
  config:
    ignition:
      version: 3.2.0
    passwd:
      users:
      - name: core
        passwordHash: "\$6\$rounds=4096\$saltsalt\$hashhash2"
EOF
machineconfig.machineconfiguration.openshift.io/99-worker-core-password-test created

  1. Wait for rollout and Check the Logs
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc logs -n openshift-machine-config-operator machine-config-daemon-x9vgd -c machine-config-daemon | grep -i pass
I0603 06:48:25.169707    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-310a6bd209435f325f2d1c1d886774fd: &{osUpdate:false kargs:false fips:false passwd:false files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:10:35.242169    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-6dbaa78b6de902fdb04694a31c936fa4: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.677834    2539 update.go:2922] "Starting update from rendered-worker-6dbaa78b6de902fdb04694a31c936fa4 to rendered-worker-63bed728c527fa973f5fc65e8f3c870f: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.968801    2539 update.go:2527] Password has been configured

  1. Update the password hash and Check Logs
      - name: core
        passwordHash: "\$6\$rounds=4096\$saltsalt\$differenthash3"
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc logs -n openshift-machine-config-operator machine-config-daemon-x9vgd -c machine-config-daemon | grep -i pass
I0603 06:48:25.169707    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-310a6bd209435f325f2d1c1d886774fd: &{osUpdate:false kargs:false fips:false passwd:false files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:10:35.242169    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-6dbaa78b6de902fdb04694a31c936fa4: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.677834    2539 update.go:2922] "Starting update from rendered-worker-6dbaa78b6de902fdb04694a31c936fa4 to rendered-worker-63bed728c527fa973f5fc65e8f3c870f: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.968801    2539 update.go:2527] Password has been configured
I0603 07:17:23.850119    2539 update.go:2922] "Starting update from rendered-worker-63bed728c527fa973f5fc65e8f3c870f to rendered-worker-2ab632b903601a0b40323f4fbf354e87: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:17:24.135711    2539 update.go:2527] Password has been configured

  1. Add SSH key only (password hash unchanged)
        passwordHash: "\$6\$rounds=4096\$saltsalt\$differenthash3"
        sshAuthorizedKeys:
          - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCnewkey123... test-ssh-key

harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc logs -n openshift-machine-config-operator machine-config-daemon-x9vgd -c machine-config-daemon | grep -i pass
I0603 06:48:25.169707    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-310a6bd209435f325f2d1c1d886774fd: &{osUpdate:false kargs:false fips:false passwd:false files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:10:35.242169    2539 update.go:2922] "Starting update from rendered-worker-310a6bd209435f325f2d1c1d886774fd to rendered-worker-6dbaa78b6de902fdb04694a31c936fa4: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.677834    2539 update.go:2922] "Starting update from rendered-worker-6dbaa78b6de902fdb04694a31c936fa4 to rendered-worker-63bed728c527fa973f5fc65e8f3c870f: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:13:38.968801    2539 update.go:2527] Password has been configured
I0603 07:17:23.850119    2539 update.go:2922] "Starting update from rendered-worker-63bed728c527fa973f5fc65e8f3c870f to rendered-worker-2ab632b903601a0b40323f4fbf354e87: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 07:17:24.135711    2539 update.go:2527] Password has been configured
I0603 07:23:05.298561    2539 update.go:2922] "Starting update from rendered-worker-2ab632b903601a0b40323f4fbf354e87 to rendered-worker-bf0a104e72fc09e397b3d6b74ce0a1fc: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"

  1. Delete the MC
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc delete mc 99-worker-core-password-test
machineconfig.machineconfiguration.openshift.io "99-worker-core-password-test" deleted

@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor

/verified by @HarshwardhanPatil07 here

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07: This PR has been marked as verified by @HarshwardhanPatil07 [here](https://github.com/openshift/machine-config-operator/pull/6113#pullrequestreview-4416392419).

Details

In response to this:

/verified by @HarshwardhanPatil07 here

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 openshift-eng/jira-lifecycle-plugin repository.

@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07: This pull request references Jira Issue OCPBUGS-86845, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.18.z) matches configured target version for branch (4.18.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note type set to "Release Note Not Required"
  • dependent bug Jira Issue OCPBUGS-86650 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-86650 targets the "4.19.0" version, which is one of the valid target versions: 4.19.0, 4.19.z
  • bug has dependents
Details

In response to this:

/jira 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 openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants