mailproxy

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: AGPL-3.0 Imports: 31 Imported by: 4

README


.. image:: https://travis-ci.org/katzenpost/mailproxy.svg?branch=master
  :target: https://travis-ci.org/katzenpost/mailproxy

.. image:: https://godoc.org/github.com/katzenpost/mailproxy?status.svg
  :target: https://godoc.org/github.com/katzenpost/mailproxy


mailproxy - POP/SMTP to Katzenpost proxy server
===============================================

This is a implementation of a proxy server that exposes a POP/SMTP interface
to Katzenpost based mix networks. It is intended to run on a user's localhost
to allow standard mail clients to send and receive mail over the mixnet.

To build the mailproxy see the 'daemons' repo:

https://github.com/Katzenpost/daemons


author
======

Yawning Angel (yawning at schwanenlied dot me)


license
=======

AGPL: see LICENSE file for details.


supported by
============

.. image:: https://katzenpost.mixnetworks.org/_static/images/eu-flag-tiny.jpg

This project has received funding from the European Union’s Horizon 2020
research and innovation programme under the Grant Agreement No 653497, Privacy
and Accountability in Networks via Optimized Randomized Mix-nets (Panoramix).

Documentation

Overview

Package mailproxy implements a POP/SMTP to Katzenpost proxy server.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownRecipient is the error that is returned when a recipient for
	// which there is no public key is specified.
	ErrUnknownRecipient = errors.New("mailproxy/api: unknown recipient, missing public key")

	// ErrNoMessages is the error that is returned when an account's receive
	// queue is empty.
	ErrNoMessages = errors.New("mailproxy/api: account receive queue empty")
)
View Source
var (
	// ErrKeyserverSyntaxError is the error returned when the keyserver
	// rejects a query due to a malformed request.
	ErrKeyserverSyntaxError = errors.New("keyserver: syntax error")

	// ErrNoIdentity is the error returned when the keyserver fails to
	// find the requested user, or the user's public key.
	ErrNoIdentity = errors.New("keyserver: user or public key not found")
)
View Source
var ErrGenerateOnly = errors.New("mailproxy: GenerateOnly set")

ErrGenerateOnly is the error returned when the server initialization

Functions

This section is empty.

Types

type Message

type Message struct {
	// Payload is the Message payload.
	Payload []byte

	// SenderID is the Message sender's identifier set iff the sender is
	// a known recipient.
	SenderID string

	// SenderKey is the Message sender's public key, if any.
	SenderKey *ecdh.PublicKey

	// MessageID is the local unique identifier for the message.
	MessageID []byte
}

Message is the received message.

type Proxy

type Proxy struct {
	worker.Worker

	EventSink chan event.Event
	// contains filtered or unexported fields
}

Proxy is a mail proxy server instance.

func New

func New(cfg *config.Config) (*Proxy, error)

New returns a new Proxy instance parameterized with the specified configuration.

func (*Proxy) GetRecipient

func (p *Proxy) GetRecipient(recipientID string) (*ecdh.PublicKey, error)

GetRecipient returns the public key for the provided recipient.

func (*Proxy) IsConnected

func (p *Proxy) IsConnected(accountID string) bool

IsConnected returns true iff a connection to the provider is established.

func (*Proxy) ListProviders

func (p *Proxy) ListProviders(authorityID string) ([]*pki.MixDescriptor, error)

ListProviders returns a list of Provider identifiers published for the current epoch by the authority identified by authorityID.

func (*Proxy) ListRecipients

func (p *Proxy) ListRecipients() map[string]*ecdh.PublicKey

ListRecipients returns a map of recipientIDs to public keys consisting of all currently known entries. Modifications to the returned map have no effect.

func (*Proxy) ParseKeyQueryResponse

func (p *Proxy) ParseKeyQueryResponse(payload []byte) (string, *ecdh.PublicKey, error)

ParseKeyQueryResponse parses a response obtained from a key server query.

func (*Proxy) QueryKeyFromProvider

func (p *Proxy) QueryKeyFromProvider(senderID, recipientID string) ([]byte, error)

QueryKeyFromProvider enqueues a keyserver lookup from the sender for the specified recipient and returns the message identifier tag.

func (*Proxy) ReceivePeek

func (p *Proxy) ReceivePeek(accountID string) (*Message, error)

ReceivePeek returns the eldest message in the given account's receive queue. The account's receive queue is left intact.

func (*Proxy) ReceivePop

func (p *Proxy) ReceivePop(accountID string) (*Message, error)

ReceivePop removes and returns the eldest message in the given account's receive queue.

func (*Proxy) RemoveRecipient

func (p *Proxy) RemoveRecipient(recipientID string) error

RemoveRecipient removes the provided recipient. This has no impact on messages that have already been enqueued for transmission via SendMessage.

func (*Proxy) ScanRecipientDir added in v0.0.2

func (p *Proxy) ScanRecipientDir() error

ScanRecipientDir looks for for PEM-encoded identities in the ReceipientDir and imports into the recipient Store.

func (*Proxy) SendKaetzchenRequest

func (p *Proxy) SendKaetzchenRequest(senderID, serviceID, providerID string, payload []byte, wantResponse bool) ([]byte, error)

SendKaetzchenRequest enqueues the payload for transmission from the sender to the service on the remote provider, and returns the message identifier tag.

Note: Replies are delivered as `event.KaetzchenReplyEvent`s, via the EventSink channel. It is on the caller to keep track of requests via the message identifier tag to correctly handle responses.

func (*Proxy) SendMessage

func (p *Proxy) SendMessage(senderID, recipientID string, payload []byte) ([]byte, error)

SendMessage enqueues payload for transmission from the sender to the recipient (account IDs), and returns he message identifier tag. The payload MUST be a well formed IMF message.

Any delivery failures after the message has been successfully enqueued will result in a delivery status notification message being sent from the postmaster to the senderID account.

func (*Proxy) SetRecipient

func (p *Proxy) SetRecipient(recipientID string, publicKey *ecdh.PublicKey) error

SetRecipient sets the public key for the provided recipient.

func (*Proxy) Shutdown

func (p *Proxy) Shutdown()

Shutdown cleanly shuts down a given Proxy instance.

func (*Proxy) Wait

func (p *Proxy) Wait()

Wait waits till the Proxy is terminated for any reason.

Directories

Path Synopsis
Package config implements the configuration for the Katzenpost client mail proxy.
Package config implements the configuration for the Katzenpost client mail proxy.
Package event implements the event types returned by the API's event listener.
Package event implements the event types returned by the API's event listener.
internal
account
Package account implements the provider account backend.
Package account implements the provider account backend.
authority
Package authority implements the generic PKI backend.
Package authority implements the generic PKI backend.
glue
Package glue implements the internal interfaces used to glue the various mailproxy components together.
Package glue implements the internal interfaces used to glue the various mailproxy components together.
imf
Package imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.
Package imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.
pkiclient
Package pkiclient implements a caching wrapper around core/pki.Client.
Package pkiclient implements a caching wrapper around core/pki.Client.
pop3
Package pop3 implements a minimal POP3 server, mostly intended to be ran over the loopback interface.
Package pop3 implements a minimal POP3 server, mostly intended to be ran over the loopback interface.
proxy
Package proxy implements the support for an upstream (outgoing) proxy.
Package proxy implements the support for an upstream (outgoing) proxy.
recipient
Package recipient implements the recipient public key store.
Package recipient implements the recipient public key store.

Jump to

Keyboard shortcuts

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