Repository navigation
fix: restore saved SSH public-key authentication policy - #10053
Open
Abigail Liang (abigailliang-aks-sig-node) wants to merge 4 commits into
Open
Abigail Liang (abigailliang-aks-sig-node) wants to merge 4 commits into
Abigail Liang (abigailliang-aks-sig-node) wants to merge 4 commits into
Conversation
Save and restore the effective global public-key authentication setting across Entra and LocalUser transitions. Validate and install authentication configuration before activating SSH. Keep LocalUser activation limited to an owned disable marker, and never start an otherwise inactive service solely to reload its authentication setting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c815829b-19d2-4af1-8269-5d704d14325c
Abigail Liang (abigailliang-aks-sig-node)
requested review from
a team
as code owners
November 11, 2026 01:07
Contributor
Windows Unit Test Results 3 files 21 suites 1m 17s ⏱️ Results for commit 7eb60cf. ♻️ This comment has been updated with latest results. |
Abigail Liang (abigailliang-aks-sig-node)
added this pull request to stack #10054
November 11, 2026 01:10
Normalize only sshd -T field names when saving and validating the public-key policy. Exercise lowercase, mixed-case, and uppercase output through the authentication restore flow. Target Linux VHD output casing remains unconfirmed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c815829b-19d2-4af1-8269-5d704d14325c
Sync the narrowed SSH lifecycle base without rewriting existing commits. Preserve the verified authentication and historical-state compatibility snapshot in this layer, so legacy activation inference remains part of the follow-up diff rather than the core PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c815829b-19d2-4af1-8269-5d704d14325c
Copilot started reviewing on behalf of
Abigail Liang (abigailliang-aks-sig-node)
November 11, 2026 01:33
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The SSH configuration round trip can silently enable public-key authentication for restricted users, and the LocalUser reload path can restart an administratively stopped SSH service.
2 open issues
What changed in this PR
This follow-up to #10021 adds SSH public-key authentication policy restoration to Linux node provisioning, alongside the persistent SSH-disable lifecycle handling.
Changes:
- Save the effective global authentication setting before Entra disables it, then restore it for LocalUser.
- Validate and install authentication configuration before service activation, retaining backups when reconciliation fails.
- Extend ShellSpec coverage for restoration, activation ownership, external masks, and validation failures.
| File | Description |
|---|---|
spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh |
Adds authentication restoration and failure-path tests; updates legacy recovery expectations. |
parts/linux/cloud-init/artifacts/cse_config.sh |
Adds policy backup/restoration, effective-policy validation, and separate activation handling. |
Review effort: Balanced
| awk -v desired="no" ' | ||
| awk -v desired="$desired" ' | ||
| BEGIN { in_match=0; replaced=0; inserted=0 } | ||
| /^Match([[:space:]]|$)/ { |
| return 0 | ||
| fi | ||
| fi | ||
| systemctl reload-or-restart "$ssh_service" |
Retain the legacy activation and authentication extension, reuse the shared systemd fixture, and inherit backing-service validation and the cached-node dispatch guard. Adapt inherited helper tests to the explicitly broader legacy contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c815829b-19d2-4af1-8269-5d704d14325c
Copilot started reviewing on behalf of
Abigail Liang (abigailliang-aks-sig-node)
November 11, 2026 02:12
Abigail Liang (abigailliang-aks-sig-node)
removed this pull request from stack #10054
November 11, 2026 02:13
Abigail Liang (abigailliang-aks-sig-node)
added this pull request to stack #10057
November 11, 2026 02:14
Contributor
Contributor
| yes|no) ;; | ||
| *) echo "Cannot determine the original SSH public-key policy" >&2; exit "$ERR_CONFIG_PUBKEY_AUTH_SSH" ;; | ||
| esac | ||
| printf '%s\n' "$original" > "$policy_dir/pubkey-auth" || exit "$ERR_CONFIG_PUBKEY_AUTH_SSH" |
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:
Follow-up to #10021. This PR targets its branch so the diff contains only the authentication and legacy-recovery extension, not the preparation layers or persistent-disable production wiring.
PubkeyAuthenticationvalue before Entra disables it, and restore the savedyes/novalue when returning to LocalUser. PreserveMatchsections.sshd -Tfield names, before installing and starting/reloading SSH.The stricter owned-record-only restore contract belongs to #10056/#10021. This broader legacy behavior needs its own review here and is not required to land those lower layers.
Which issue(s) this PR fixes:
None linked. Depends on #10021.
Validation:
git diff --checkpass. The inherited cse_main has two unchanged SC3014 warnings in unrelated API-server checks.