Skip to main content

Module key_setup

Module key_setup 

Source
Expand description

Auto SSH Key Setup

Provides automated SSH key generation and server configuration for transitioning from password-based to key-based authentication.

§Safety Invariants

  • Never disable password authentication without verified key auth
  • Append to authorized_keys, never overwrite
  • Always backup sshd_config before modification
  • Show warning about alternative access before disabling password
  • Log all operations to key_setup.log
  • Private key 600, .ssh directory 700
  • Never transmit private key over network

Structs§

KeySetupMachine
State machine for tracking key setup progress.
KeySetupResult
Result of the key setup process.

Enums§

KeySetupState
Result of the key setup process.
KeySetupStep
Individual steps in the key setup process.
KeyType
Supported SSH key types for generation.

Functions§

build_authorized_keys_command
Builds the command to append a public key to authorized_keys.
build_disable_password_command
Builds the command to disable password authentication in sshd_config.
build_reload_sshd_command
Builds the command to reload the SSH daemon.
build_rollback_command
Builds the emergency rollback command.
generate_key_pair
Generates an Ed25519 SSH key pair and writes it to disk.
sanitize_hostname
Sanitizes a hostname for use in a key filename.
setup_key_for_host
Executes the complete key setup process for a host.