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 ¶
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 ¶
FeedBaseURL returns the configured crt.sh base URL (for diagnostics).
func (*Service) MonitorTenant ¶
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.