fix: set sshd_config permissions to 0600 for CIS compliance#8888
fix: set sshd_config permissions to 0600 for CIS compliance#8888pdamianov-dev wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a CIS compliance regression in the Linux CSE provisioning flow by ensuring /etc/ssh/sshd_config is replaced with restrictive permissions when configureSSHPubkeyAuth() updates the file, and adds ShellSpec coverage to prevent future regressions.
Changes:
- Update
configureSSHPubkeyAuth()to replace/etc/ssh/sshd_configwith mode0600(instead of0644) and root:root ownership. - Add ShellSpec assertions that guard the
install -mmode used when replacing$SSHD_CONFIG.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| parts/linux/cloud-init/artifacts/cse_config.sh | Changes the atomic replace of sshd_config to use install -m 600 for CIS 5.1.1 compliance. |
| spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh | Adds regression tests to ensure configureSSHPubkeyAuth() does not revert sshd_config to non-compliant permissions. |
AgentBaker Linux gate detectiveRun: 171759078 Likely cause/signature: Azure Compute Gallery / SIG image-version enumeration was throttled while looking up VHD images by �uildId=171759078. Evidence: build metadata, timeline, failed E2E log 538, test results, and repeated same-cycle failures on unrelated PRs. |
What this PR does / why we need it:
fix: set sshd_config permissions to 0600 for CIS compliance
Which issue(s) this PR fixes:
Fixes #8682