rotator

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rotator does zero-downtime, staged, single-old-archive key rotation. rotate stages a replacement, deploys it to every target (the current key stays active), verifies, and only then commits (archive current under /old/, promote staged, revoke old). On any pre-commit failure the staged key is discarded and the active key is untouched. rollback is the symmetric reverse move of the single /old/ key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManualStep

type ManualStep func(alias, where, pubkey string) bool

ManualStep is asked, for each target whose provider can only take a pasted key (a web panel such as Ploi), to show the staged public key and where it goes, and to report whether it is now in place. The CLI sets one only when there is a terminal to ask at; without one, rotate behaves as it always has.

type RotateReport

type RotateReport struct {
	KeyName        string
	OldFingerprint string
	NewFingerprint string
	Committed      bool
	Message        string
	Targets        []TargetResult
	// Fallback names the software type minted when the hardware *-sk type had
	// no security key to answer; "" otherwise.
	Fallback string `json:",omitempty"`
}

RotateReport summarizes a rotate/rollback run.

func (RotateReport) Format

func (r RotateReport) Format() string

Format renders the rotation summary (mirrors RotateReport.format).

type Rotator

type Rotator struct {
	// contains filtered or unexported fields
}

Rotator rotates keys.

func New

New builds a Rotator.

func (*Rotator) Rollback

func (r *Rotator) Rollback(selector string) (RotateReport, error)

Rollback restores the single /old/ predecessor (plain reverse move), re-deploys it, and revokes the rotated-in key. Mirrors Rotator.rollback.

func (*Rotator) Rotate

func (r *Rotator) Rotate(selector string, allowUnverified bool, passphrase string) (RotateReport, error)

Rotate stages a fresh key, deploys+verifies it on every target, and commits only if all verified (or allowUnverified and all deployed). Mirrors Rotator.rotate.

func (*Rotator) RotateEach

func (r *Rotator) RotateEach(names []string, allowUnverified bool, pw string, out io.Writer,
	save, next func() error) ([]string, error)

RotateEach rotates the keys named, one after another, as `sshmgr rotate` does for a selection: a key that fails is reported and left as it was, and the rest go on. save runs after every committed key, so an interrupted batch keeps what it finished. next, when set, runs before each key, and an error from it stops the batch there: a web job's cancel. It returns the keys not rotated.

func (*Rotator) Unattended

func (r *Rotator) Unattended(w io.Writer) *Rotator

Unattended makes the rotation's deploys run with nobody to answer a prompt, writing their ssh output to w. The web UI rotates this way.

func (*Rotator) WithManualStep

func (r *Rotator) WithManualStep(step ManualStep) *Rotator

WithManualStep sets the manual step and returns the Rotator.

type TargetResult

type TargetResult struct {
	Alias    string
	Provider string
	Deployed bool
	Verified bool
	Revoked  bool
	// ManageURL is where a manual (web-panel) target's keys are managed; set when the deploy was a
	// paste, so a committed report can say where the old key still has to be removed by hand.
	ManageURL string
}

TargetResult is one target's rotation outcome.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL