config

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: AGPL-3.0 Imports: 19 Imported by: 6

Documentation

Overview

Package config implements the configuration for the Katzenpost client mail proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// User is the account user name.
	User string

	// Provider is the provider identifier used by this account.
	Provider string

	// ProviderKeyPin is the optional pinned provider signing key.
	ProviderKeyPin *eddsa.PublicKey

	// VotingAuthority is the authority configuration used by this Account.
	VotingAuthority string

	// NonvotingAuthority is the authority configuration used by this Account.
	NonvotingAuthority string

	// LinkKey is the Provider authentication key used by this Account.
	LinkKey *ecdh.PrivateKey `toml:"-"`

	// IdentityKey is the identity key used by this Account.
	IdentityKey *ecdh.PrivateKey `toml:"-"`

	// StorageKey is the optional per-account database encryption key.
	StorageKey *ecdh.PrivateKey `toml:"-"`

	// InsecureKeyDiscovery enables automatic fetching of recipient keys.
	// This option is disabled by default as mailproxy provides no UX for
	// verifying keys.
	InsecureKeyDiscovery bool
}

Account is a provider account configuration.

type Config

type Config struct {
	Proxy         *Proxy
	Logging       *Logging
	Management    *Management
	UpstreamProxy *UpstreamProxy
	Debug         *Debug

	NonvotingAuthority map[string]*NonvotingAuthority `toml:",omitempty"`
	VotingAuthority    map[string]*VotingAuthority    `toml:",omitempty"`
	Account            []*Account
	Recipients         map[string]*ecdh.PublicKey `toml:"-"`

	// StrRecipients exists entirely to work around a bug in the toml library,
	// and should not be used by anything external to this package.
	//
	// See: https://github.com/BurntSushi/toml/issues/170
	StrRecipients map[string]string `toml:"Recipients"`
	// contains filtered or unexported fields
}

Config is the top level mail proxy configuration.

func Load

func Load(b []byte, forceGenOnly bool) (*Config, error)

Load parses and validates the provided buffer b as a config file body and returns the Config.

func LoadFile

func LoadFile(f string, forceGenOnly bool) (*Config, error)

LoadFile loads, parses, and validates the provided file and returns the Config.

func (*Config) AccountMap

func (cfg *Config) AccountMap() map[string]*Account

AccountMap returns the account identifier->Account mapping specified in the Config.

func (*Config) FixupAndValidate

func (cfg *Config) FixupAndValidate() error

FixupAndValidate applies defaults to config entries and validates the supplied configuration. Most people should call one of the Load variants instead.

func (*Config) NonvotingAuthorityMap added in v0.0.4

func (cfg *Config) NonvotingAuthorityMap() map[string]authority.Factory

NonvotingAuthorityMap returns the identifier->authority.Factory mapping specified in the Config.

func (*Config) UpstreamProxyConfig

func (cfg *Config) UpstreamProxyConfig() *proxy.Config

UpstreamProxyConfig returns the configured upstream proxy, suitable for internal use. Most people should not use this.

func (*Config) VotingAuthorityMap added in v0.0.4

func (cfg *Config) VotingAuthorityMap() map[string]authority.Factory

VotingAuthorityMap returns the identifier->authority.Factory mapping specified in the Config.

type Debug

type Debug struct {
	// ReceiveTimeout is the time in seconds after which the inbound
	// message processor will give up on a partially received message
	// measured from when the last non-duplicate fragment was received.
	// If set to 0 (the default), the timeout is infinite.
	ReceiveTimeout int

	// BounceQueueLifetime is the minimum time in seconds till the mail
	// proxy will give up on sending a particular e-mail.
	BounceQueueLifetime int

	// UrgentQueueLifetime is the minimum time in seconds till the mail
	// proxy will give up on sending urgent (Kaetzchen) requests.
	UrgentQueueLifetime int

	// PollingInterval is the interval in seconds that will be used to
	// poll the receive queue.  By default this is 30 seconds.  Reducing
	// the value too far WILL result in uneccesary Provider load, and
	// increasing the value too far WILL adversely affect large message
	// transmit performance.
	PollingInterval int

	// RetransmitSlack is the extra time in seconds added to account for
	// various delays such as latency and the fetch scheduler before
	// a block will be retransmitted.  Reducing this WILL result in
	// worse performance, increased spurrious retransmissions, and
	// unneccecary load on the network.
	RetransmitSlack int

	// CaseSensitiveUserIdentifiers disables the forced lower casing of
	// the Account `User` field.
	CaseSensitiveUserIdentifiers bool

	// SendDecoyTraffic enables sending decoy traffic.  This is still
	// experimental and untuned and thus is disabled by default.
	//
	// WARNING: This option will go away once a concrete client decoy
	// traffic is more concrete.
	SendDecoyTraffic bool

	// GenerateOnly halts and cleans up the mail proxy right after long term
	// key generation.
	GenerateOnly bool
}

Debug is the mail proxy debug configuration.

type Logging

type Logging struct {
	// Disable disables logging entirely.
	Disable bool

	// File specifies the log file, if omitted stdout will be used.
	File string

	// Level specifies the log level.
	Level string
}

Logging is the mail proxy logging configuration.

type Management

type Management struct {
	// Enable enables the management interface.
	Enable bool

	// Path specifies the path to the management interface socket.  If left
	// empty it will use `management_sock` under the DataDir.
	Path string
}

Management is the mailproxy management interface configuration.

type NonvotingAuthority

type NonvotingAuthority struct {
	// Address is the IP address/port combination of the authority.
	Address string

	// PublicKey is the authority's public key.
	PublicKey *eddsa.PublicKey
}

NonvotingAuthority is a non-voting authority configuration.

func (*NonvotingAuthority) New

func (nvACfg *NonvotingAuthority) New(l *log.Backend, pCfg *proxy.Config) (pki.Client, error)

New constructs a pki.Client with the specified non-voting authority config.

type Proxy

type Proxy struct {
	// POP3Address is the IP address/port combination that the mail proxy will
	// bind to for POP3 access.  If omitted `127.0.0.1:2524` will be used.
	POP3Address string

	// SMTPAddress is the IP address/port combination that the mail proxy will
	// bind to for SMTP access.  If omitted `127.0.0.1:2525` will be used.
	SMTPAddress string

	// DataDir is the absolute path to the mail proxy's state files.
	DataDir string

	// RecipientDir is the absolute path to the mail proxy's recipient files.
	RecipientDir string

	// NoLaunchListeners disables the POP3 and SMTP interfaces, which is
	// useful if you are using mailproxy as a library rather than a
	// stand-alone process.
	NoLaunchListeners bool
}

Proxy is the mail proxy configuration.

type UpstreamProxy

type UpstreamProxy struct {
	// PreferedTransports is a list of the transports will be used to make
	// outgoing network connections, with the most prefered first.
	PreferedTransports []pki.Transport

	// Type is the proxy type (Eg: "none"," socks5").
	Type string

	// Network is the proxy address' network (`unix`, `tcp`).
	Network string

	// Address is the proxy's address.
	Address string

	// User is the optional proxy username.
	User string

	// Password is the optional proxy password.
	Password string
}

UpstreamProxy is the mailproxy outgoing connection proxy configuration.

type VotingAuthority added in v0.0.4

type VotingAuthority struct {
	Peers []*vServerConfig.AuthorityPeer
}

VotingAuthority is a voting authority configuration.

func (*VotingAuthority) New added in v0.0.4

func (vACfg *VotingAuthority) New(l *log.Backend, pCfg *proxy.Config) (pki.Client, error)

New constructs a pki.Client with the specified non-voting authority config.

type VotingPeer added in v0.0.4

type VotingPeer struct {
	// Address is the IP address/port combination of the authority.
	Addresses []string

	// IdentityPublicKey is the authority's signing public key.
	IdentityPublicKey *eddsa.PublicKey

	// LinkPublicKey is the authority's link layer public key.
	LinkPublicKey *eddsa.PublicKey
}

VotingPeer is the mail proxy authority peer configuration.

Jump to

Keyboard shortcuts

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