[release-4.19] OCPBUGS-86650: Apply password only if changes exist#6097
Conversation
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
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
@pablintino: This pull request references Jira Issue OCPBUGS-83830, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@pablintino: This pull request references Jira Issue OCPBUGS-86650, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
/jira refresh |
|
@isabella-janssen: This pull request references Jira Issue OCPBUGS-86650, which is valid. The bug has been moved to the POST state. 7 validation(s) were run on this bug
DetailsIn response to this:
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. |
isabella-janssen
left a comment
There was a problem hiding this comment.
/label backport-risk-assessed
/lgtm
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: isabella-janssen, pablintino The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest-required |
|
/verify later @pablintino |
|
/verified later @pablintino |
|
@isabella-janssen: This PR has been marked to be verified later by DetailsIn response to this:
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. |
|
@pablintino: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
09ddec7
into
openshift:release-4.19
|
@pablintino: Jira Issue OCPBUGS-86650: All pull requests linked via external trackers have merged: This pull request has the DetailsIn response to this:
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. |
|
/cherry-pick release-4.18 |
|
@pablintino: new pull request created: #6113 DetailsIn response to this:
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. |
HarshwardhanPatil07
left a comment
There was a problem hiding this comment.
Post Merge Verification: Passed
Clusterversion: 4.19.0-0.nightly-2026-06-03-000446
Platform: AWS
Steps Performed:
- 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
- Wait for rollout and Check the Logs
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc get mcp
NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE
master rendered-master-f783fa9c086bc5314557cc597bc8d512 True False False 3 3 3 0 40m
worker rendered-worker-042169fd9c046a138afe87773c749037 True False False 3 3 3 0 40m
harshpat@harshpat-thinkpadp1gen4i:~/Downloads$ oc logs -n openshift-machine-config-operator machine-config-daemon-4fjmm -c machine-config-daemon | grep -i pass
I0603 05:16:12.409538 2588 update.go:2970] "Starting update from rendered-worker-6c7f5c19bb1befc62c4c8646b3c3f27c to rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.146853 2588 update.go:2970] "Starting update from rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19 to rendered-worker-042169fd9c046a138afe87773c749037: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.567308 2588 update.go:2546] Password has been configured
- 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-4fjmm -c machine-config-daemon | grep -i pass
I0603 05:16:12.409538 2588 update.go:2970] "Starting update from rendered-worker-6c7f5c19bb1befc62c4c8646b3c3f27c to rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.146853 2588 update.go:2970] "Starting update from rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19 to rendered-worker-042169fd9c046a138afe87773c749037: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.567308 2588 update.go:2546] Password has been configured
I0603 05:33:28.910128 2588 update.go:2970] "Starting update from rendered-worker-042169fd9c046a138afe87773c749037 to rendered-worker-08289bd9cdf7cc5cac91ea7fbc317bf7: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:33:29.339289 2588 update.go:2546] Password has been configured
- 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-4fjmm -c machine-config-daemon | grep -i pass
I0603 05:16:12.409538 2588 update.go:2970] "Starting update from rendered-worker-6c7f5c19bb1befc62c4c8646b3c3f27c to rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19: &{osUpdate:false kargs:false fips:false passwd:false files:true units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.146853 2588 update.go:2970] "Starting update from rendered-worker-caaa7bf5d4e59ce9f8f7ae97aa020b19 to rendered-worker-042169fd9c046a138afe87773c749037: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:28:15.567308 2588 update.go:2546] Password has been configured
I0603 05:33:28.910128 2588 update.go:2970] "Starting update from rendered-worker-042169fd9c046a138afe87773c749037 to rendered-worker-08289bd9cdf7cc5cac91ea7fbc317bf7: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
I0603 05:33:29.339289 2588 update.go:2546] Password has been configured
I0603 05:37:10.671565 2588 update.go:2970] "Starting update from rendered-worker-08289bd9cdf7cc5cac91ea7fbc317bf7 to rendered-worker-13c89b1d17c8ad92048e09168f87d6d9: &{osUpdate:false kargs:false fips:false passwd:true files:false units:false kernelType:false extensions:false oclEnabled:false revertFromOCL:false}"
- 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
Closes: #OCPBUGS-83830
This is a manual cherry-pick of #6068
- What I did
This change fixes the issue in SSH keys and user passwords that made the rollback useless as it tried to apply the new configuration instead of the previous one.
- How to verify it
TBD
- Description for the changelog
This change fixes the issue in SSH keys and user passwords that made the rollback useless as it tried to apply the new configuration instead of the previous one.