pluto

command module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: GPL-3.0 Imports: 6 Imported by: 0

README

Pluto

GoDoc Build Status Go Report Card codecov

Pluto is a distributed IMAP server that implements a subset of the IMAPv4 standard. It makes use of Conflict-free Replicated Data Types to allow state to be kept on each worker node but still achieve system-wide convergence of user data. Pluto is written in Go.

Status

Work in progress: This is the code base for my Bachelor Thesis. It is heavily work in progress and not ready yet.

Installation

If you have a working Go setup, installation is as easy as:

 $ go get github.com/numbleroot/pluto

Setup

Quick Setup

If you know what happens in background, these are the steps to take in order to ready pluto for use:

 $ cp config.toml.example config.toml            # Use example file as basis for your config file
 $ vim config.toml                               # Adjust config to your setup and needs
 $ make prod                                     # Executes clean, deps, pki and build target
 $ scp pluto-and-private-bundle <other nodes>    # Distribute pluto binary to other network nodes
 $ ./pluto -storage                              # On node 'storage'
 $ ./pluto -worker worker-1                      # On node 'worker-1'
 $ ./pluto -worker worker-2                      # On node 'worker-2'
 $ ./pluto -worker worker-$ID                    # Repeat this on all remaining worker nodes
 $ ./pluto -distributor                          # On node 'distributor'

Now you should be able to access your IMAP server from the Internet under configured IP.

These steps conceal the involved processes behind, if you are interested in them, read on.

Detailed Setup
Configuration

You need to configure your pluto setup in a config.toml file. Please refer to the provided config.toml.example for an exemplary configuration that only needs adaptation to your requirements.

Important: Please make sure, not to include | (pipe character) in names for your distributor, worker and storage nodes as this character is used in marshalled messages sent on internal network.

User authentication
PostgreSQL

If you plan on using a PostgreSQL database for storing the user authorization information, you need to have a PostgreSQL running somewhere. If you need a new user that owns the database, you might use these commands on the PostgreSQL host:

user@system $ sudo -i -u postgres
postgres@system $ createuser --encrypted --pwprompt --createdb --no-createrole --no-superuser pluto
Enter password for new role:
Enter it again:
postgres@system $ exit

After that, you can create a new database pluto to hold the user information like so:

user@system $ createdb -U pluto pluto
File based (for testing purposes)
Certificates

There are multiple certificates needed in order to operate a pluto setup. Fortunately, you only have to provide one certificate that is valid for normal use in e.g. webservers. The other required certificates are used for internal communications among pluto's nodes and will be generated by a simple Makefile command.

So first, you need to provide a valid public TLS certificate that the distributor node can present to Internet-faced connections. It is recommended that you obtain a certificate signed by a Certificate Authority (CA) that is accepted by most clients by default, e.g. Let's Encrypt. For testing though, you can use the provided test-public target with make to generate a self-signed certificate, i.e.:

$ make test-public

This will generate one certificate that is valid for 90 day. The target basically performs the following steps and makes use of this script to generate the certificates:

$ if [ ! -d "private" ]; then mkdir private; fi
$ chmod 0700 private
$ wget https://raw.githubusercontent.com/golang/go/master/src/crypto/tls/generate_cert.go
$ go build generate_cert.go
$ ./generate_cert -ca -duration 2160h -host localhost,127.0.0.1,::1 -rsa-bits 1024
$ mv cert.pem private/public-distributor-cert.pem && mv key.pem private/public-distributor-key.pem
$ go clean
$ rm -f generate_cert.go

Please keep in mind that the certificate generated via this command really only is to be used for testing, never in production mode. It is self-signed for localhost addresses and only of 1024 bits key length which should not be used in production anymore today.

The remaining required certificates, the mentioned internal ones, can simply be generated by running:

$ make pki

Acknowledgments

License

This project is GPLv3 licensed.

Documentation

Overview

Pluto is a distributed IMAPv4 server based on Conflict-free Replicated Data Types.

Directories

Path Synopsis
Package auth defines potentially multiple mechanisms to determine whether supplied user credentials via an IMAP session can be found in a defined user information system.
Package auth defines potentially multiple mechanisms to determine whether supplied user credentials via an IMAP session can be found in a defined user information system.
Package comm implements network communication that is reliable and causally-ordered to a group of nodes and respective receiving parts.
Package comm implements network communication that is reliable and causally-ordered to a group of nodes and respective receiving parts.
Package config provides functions to read in various configuration files into definded types.
Package config provides functions to read in various configuration files into definded types.
Package crdt implements the needed operation-based observed-removed set (ORSet) structure upon that the CmRDT parts of pluto are built.
Package crdt implements the needed operation-based observed-removed set (ORSet) structure upon that the CmRDT parts of pluto are built.
Package crypto provides the basis for secure communication in pluto.
Package crypto provides the basis for secure communication in pluto.
Package imap implements all three node types a pluto setup consists of: a distributor node, multiple worker nodes and a storage node.
Package imap implements all three node types a pluto setup consists of: a distributor node, multiple worker nodes and a storage node.
Package utils provides smaller and independent helper functions which are needed at various places throughout the code base.
Package utils provides smaller and independent helper functions which are needed at various places throughout the code base.

Jump to

Keyboard shortcuts

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