ssh_server_key_api(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

✨ ssh_server_key_api ✨

okay bestie, so this one's a manual page from the Erlang crew β€” it's ssh_server_key_api, and yeah, it's that kind of page, the Erlang Module Definition kind. don't panic, it's actually short and adorable. let's get into it πŸ’…


🌸 NAME 🌸

ssh_server_key_api - -behaviour(ssh_server_key_api).

periodt. that's the whole flex. it's a behaviour. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

so, lowkey the whole vibe here is that this is a behaviour β€” and it describes the API for public key handling of an SSH server. like, it's the blueprint, the little contract, the main character moment for how your server deals with keys. πŸ”‘

and here's the slay: by implementing the callbacks defined in this behaviour, the public key handling of an SSH server can be customized. yes, you get to do that. go off. πŸ‘‘

but ngl, if you just want the default? by default the SSH application implements this behaviour with help of the standard OpenSSH files β€” see the ssh application manual for the deets. ✨


πŸŽ€ DATA TYPES πŸŽ€

no cap, there's exactly one, and she's a little nested-looking one:

daemon_key_cb_options(T) ::
          [{key_cb_private, [T]} | ssh:daemon_option()].

what even is this? it's the options provided to ssh:daemon/2,3. 🫢

also important, don't skip this: the option list you gave in the key_cb option is available with the key key_cb_private. iykyk β€” that's how you reach in and grab your own stuff back. πŸ’œ


🧚 CALLBACKS 🧚

okay these are the two little functions your implementation has to bring to the group chat. πŸ‘―

⭐ host_key(Algorithm, DaemonOptions)

fetches the private key of the host. that's it. that's the job. no notes. 🌈

⭐ is_auth_key(PublicKey, User, DaemonOptions)

checks if the user key is authorized. yes bestie, this is the bouncer at the door. πŸ’…


just a lil reminder boo: both of these are callbacks, so you're implementing them, not calling them yourself. the SSH server handles that part. πŸ™ˆ

aaaaand that's the whole page, you ate it. πŸ“πŸ’–

big kisses to Ericsson AB for this one β€” it ships with ssh 6.0.5, and yes it's ssh_server_key_api(3). drink some water, then go customize your key handling. πŸ¦‹βœ¨

πŸ“¦ where this page comes from