monitor

package
v0.0.0-...-2dd7cdc Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package monitor provides monitoring of Certificate Transparency logs. If running in continuous mode, the list of logs can be updated dynamically.

Implement the Matcher interface to customize which certificates should be included in the monitor's emitted events. See MatchAll for an example.

Note that this package verifies that the monitored logs are locally consistent with regard to the initial start-up state. It is up to the user to process the monitor's emitted events and errors, and to persist state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Optional
	Matcher    Matcher        // Which log entries to match (default is to match all)
	Logger     *logger.Logger // Debug prints only (no output by default)
	Contact    string         // Something that help log operators get in touch
	ChunkSize  uint           // Min number of leaves to propagate a chunk without matches
	BatchSize  uint           // Max number of certificates to accept per worker
	NumWorkers uint           // Number of parallel workers to use for each log
}

type Event

type Event struct {
	State   State
	Matches []LogEntry
	Errors  []error
}

Event carries the latest consistent monitor state, found matches, as well as errors that occurred while trying to match on the downloaded log entries.

func (*Event) Summary

func (ev *Event) Summary() string

type LogEntry

type LogEntry struct {
	LeafIndex uint64 `json:"leaf_index"`
	LeafData  []byte `json:"leaf_data"`
	ExtraData []byte `json:"extra_data"`
}

LogEntry is a Merkle tree leaf in a log

type MatchAll

type MatchAll struct{}

func (*MatchAll) Match

func (m *MatchAll) Match(leafInput, extraData []byte) (bool, error)

type Matcher

type Matcher interface {
	// Match determines if a log entry is considered to be a "match" based on
	// some criteria.  An error is returned if any certificate parsing fails.
	Match(leafInput, extraData []byte) (bool, error)
}

type Monitor

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

func New

func New(cfg Config, evCh chan Event, cfgCh chan MonitoredLog, errCh chan error) (Monitor, error)

func (*Monitor) RunForever

func (mon *Monitor) RunForever(ctx context.Context) error

func (*Monitor) RunOnce

func (mon *Monitor) RunOnce(ctx context.Context, cfg []MonitoredLog, evCh chan Event, errCh chan error) error

type MonitoredLog

type MonitoredLog struct {
	Config metadata.Log
	State  State
}

MonitoredLog provides information about a log the monitor is following

type State

type State struct {
	ct.SignedTreeHead `json:"latest_sth"`
	CompactRange      [][sha256.Size]byte `json:"compact_range"`
	NextIndex         uint64              `json:"next_index"`
}

State is the latest append-only state the monitor observed from its local vantage point. The compact range covers [0, NextIndex). The next entry to download from the log is at index NextIndex.

Jump to

Keyboard shortcuts

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