pallet.crate.ssh-key documentation

Crate functions for manipulating SSH-keys

authorize-key

fn

[user public-key-string & {:keys [authorize-for-user]}]

Authorize a public key on the specified user.

authorize-key-for-localhost

fn

[user public-key-filename & {:keys [authorize-for-user], :as options}]

Authorize a user's public key on the specified user, for ssh access to localhost. The :authorize-for-user option can be used to specify the user to who's authorized_keys file is modified.

config

fn

[host key-value-map & {:keys [user config-file], :or {user (:username (admin-user))}}]

Update an ssh config file. Sets the configuration for host to be that given by the key-value-map. Optionally allows specification of the user whose ssh config file is to be modified, and the full config-file path.

generate-key

fn

[user & {:keys [type filename passphrase no-dir comment], :or {type "rsa", passphrase ""}, :as options}]

Generate an ssh key pair for the given user, unless one already exists. Options are: :filename path -- output file name (within ~user/.ssh directory) :type key-type -- key type selection :no-dir true -- do note ensure directory exists :passphrase -- new passphrase for encrypting the private key :comment -- comment for new key

install-key

fn

[user key-name private-key-string public-key-string]

Install a ssh private key.

public-key

fn

[user & {:keys [filename dir type], :or {type "rsa"}, :as options}]

Returns the public key for the specified remote user. By default it returns the user's id_rsa key from ~user/.ssh/id_rsa.pub.

You can specify a different key type by passing :type. This assumes the public key has a .pub extension.

Passing a :filename value allows direct specification of the filename.

:dir allows specification of a different location.