Skip to content

profile.bashrc: Fix SSH by not allowing *opts helper values to leak - #4338

Merged
chewi merged 2 commits into
mainfrom
chewi/mode-leak
Oct 26, 2026
Merged

chewi merged 2 commits into
mainfrom
chewi/mode-leak

Conversation

@chewi

@chewi chewi commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Don't allow *opts (e.g. insopts) or *into (e.g. insinto) helper values to leak between ebuilds and hook functions. They normally leak between ebuild phases, but leaking them to and from other scripts maintained by other people is hazardous. These default values come from Portage's phase-helpers.sh.

This issue broke the SSH client as a configuration file with bad permissions was unreadable.

Also tighten permissions on 50-flatcar-sshd.conf. The /etc/ssh/sshd_config.d directory is supposed to have mode 0700, so 50-flatcar-sshd.conf having 0644 would not normally matter. However, sshd_config.d's mode is effectively overridden to 0755 by the systemd package. This is ultimately a Portage/PMS issue.

How to use

Fire up the image and check that the SSH client works.

Testing done

So far, I've only locally tested this with emerge-amd64-usr, manually checking the permissions. I've kicked off a Jenkins build on another branch that includes these changes.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@chewi chewi self-assigned this Oct 26, 2026
@chewi
chewi requested a review from a team as a code owner October 26, 2026 16:43
Copilot AI balanced review requested due to automatic review settings October 26, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared hook change affects package builds broadly, and the reported validation does not yet include completed multi-architecture CI or image-level SSH checks.

No open issues 🎉

What changed in this PR

Fixes SSH client configuration permissions and isolates Portage install-option values between ebuilds and stacked hooks.

Changes:

  • Resets install-option defaults for each hook while preserving the caller’s values.
  • Explicitly sets SSH client configuration to 0644 and server configuration to 0600, and simplifies socket drop-in installation.
  • Adds an Alpha/Beta changelog entry for the SSH client fix.
File Description
sdk_container/​src/​third_party/​coreos-overlay/​profiles/​coreos/​base/​profile.bashrc Isolates install-option values for each stacked hook.
sdk_container/​src/​third_party/​coreos-overlay/​coreos/​config/​env/​net-misc/​openssh Sets explicit file permissions and simplifies socket configuration installation.
changelog/​bugfixes/​2026-10-26-ssh-perms.md Documents the Alpha/Beta SSH client fix.

Review effort: Balanced

@tormath1 tormath1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good that it has been noticed in Beta.

Comment thread changelog/bugfixes/2026-10-26-ssh-perms.md Outdated

@krnowak krnowak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing it, I appreciate it!

Comment thread sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc Outdated
Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Helper isolation affects hooks across all packages, and full-image SSH and permission validation remains pending.

No open issues 🎉

Review effort: Balanced

chewi added 2 commits October 26, 2026 17:15
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
The /etc/ssh/sshd_config.d directory is supposed to have mode 0700, so
50-flatcar-sshd.conf having 0644 would not normally matter. However,
sshd_config.d's mode is effectively overridden to 0755 by the systemd
package. This is ultimately a Portage/PMS issue.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared hook change affects package builds broadly, and full-image SSH behavior and cross-architecture validation remain unconfirmed.

No open issues 🎉

Review effort: Balanced

@chewi
chewi merged commit c561b0c into main Oct 26, 2026
3 of 4 checks passed
@chewi
chewi deleted the chewi/mode-leak branch October 26, 2026 22:17
@github-project-automation github-project-automation Bot moved this from ✅ Testing / in Review to Implemented in Flatcar tactical, release planning, and roadmap Oct 26, 2026

This branch is waiting to be deployed

1 waiting deployment
development — c8717d83 Waiting Oct 26, 2026 by chewi via Wait for approval #6029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants