config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFile = "/etc/ct-monitor/config.toml"

	DefaultSubjectTemplate = "Certificate Transparency Notification for {{.Domain}}"
	DefaultBodyTemplate    = `` /* 389-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertConfig

type AlertConfig struct {
	// Mailer is the name of the mail provider to use.
	// If the provider doesn't exist or isn't configured,
	// the no-op mailer will be used.
	Mailer Mailer `mapstructure:"mailer_config"`
}

AlertConfig contains alert configuration.

type Config

type Config struct {
	// Domains is a list of domain configurations.
	Domains []DomainConfig `mapstructure:"domain"`
	// Endpoint is the CertSpotter API endpoint.
	// This defaults to "https://api.certspotter.com/v1/issuances".
	Endpoint string `mapstructure:"certspotter_endpoint"`
	// Token is the token used for interacting with the CertSpotter API.
	// This can also be provided via the CERTSPOTTER_TOKEN environment variable.
	Token string `mapstructure:"certspotter_token"`
	// AlertConfig represents the configuration for alert mails.
	AlertConfig AlertConfig `mapstructure:"alert_config"`
	// PositionConfig represents the configuration for recording log position.
	PositionConfig PositionConfig `mapstructure:"position_config"`
	// AmazonSES represents the mailer configuration for using Amazon Simple Email Service.
	AmazonSES mailer.AmazonSESMailer `mapstructure:"amazonses"`
	// Sendgrid represents the mailer configuration for using Sendgrid.
	Sendgrid mailer.SendgridMailer `mapstructure:"sendgrid"`
	// SMTP represents the mailer configuration for using plain SMTP.
	SMTP mailer.SMTPMailer `mapstructure:"smtp"`
	// FilterConfig represent filter plugin configuration.
	FilterConfig FilterConfig `mapstructure:"filter_config"`
	// MailTemplate represents template strings for emails being sent out.
	MailTemplate MailTemplate `mapstructure:"mail_template"`
}

Config contains the configuration for ct-monitor.

func Load

func Load(confFile string) (conf *Config, err error)

Load loads the configuration from file.

func (*Config) GetMailer

func (c *Config) GetMailer(name Mailer) (m mailer.Mailer)

GetMailer retrieves a Mailer instance from the configuration.

type DomainConfig

type DomainConfig struct {
	// Name is the FQDN of the domain to query for.
	Name string `mapstructure:"name"`
	// MatchWildcards should be set to true to include wildcards.
	MatchWildcards bool `mapstructure:"match_wildcards"`
	// IncludeSubdomains should be set to true if subdomains should also be scanned.
	IncludeSubdomains bool `mapstructure:"include_subdomains"`
	// Mailer is the name of the mail provider to use for this domain.
	// If not provided, the global configuration in alert_config is used.
	Mailer Mailer `mapstructure:"mailer_config"`
}

DomainConfig contains domain configurations.

type FilterConfig added in v0.4.0

type FilterConfig struct {
	Filters []string `mapstructure:"filters"`
}

type MailTemplate added in v0.5.0

type MailTemplate struct {
	Subject string `mapstructure:"subject"`
	Body    string `mapstructure:"body"`
}

MailTemplate represents template strings for emails being sent out. The following variables are made available for templating.

Domain: the configured domain name which was queried.
Issuances: the Issuance object returned by the certspotter API.

type Mailer

type Mailer string

Mailer represents a mailer name.

const (
	AmazonSESMailer Mailer = "amazonses"
	SendgridMailer  Mailer = "sendgrid"
	SMTPMailer      Mailer = "smtp"
	NoOpMailer      Mailer = "none"
)

type PositionConfig

type PositionConfig struct {
	Filename string `mapstructure:"filename"`
}

PositionConfig represents a position file config.

Jump to

Keyboard shortcuts

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