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 ¶
- type ManualStep
- type RotateReport
- type Rotator
- func (r *Rotator) Rollback(selector string) (RotateReport, error)
- func (r *Rotator) Rotate(selector string, allowUnverified bool, passphrase string) (RotateReport, error)
- func (r *Rotator) RotateEach(names []string, allowUnverified bool, pw string, out io.Writer, ...) ([]string, error)
- func (r *Rotator) Unattended(w io.Writer) *Rotator
- func (r *Rotator) WithManualStep(step ManualStep) *Rotator
- type TargetResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManualStep ¶
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 (*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 `authama ssh 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 ¶
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.