Skip to content

lemano target rekey

Pin a target’s new host key, given its exact fingerprint

Description

Replace the host key pinned for a target with the key it presents now, but
only if that key's fingerprint is exactly the one given. Get the
fingerprint from a trusted channel, for example by running
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the host's console.

The target's connection settings come from the copy the store keeps from
its last discover, or from the target files with -f, with the settings it
leaves out read from your ssh configuration as discover reads them.

With --jump, the key re-pinned is that of one of the target's jump hosts,
named as host:port (or host, for port 22) as discover's error shows it.
The jump hosts before it must present their pinned keys.

A new host key and a new machine ID are confirmed separately: if the
machine was reinstalled, the next discover also reports IdentityChanged,
to be confirmed with lemano target confirm-identity.

Synopsis

lemano target rekey NAME --fingerprint SHA256:...

Examples

lemano target rekey web-07 --fingerprint SHA256:Qx3...
lemano target rekey web-07 --jump bastion.example.com:22 --fingerprint SHA256:k9T...

Flags

FlagTypeDefaultDescription
-f, --filenamestringread the target from this file or directory instead of the store
--fingerprintstringthe new host key’s SHA-256 fingerprint, as ssh-keygen -l prints it
--jumpstringre-pin this jump host of the target (host:port) instead of the target itself

Flags inherited from parent commands

FlagTypeDefaultDescription
--log-levelstringwarnlog level on standard error: debug, info, warn or error
--no-colornever colour the text (colour is also off when $NO_COLOR is set, when $TERM is dumb and when the output is not a terminal; $FORCE_COLOR turns it on, over $NO_COLOR)
--password-promptask on the terminal for the login password of each target whose file names none
--ssh-configstringssh configuration file that targets’ connection settings are read from, or none to read none (default $LEMANO_SSH_CONFIG, else the files ssh reads)
--storestringpath of the store (default $LEMANO_STORE, else $XDG_DATA_HOME/lemano/lemano.db)
--sudo-password-promptask on the terminal for the sudo password of each target whose file names none

Exit codes

See exit codes.

See also