New cookbook: fb_ssh#58
Conversation
|
|
||
| module FB | ||
| class SSH | ||
| DESTDIR = { |
There was a problem hiding this comment.
I think these should probably be configurable (not everybody will have/want the same paths).
There was a problem hiding this comment.
I disagree... one of the things we've almost never done in fb cookbooks is make configuration paths configurable....
|
rebased and addressed review comments |
bb22af9 to
0356777
Compare
6402389 to
eea046d
Compare
|
Added windows support |
|
Hey there @jaymzh (and @davide125)! Apologies for resurrecting this PR, but I wanted to a) point out what I think is a bug I found, and b) ask if there was any chance this could get merged, as we'd like to use it! Regarding the bug, I believe that the current default of joining arrays by spaces does not work for the node.default['fb_ssh']['sshd_config'] = {
'HostKey' => [
'/etc/ssh/ssh_host_rsa_key',
'/etc/ssh/ssh_host_ecdsa_key',
'/etc/ssh/ssh_host_ed25519_key',
],
# ...
}Using this results in the following error: I'm not familiar with openssh's codebase, but I believe this is because the ...and here is how it parses If I understand correctly, it's only taking one argument at a time from the Finally, regarding merging, at Etsy we've been exploring using Facebook-style cookbooks for freshening up our Chef configuration, and found it really pleasant so far! We'd like to be able to customize our Thanks both! |
|
Hi @ericnorris - thanks for commenting. The delay on merging this is because FB has an internal fb_ssh cookbook, so it's a migration for them, and resources on that team are currently a bit limited. I'm happy to continue keeping this up-to-date in the PR though, and the Vicarious folks are already using it (I just left there, but I wrote it while I was there). FB will get to it, but it'll take some time. I'm hoping to update a bunch of my PRs that submit new cookbooks in the coming weeks now that I have a bit more time. The HostKey is an interesting one. I think there are only two config keys that require multi-define - |
|
Appreciate the fast response @jaymzh! Understood, we have a mechanism for pulling in your fork for a given cookbook (e.g. this and Also appreciate you offering to keep it up to date! I agree, Finally, I'd be curious to see if there's an |
|
If you'd like to contribute a cookbook to manage PAM, we should be able to merge it without issues. As @jaymzh mentioned, the main blocker to merging this one is refactoring our internal one and migrating off it. |
|
I don't think multi-defining works for anything else. For example So I don't think there's a format that works for everything, unfortunately. |
|
I'm gonna get this updated here. I have a solution for the non-space-delimited things, but there's some systemd new stuff that's required to get in here... should have an update today or tomorrow. |
858bb6c to
2b91160
Compare
|
OK this update properly handles special non-space-delimited keys as well as handles config files that are included from packages. @ericnorris - would love any feedback or testing. |
c4e1347 to
f1021a8
Compare
This is a cookbook to manage SSH using the FB attribute-driven model. It handles daemon and client configs as well as authorized_keys and authorized_principals. There are few things worth noting here: The API for public keys uses a `data_bag`. Grocery delivery and taste-tester have long supported data_bags even though FB doesn't use them in prod... but it doesn't matter since FB uses principals in prod and not keys, so this shouldn't be an issue no matter what.
On Ubuntu 24.04, openssh 9.6p1 checks for the privilege separation directory /run/sshd even in config-test (-t) mode. When the openssh packages are upgraded during a Chef run, dpkg post-install scripts restart sshd asynchronously via deb-systemd-invoke (bypassing policy-rc.d), causing systemd to briefly remove /run/sshd (a RuntimeDirectory) during the stop phase. By the time Chef has run through the preceding resources (ruby_block, confdir directory, key file resources), the stop phase has already completed. Adding a directory resource here recreates /run/sshd so the sshd_config template verify succeeds. See: facebook#58 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This is a cookbook to manage SSH using the FB attribute-driven model.
It handles daemon and client configs as well as authorized_keys and
authorized_principals.
There is something worth noting here: the API for public keys uses a
data_bag.Grocery delivery and taste-tester have long supported data_bags even though
FB doesn't use them in prod... but it doesn't matter since FB uses principals in prod
and not keys, so this shouldn't be an issue no matter what.
Here are all the steps to do, internally, to be able to import this.
node.default['fb_ssh']...to also have anode.default['fb_ssh_old']...fb_sshtofb_ssh_oldinclude_recipes to referencefb_ssh_oldfb_sshfb_sshfb_ssh