[release-4.18] OCPBUGS-86845: Apply password only if changes exist#6113
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 |
|
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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: openshift-cherrypick-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@openshift-cherrypick-robot: Jira Issue OCPBUGS-86650 has been cloned as Jira Issue OCPBUGS-86845. Will retitle bug to link to clone. 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. |
|
@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-86845, 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. |
|
@openshift-cherrypick-robot: 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. |
HarshwardhanPatil07
left a comment
There was a problem hiding this comment.
Pre-merge Verification: Passed
Clusterversion: 4.18.0-0-2026-06-03-054617-test-ci-ln-mkg3kpt-latest
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 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
- 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
- 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}"
- 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
|
/verified by @HarshwardhanPatil07 here |
|
@HarshwardhanPatil07: This PR has been marked as verified 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. |
|
/jira refresh |
|
@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
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. |
This is an automated cherry-pick of #6097
/assign pablintino