tlsrptdb

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 13 Imported by: 5

Documentation

Overview

Package tlsrptdb stores reports from "SMTP TLS Reporting" in its database.

Index

Constants

This section is empty.

Variables

View Source
var (
	DBTypes = []any{TLSReportRecord{}}
	DB      *bstore.DB
)

Functions

func AddReport

func AddReport(ctx context.Context, verifiedFromDomain dns.Domain, mailFrom string, r *tlsrpt.Report) error

AddReport adds a TLS report to the database.

The report should have come in over SMTP, with a DKIM-validated verifiedFromDomain. Using HTTPS for reports is not recommended as there is no authentication on the reports origin.

The report is currently required to only cover a single domain in its policy domain. Only reports for known domains are added to the database.

Prometheus metrics are updated only for configured domains.

func Close

func Close()

Close closes the database connection.

func Init

func Init() error

Init opens and possibly initializes the database.

Types

type TLSReportRecord

type TLSReportRecord struct {
	ID         int64  `bstore:"typename Record"`
	Domain     string `bstore:"index"` // Domain to which the TLS report applies.
	FromDomain string
	MailFrom   string
	Report     tlsrpt.Report
}

TLSReportRecord is a TLS report as a database record, including information about the sender.

todo: should be named just Record, but it would cause a sherpa type name conflict.

func RecordID

func RecordID(ctx context.Context, id int64) (TLSReportRecord, error)

RecordID returns the report for the ID.

func Records

func Records(ctx context.Context) ([]TLSReportRecord, error)

Records returns all TLS reports in the database.

func RecordsPeriodDomain

func RecordsPeriodDomain(ctx context.Context, start, end time.Time, domain string) ([]TLSReportRecord, error)

RecordsPeriodDomain returns the reports overlapping start and end, for the given domain. If domain is empty, all records match for domain.

Jump to

Keyboard shortcuts

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