CDIST-TYPE__SSH_AUTHORIZED_KEYS(7)
π CDIST-TYPE__SSH_AUTHORIZED_KEYS(7) π
okay so bestie, welcome to cdist-type__ssh_authorized_keys, part of the cdist fam, version 7.0.0. this is the page for the type that manages ssh authorized_keys files. yes, THE files. the ones that decide who gets in. very main character, honestly. ποΈβ¨
πΈ NAME πΈ
cdist-type__ssh_authorized_keys β manages ssh authorized_keys files
no cap, that's literally it. it's giving gatekeeper (affectionate). πͺπ
β¨ DESCRIPTION β¨
So what it does: it adds or removes ssh keys from an authorized_keys file. that's the whole gig. adding keys = letting people in. removing keys = bye bestie π
Here's the tea about the plumbing tho:
- This type uses the
__ssh_dot_sshtype to manage the directory that holds theauthorized_keysfile. cute, right? it's reusing its friend's work. you can disable that feature with the--noparentboolean parameter if you wanna do it yourself. - The existence, ownership and permissions of the
authorized_keysfile itself are also managed. very thorough. very organized. we love a type that handles its own business. π - You can turn that off with the
--nofileboolean parameter. but then β and I need you to hear me β it's left to the user to make sure the file exists and that ownership and permissions actually work withssh. that's on you. not us. good luck babe π«Ά
π REQUIRED MULTIPLE PARAMETERS π
okay so this one is required AND you can give it multiple times. double threat. iconic.
keyβ ansshkey which shall be managed in thisauthorized_keysfile. Must be a string containing the ssh keytype, base 64 encoded key and optional trailing comment which shall be added to the givenauthorized_keysfile. Can be specified multiple times. fr fr, one--keyper key, stack 'em up π§
π OPTIONAL PARAMETERS π
the optional girlies. use them or don't, no pressure (there is a little pressure).
commentβ use this comment instead of the one which may be trailing in eachkey. so if your key's built-in comment is ugly, override it. glow-up achieved β¨fileβ an alternative destination file. defaults to~$owner/.ssh/authorized_keys. you wanna put it somewhere weird? go off. πoptionβ an option to set for allauthorized_keyentries in thekeyparameter. Can be specified multiple times. Seesshd(8)for available options. (yes, ALL the keys. it's a package deal.) π¦ownerβ the user owning theauthorized_keysfile. defaults toobject_id.stateβ if the given keys should be'present'or'absent'. defaults to'present'. present = keep them, absent = ghost them π»
π BOOLEAN PARAMETERS π
flip them on, flip them off. binary babes.
noparentβ don't create or change ownership and permissions of the directory containing theauthorized_keysfile. hands off the folder, basically πnofileβ don't manage existence, ownership and permissions of the theauthorized_keysfile. (yes, the original says "the the". keeping it. it's part of the lore. π)remove-unknownβ remove undefined keys. this is the clean slate button. if it's not in your config, it's gone. ruthless. obsessed. π₯
β οΈ careful with --remove-unknown bestie, it removes undefined keys β anything you didn't explicitly declare gets deleted from the file. not a vibe check, it's a vibe yeet.
π EXAMPLES π
okay this is the fun part. real commands, real energy, copied exactly because we do NOT paraphrase commands in this house. π―
# add your ssh key to remote root's authorized_keys file
__ssh_authorized_keys root \
--key "$(cat ~/.ssh/id_rsa.pub)"
# same as above, but make sure your key is only key in
# root's authorized_keys file
__ssh_authorized_keys root \
--key "$(cat ~/.ssh/id_rsa.pub)" \
--remove-unknown
# allow key to login as user-name
__ssh_authorized_keys user-name \
--key "ssh-rsa AXYZAAB3NzaC1yc2..."
# allow key to login as user-name with options and expicit comment
__ssh_authorized_keys user-name \
--key "ssh-rsa AXYZAAB3NzaC1yc2..." \
--option no-agent-forwarding \
--option 'from="*.example.com"' \
--comment 'backup server'
# same as above, but with explicit owner and two keys
# note that the options are set for all given keys
__ssh_authorized_keys some-fancy-id \
--owner user-name \
--key "ssh-rsa AXYZAAB3NzaC1yc2..." \
--key "ssh-rsa AZXYAAB3NzaC1yc2..." \
--option no-agent-forwarding \
--option 'from="*.example.com"' \
--comment 'backup server'
# authorized_keys file in non standard location
__ssh_authorized_keys some-fancy-id \
--file /etc/ssh/keys/user-name/authorized_keys \
--owner user-name \
--key "ssh-rsa AXYZAAB3NzaC1yc2..."
# same as above, but directory and authorized_keys file is created elswhere
__ssh_authorized_keys some-fancy-id \
--file /etc/ssh/keys/user-name/authorized_keys \
--owner user-name \
--noparent \
--nofile \
--key "ssh-rsa AXYZAAB3NzaC1yc2..."
like. the last two? one manages everything for you, the other says "I got it from here." character development π¦
π SEE ALSO π
go read it if you want the full lore on option. iykyk. π
π AUTHORS π
- Steven Armstrong
<steven-cdist--@--armstrong.cc>
thank you steven, king behavior π«‘
π COPYING π
Copyright (C) 2012-2014 Steven Armstrong. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
(that's the legal bit, keep it, love it, don't lose it π)
π COPYRIGHT π
ungleich GmbH 2021
and that's the whole page bestie!! this one's from cdist 7.0.0, dated Jul 31 β signed, sealed, and absolutely slaying. go forth and manage those authorized_keys files. mwah π πβ¨π¦
π¦ where this page comes from
- fedora 43: cdist 7.0.0-16.fc43 Β· GPL-3.0-only
- fedora 44: cdist 7.0.0-18.fc44 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms