-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide how to handle user SSH keys #139
Comments
It's probably worth noting explicitly there's a patch already written for option 5 (nice work Luca!). But yeah...I think while the (Also worth noting the machine-config-operator for RHCOS today just rewrites |
For completeness, support for this in sshd was my preferred approach. The patch above was glued together to probe upstream stance on this, and reaction was not very warm. We can maybe try to propose/push for it again, but as it currently stands I'm not positive it will get in at anytime. |
maybe we can go for option 4 while we wait for option 5 ? |
Another option may be:
|
Yeah, I think my preference is option 4 pending option 5. Option 3 feels pretty clunky, and update-ssh-keys is a non-standard workflow step that seems good to eliminate. The implementation of option 4 seems scary from a security perspective, though. @dustymabe, I really like the
until the requisite code becomes available. |
ahh yes. hardcoding them (as I suggested) but sticking them in the This is another case where sshd config dropins would be useful. |
Are we ok with the solution in #139 (comment) as the short term solution and then planning for If yes, does this mean we don't need https://github.com/coreos/update-ssh-keys and we could modify coreos-metadata to not depend on it? |
@dustymabe I'm okay with that if update-ssh-keys could potentially be useful as a management tool (that no longer rewrote So the work items would be:
|
If
So it sounds like regardless of the option we pick we have eliminated options that include |
Yeah, I think so. Users will plausibly expect that they can add other files to the
👍 |
Using an |
In principle, our |
Ignition 2 and Afterburn no longer sync their authorized_keys.d fragment files to ~/.ssh/authorized_keys. Eventually we should have an AuthorizedKeysCommand that walks authorized_keys.d, but meanwhile we'd like the tools to still work. coreos/fedora-coreos-tracker#139
Note that regarding option 5 there has been a review on upstream openssh. |
Initial implementation of option 4 in coreos/ssh-key-dir#1. |
Merged in coreos/fedora-coreos-config#498. @lucab is still pursuing option 5 upstream, and we can switch over to that patch if it lands in sshd. |
The fix for this went into testing stream release |
Situation
On Container Linux, SSH keys are stored in
~/.ssh/authorized_keys.d
and then merged into the~/.ssh/authorized_keys
file that's read by sshd. Ignition writes SSH keys from the Ignition config into~/.ssh/authorized_keys.d/coreos-ignition
(coreos/ignition#710) and coreos-metadata writes keys from cloud provider metadata into~/.ssh/authorized_keys.d/coreos-metadata
. Afterward, each tool runs some code to update theauthorized_keys
file: Ignition has an implementation in Go, and coreos-metadata in Rust.There is also a standalone tool, update-ssh-keys, that ships with (and uses) the Rust library. It's the documented method for adding SSH keys on Container Linux. It has the following usage message:
It's worth noting that update-ssh-keys (and the Rust library) clobbers
authorized_keys
wheneverauthorized_keys.d
already exists. This makes naive key management tools deceptively unusable, since they'll appear to work but their changes might be reverted later.update-ssh-keys currently does not ship in Fedora CoreOS. This doesn't prevent users from modifying
authorized_keys
directly, butauthorized_keys.d
fragments from Ignition and coreos-metadata will remain around to confuse the user. Also, on platforms where[email protected]
runs on every boot (coreos/afterburn#138), coreos-metadata will clobber user changes toauthorized_keys
, leaving no straightforward way to modify the active keys on those platforms.Options
🡆 SSH key management will require using update-ssh-keys, unlike on other Fedora editions.
🡆 Without Ignition or coreos-metadata, update-ssh-keys won't be mandatory, but users can use it if they wish.
authorized_keys.d
concept. Modify Ignition and coreos-metadata to write toauthorized_keys
directly. That seems okay for Ignition, since it runs once from the initramfs. It's less great for coreos-metadata, which runs on every boot on some clouds and needs to replace keys fetched on a previous boot. It also could race with hypothetical services that modifyauthorized_keys
.🡆
authorized_keys
UX will be the same as on other distros. The implementation incoreos-metadata
will be awkward and racy. The convenience of the command-line tool will be lost unless it's updated for the single-file model and shipped in FCOS.AuthorizedKeysCommand
that concatenates the contents ofauthorized_keys.d
at runtime (and probably alsoauthorized_keys
for compatibility with other tools). sshd will run this as a single configured user; root is easiest, but the tool should probably be SELinux-confined. Delete code from Ignition and coreos-metadata that mergesauthorized_keys.d
intoauthorized_keys
. Document that distros using Ignition or coreos-metadata must use thisAuthorizedKeysCommand
.🡆 Adding keys will work as on other distros, with the addition of
authorized_keys.d
functionality. Finding/removing existing keys might be unintuitive, since a key not inauthorized_keys
might still be inauthorized_keys.d
. The convenience of the command-line tool will be lost unless it's updated and shipped in FCOS.AuthorizedKeysFile
.🡆 Same consequences as above.
The text was updated successfully, but these errors were encountered: