cawatch

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cawatch implements the CA auto-rotation scanner: a periodic watchdog that detects CAs approaching their expiry and automatically rotates them. This is an opt-in feature controlled by the ca_auto_rotate config section.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner struct {
	Store     store.Store
	Master    *keystore.Master
	Logger    *slog.Logger
	Threshold float64       // 0.20 default; fraction of CA lifetime when rotation is triggered
	Interval  time.Duration // 6*time.Hour default; how often to scan
}

Scanner is a periodic CA auto-rotation watchdog. Wire one up at server start, call StartLoop with a cancellable context, and it ticks every Interval until the context is canceled.

func (*Scanner) Run

func (s *Scanner) Run(ctx context.Context) error

Run performs a single sweep: find CAs approaching expiry and rotate them. Errors from individual CA rotations are logged but do not stop the loop; rotation is idempotent through pki.RotateAndStoreCA (returns existing successor if any).

func (*Scanner) StartLoop

func (s *Scanner) StartLoop(ctx context.Context)

StartLoop runs Run() immediately, then on every Interval tick until ctx is canceled. Returns once the loop exits.

Jump to

Keyboard shortcuts

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