certmonitor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: GPL-3.0 Imports: 15 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 certmonitor implements OpenCTEM's Certificate-Transparency (CT) discovery source: a scheduled, per-tenant poller that queries the PUBLIC crt.sh CT-log aggregator for the tenant's own registered domains and emits first-class ExposureEvents.

This is CTEM Discovery breadth ("exposure != vulnerability") that needs no credentials, no agent, and no customer consent — it reads only public CT-log data. It complements the agent-side subfinder recon (which enumerates subdomains on demand during a scan job): CT monitoring runs continuously server-side and, crucially, surfaces cert-expiry exposures and certs issued for domains the tenant never scanned. See docs/rfcs/RFC-019.

The outbound query goes through httpsec.SafeHTTPClient (SSRF-guarded: it refuses RFC1918 / link-local addresses even though crt.sh is public — defense against DNS rebinding of the configurable feed URL), is body-bounded, and is politeness-rate-limited between domains so we never hammer crt.sh.

Tenant isolation: the tenant is taken from the asset being queried, never from the CT response. Every emitted exposure is stamped with that tenant. A failure on one domain or one tenant is logged and skipped (fail-open); it never aborts the whole sweep.

Index

Constants

View Source
const (
	// DefaultFeedBaseURL is the public crt.sh CT-log aggregator. No auth.
	DefaultFeedBaseURL = "https://crt.sh"

	// Source is the exposure source tag for everything this connector emits.
	Source = "cert_transparency"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetLister

type AssetLister interface {
	List(ctx context.Context, filter assetdom.Filter, opts assetdom.ListOptions, page pagination.Pagination) (pagination.Result[*assetdom.Asset], error)
}

AssetLister is the narrow slice of the asset repository the CT sweep needs: paginated listing of a tenant's domain assets. Satisfied by *postgres.AssetRepository.

type ExposureUpserter

type ExposureUpserter interface {
	BulkUpsert(ctx context.Context, events []*exposuredom.ExposureEvent) error
}

ExposureUpserter is the narrow slice of the exposure repository the CT sweep needs: fingerprint-deduped batch upsert. Satisfied by *postgres.ExposureRepository.

type Service

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

Service is the CT discovery source.

func NewService

func NewService(
	assetRepo AssetLister,
	exposureRepo ExposureUpserter,
	feedBaseURL string,
	log *logger.Logger,
) *Service

NewService constructs the CT discovery service. An empty feedBaseURL defaults to crt.sh.

func (*Service) FeedBaseURL

func (s *Service) FeedBaseURL() string

FeedBaseURL returns the configured crt.sh base URL (for diagnostics).

func (*Service) MonitorTenant

func (s *Service) MonitorTenant(ctx context.Context, tenantID shared.ID) (int, error)

MonitorTenant runs one CT sweep for a single tenant: it lists the tenant's domain assets, queries crt.sh for each (bounded + rate-limited), and upserts the resulting ExposureEvents (deduped by fingerprint). Returns the number of exposures emitted (created or re-sighted). Fail-open per domain: a crt.sh error on one domain is logged and the sweep continues.

Jump to

Keyboard shortcuts

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