Documentation ¶
Overview ¶
Package http provides HTTP listeners/servers, for autoconfiguration/autodiscovery, the account and admin web interface and MTA-STS policies.
Index ¶
- func ListenAndServe()
- type Account
- func (Account) DestinationSave(ctx context.Context, destName string, oldDest, newDest config.Destination)
- func (Account) Destinations(ctx context.Context) (dns.Domain, map[string]config.Destination)
- func (Account) ImportAbort(ctx context.Context, importToken string) error
- func (Account) SetPassword(ctx context.Context, password string)
- type Admin
- func (Admin) Account(ctx context.Context, account string) map[string]any
- func (Admin) AccountAdd(ctx context.Context, accountName, address string)
- func (Admin) AccountRemove(ctx context.Context, accountName string)
- func (Admin) Accounts(ctx context.Context) []string
- func (Admin) AddressAdd(ctx context.Context, address, accountName string)
- func (Admin) AddressRemove(ctx context.Context, address string)
- func (Admin) CheckDomain(ctx context.Context, domainName string) (r CheckResult)
- func (Admin) ClientConfigDomain(ctx context.Context, domain string) mox.ClientConfig
- func (Admin) ConfigFiles(ctx context.Context) (staticPath, dynamicPath, static, dynamic string)
- func (Admin) DMARCReportID(ctx context.Context, domain string, reportID int64) (report dmarcdb.DomainFeedback)
- func (Admin) DMARCReports(ctx context.Context, start, end time.Time, domain string) (reports []dmarcdb.DomainFeedback)
- func (Admin) DMARCSummaries(ctx context.Context, start, end time.Time, domain string) (domainSummaries []DMARCSummary)
- func (Admin) DNSBLStatus(ctx context.Context) map[string]map[string]string
- func (Admin) Domain(ctx context.Context, domain string) dns.Domain
- func (Admin) DomainAdd(ctx context.Context, domain, accountName, localpart string)
- func (Admin) DomainLocalparts(ctx context.Context, domain string) (localpartAccounts map[smtp.Localpart]string)
- func (Admin) DomainRecords(ctx context.Context, domain string) []string
- func (Admin) DomainRemove(ctx context.Context, domain string)
- func (Admin) Domains(ctx context.Context) []dns.Domain
- func (Admin) LogLevelRemove(ctx context.Context, pkg string)
- func (Admin) LogLevelSet(ctx context.Context, pkg string, levelStr string)
- func (Admin) LogLevels(ctx context.Context) map[string]string
- func (Admin) LookupIP(ctx context.Context, ip string) Reverse
- func (Admin) MTASTSPolicies(ctx context.Context) (records []mtastsdb.PolicyRecord)
- func (Admin) QueueDrop(ctx context.Context, id int64)
- func (Admin) QueueKick(ctx context.Context, id int64)
- func (Admin) QueueList(ctx context.Context) []queue.Msg
- func (Admin) QueueSize(ctx context.Context) int
- func (Admin) SetPassword(ctx context.Context, accountName, password string)
- func (Admin) TLSRPTSummaries(ctx context.Context, start, end time.Time, domain string) (domainSummaries []TLSRPTSummary)
- func (Admin) TLSReportID(ctx context.Context, domain string, reportID int64) tlsrptdb.TLSReportRecord
- func (Admin) TLSReports(ctx context.Context, start, end time.Time, domain string) (reports []tlsrptdb.TLSReportRecord)
- type AutoconfCheckResult
- type AutodiscoverCheckResult
- type AutodiscoverSRV
- type CheckResult
- type DKIMCheckResult
- type DKIMRecord
- type DMARCCheckResult
- type DMARCRecord
- type DMARCSummary
- type IPRevCheckResult
- type MTASTSCheckResult
- type MTASTSRecord
- type MX
- type MXCheckResult
- type Result
- type Reverse
- type SPFCheckResult
- type SPFRecord
- type SRVConfCheckResult
- type TLSCheckResult
- type TLSRPTCheckResult
- type TLSRPTRecord
- type TLSRPTSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe()
ListenAndServe starts listeners for HTTP, including those required for ACME to generate TLS certificates.
Types ¶
type Account ¶
type Account struct{}
Account exports web API functions for the account web interface. All its methods are exported under /api/. Function calls require valid HTTP Authentication credentials of a user.
func (Account) DestinationSave ¶
func (Account) DestinationSave(ctx context.Context, destName string, oldDest, newDest config.Destination)
DestinationSave updates a destination. OldDest is compared against the current destination. If it does not match, an error is returned. Otherwise newDest is saved and the configuration reloaded.
func (Account) Destinations ¶
Destinations returns the default domain, and the destinations (keys are email addresses, or localparts to the default domain). todo: replace with a function that returns the whole account, when sherpadoc understands unnamed struct fields.
func (Account) ImportAbort ¶
ImportAbort aborts an import that is in progress. If the import exists and isn't finished, no changes will have been made by the import.
func (Account) SetPassword ¶
SetPassword saves a new password for the account, invalidating the previous password. Sessions are not interrupted, and will keep working. New login attempts must use the new password. Password must be at least 8 characters.
type Admin ¶
type Admin struct{}
Admin exports web API functions for the admin web interface. All its methods are exported under /admin/api/. Function calls require valid HTTP Authentication credentials of a user.
func (Admin) AccountAdd ¶
AccountAdd adds existing a new account, with an initial email address, and reloads the configuration.
func (Admin) AccountRemove ¶
AccountRemove removes an existing account and reloads the configuration.
func (Admin) AddressAdd ¶
AddressAdd adds a new address to the account, which must already exist.
func (Admin) AddressRemove ¶
AddressRemove removes an existing address.
func (Admin) CheckDomain ¶
func (Admin) CheckDomain(ctx context.Context, domainName string) (r CheckResult)
CheckDomain checks the configuration for the domain, such as MX, SMTP STARTTLS, SPF, DKIM, DMARC, TLSRPT, MTASTS, autoconfig, autodiscover.
func (Admin) ClientConfigDomain ¶
ClientConfigDomain returns configurations for email clients, IMAP and Submission (SMTP) for the domain.
func (Admin) ConfigFiles ¶
ConfigFiles returns the paths and contents of the static and dynamic configuration files.
func (Admin) DMARCReportID ¶
func (Admin) DMARCReportID(ctx context.Context, domain string, reportID int64) (report dmarcdb.DomainFeedback)
DMARCReportID returns a single DMARC report.
func (Admin) DMARCReports ¶
func (Admin) DMARCReports(ctx context.Context, start, end time.Time, domain string) (reports []dmarcdb.DomainFeedback)
DMARCReports returns DMARC reports overlapping with period start/end, for the given domain (or all domains if empty). The reports are sorted first by period end (most recent first), then by domain.
func (Admin) DMARCSummaries ¶
func (Admin) DMARCSummaries(ctx context.Context, start, end time.Time, domain string) (domainSummaries []DMARCSummary)
DMARCSummaries returns a summary of received DMARC reports overlapping with period start/end for one or all domains (when domain is empty). The returned summaries are ordered by domain name.
func (Admin) DNSBLStatus ¶
DNSBLStatus returns the IPs from which outgoing connections may be made and their current status in DNSBLs that are configured. The IPs are typically the configured listen IPs, or otherwise IPs on the machines network interfaces, with internal/private IPs removed.
The returned value maps IPs to per DNSBL statuses, where "pass" means not listed and anything else is an error string, e.g. "fail: ..." or "temperror: ...".
func (Admin) Domain ¶
Domain returns the dns domain for a (potentially unicode as IDNA) domain name.
func (Admin) DomainLocalparts ¶
func (Admin) DomainLocalparts(ctx context.Context, domain string) (localpartAccounts map[smtp.Localpart]string)
DomainLocalparts returns the localparts and accounts configured in domain.
func (Admin) DomainRecords ¶
DomainRecords returns lines describing DNS records that should exist for the configured domain.
func (Admin) DomainRemove ¶
DomainRemove removes an existing domain and reloads the configuration.
func (Admin) LogLevelRemove ¶
LogLevelRemove removes a log level for a package, which cannot be the empty string.
func (Admin) LogLevelSet ¶
LogLevelSet sets a log level for a package.
func (Admin) MTASTSPolicies ¶
func (Admin) MTASTSPolicies(ctx context.Context) (records []mtastsdb.PolicyRecord)
MTASTSPolicies returns all mtasts policies from the cache.
func (Admin) SetPassword ¶
SetPassword saves a new password for an account, invalidating the previous password. Sessions are not interrupted, and will keep working. New login attempts must use the new password. Password must be at least 8 characters.
func (Admin) TLSRPTSummaries ¶
func (Admin) TLSRPTSummaries(ctx context.Context, start, end time.Time, domain string) (domainSummaries []TLSRPTSummary)
TLSRPTSummaries returns a summary of received TLS reports overlapping with period start/end for one or all domains (when domain is empty). The returned summaries are ordered by domain name.
func (Admin) TLSReportID ¶
func (Admin) TLSReportID(ctx context.Context, domain string, reportID int64) tlsrptdb.TLSReportRecord
TLSReportID returns a single TLS report.
func (Admin) TLSReports ¶
func (Admin) TLSReports(ctx context.Context, start, end time.Time, domain string) (reports []tlsrptdb.TLSReportRecord)
TLSReports returns TLS reports overlapping with period start/end, for the given domain (or all domains if empty). The reports are sorted first by period end (most recent first), then by domain.
type AutoconfCheckResult ¶
type AutodiscoverCheckResult ¶
type AutodiscoverCheckResult struct { Records []AutodiscoverSRV Result }
type AutodiscoverSRV ¶
type CheckResult ¶
type CheckResult struct { Domain string IPRev IPRevCheckResult MX MXCheckResult TLS TLSCheckResult SPF SPFCheckResult DKIM DKIMCheckResult DMARC DMARCCheckResult TLSRPT TLSRPTCheckResult MTASTS MTASTSCheckResult SRVConf SRVConfCheckResult Autoconf AutoconfCheckResult Autodiscover AutodiscoverCheckResult }
CheckResult is the analysis of a domain, its actual configuration (DNS, TLS, connectivity) and the mox configuration. It includes configuration instructions (e.g. DNS records), and warnings and errors encountered.
type DKIMCheckResult ¶
type DKIMCheckResult struct { Records []DKIMRecord Result }
type DMARCCheckResult ¶
type DMARCCheckResult struct { Domain string TXT string Record *DMARCRecord Result }
type DMARCRecord ¶
type DMARCSummary ¶
type DMARCSummary struct { Domain string Total int DispositionNone int DispositionQuarantine int DispositionReject int DKIMFail int SPFFail int PolicyOverrides map[dmarcrpt.PolicyOverride]int }
DMARCSummary presents DMARC aggregate reporting statistics for a single domain over a period.
type IPRevCheckResult ¶
type MTASTSCheckResult ¶
type MTASTSRecord ¶
type MXCheckResult ¶
type Reverse ¶
type Reverse struct {
Hostnames []string
}
Reverse is the result of a reverse lookup.
type SPFCheckResult ¶
type SRVConfCheckResult ¶
type TLSCheckResult ¶
type TLSCheckResult struct {
Result
}
type TLSRPTCheckResult ¶
type TLSRPTCheckResult struct { TXT string Record *TLSRPTRecord Result }
type TLSRPTRecord ¶
type TLSRPTSummary ¶
type TLSRPTSummary struct { Domain string Success int64 Failure int64 ResultTypeCounts map[tlsrpt.ResultType]int }
TLSRPTSummary presents TLS reporting statistics for a single domain over a period.