Repository navigation
fix(windows): enforce SSH access policy during node provisioning - #9710
Open
Thibault Cohen (titilambert) wants to merge 10 commits into
Open
Thibault Cohen (titilambert) wants to merge 10 commits into
Thibault Cohen (titilambert) wants to merge 10 commits into
Conversation
Contributor
Author
|
This change is part of the following stack: Change managed by git-spice. |
Contributor
Windows Unit Test Results 3 files 19 suites 1m 17s ⏱️ Results for commit f9b40b9. ♻️ This comment has been updated with latest results. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Existing bake-time administrator keys remain authorized because the installation helper appends live keys without replacing stale ones.
Review effort: Balanced
Findings: 1
What changed in this PR
Moves Windows SSH policy enforcement into NodePrep for PIS compatibility.
Changes:
- Enables, disables, or installs OpenSSH based on live policy.
- Adds Pester coverage for SSH behavior and phase placement.
- Embeds enforcement through the CustomData helper.
| File | Description |
|---|---|
parts/windows/windowscsehelper.ps1 |
Adds SSH policy enforcement. |
parts/windows/windowscsehelper.tests.ps1 |
Tests enforcement and failures. |
parts/windows/kuberneteswindowssetup.ps1.template |
Moves SSH handling to NodePrep. |
parts/windows/kuberneteswindowssetup.pisphases.tests.ps1 |
Verifies PIS phase placement. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 14, 2026 14:51
d6fb536 to
bb8c94d
Compare
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 14, 2026 20:37
bb8c94d to
db61c18
Compare
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 15, 2026 02:44
db61c18 to
2f62a5d
Compare
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 19, 2026 13:14
2f62a5d to
e9ba571
Compare
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 21, 2026 16:40
35536a0 to
05fc0af
Compare
Apply SSH policy in NodePrep for both standard and PIS-cached nodes. Stop and disable sshd when SSH access is disabled, and allow previously disabled services to start when SSH is enabled. Keep the policy helper embedded in CustomData for compatibility with older CSE packages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the authorized keys file and its ACL while removing stale PIS keys. Cover repeated configuration and cleanup failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Limit RunCommand guest validation to Windows scenarios that skip SSH connectivity, and restore existing SSH startup ordering. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stop and disable sshd before replacing inherited authorized keys. Enable it only after key and ACL preparation succeeds, including on fresh installations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Thibault Cohen (titilambert)
force-pushed
the
fix-windows-enforce-ssh-access
branch
from
October 21, 2026 19:36
05fc0af to
f9b40b9
Compare
Contributor
Contributor
|
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What this PR does / why we need it:
When Windows SSH access is disabled, provisioning currently skips OpenSSH configuration without explicitly stopping or disabling an existing
sshdservice. On Windows Server 2025 images wheresshdis running after boot, SSH therefore remains active despite the requested policy.This change:
sshdwhen SSH access is disabled, without installing OpenSSH if it is absent.Install-OpenSSH. When enabling SSH, it keeps the service stopped and disabled while replacing inherited authorized keys and applying ACLs, then enables and starts it only after those steps succeed. Key/ACL preparation errors fail provisioning without reactivating the service.BasePrepwhen SSH is enabled.NodePrepreapplies the current policy and keys on every real node, including PIS-cached nodes that skipBasePrep; this does not depend on an SSH-only change triggering a rebake.Windows2025_DisableSSH, which checks thatsshdis stopped and its startup type isDisabled. SSH-enabled Windows bakes retain SSH validation; Windows scenarios that explicitly skip SSH connectivity use RunCommand for guest checks in both PIS stages. Linux behavior is unchanged.Validation:
go test ./pkg/agent -run '^TestWindowsCustomData' -count=1andgit diff --check.35536a0c92, GitHub Pester, Windows Unit Test Results, and Go unit-test checks have passed. Azure E2E runs and Windows VHD builds are still pending/in progress; end-to-end validation of this revision is not yet complete.Which issue(s) this PR fixes:
Fixes Windows SSH access remaining enabled when the requested SSH policy is disabled. No linked GitHub issue.