emersion / neutron

Self-hosted server for the ProtonMail client
MIT License
512 stars 41 forks source link
imap mail protonmail smtp webmail

neutron

Build Status GoDoc

Self-hosted server for Protonmail client.

This project is not affiliated or supported by ProtonMail.

What is it?

Neutron is a server that will allow the ProtonMail client to be used with backends. Several backends are available right now:

Neutron is modular so it's easy to create new backends and handle more scenarios.

Keep in mind that Neutron is less secure than ProtonMail: most servers don't use full-disk encryption and aren't under 1,000 meters of granite rock in Switzerland. Also, SRP is not yet supported (#35). If you use Neutron, make sure to donate to ProtonMail!

Install

Configuration

See config.json. You'll have to change IMAP and SMTP settings to match your mail server config.

{
    "Memory": {
        "Enabled": true,
        "Populate": false, // Populate server with default neutron user
        "Domains": ["emersion.fr"] // Available e-mail domains
    },
    "Imap": { // IMAP server config
        "Enabled": true,
        "Hostname": "mail.gandi.net",
        "Tls": true,
        "Suffix": "@emersion.fr" // Will be appended to username when authenticating
    },
    "Smtp": { // SMTP server config
        "Enabled": true,
        "Hostname": "mail.gandi.net",
        "Port": 587,
        "Suffix": "@emersion.fr" // Will be appended to username when authenticating
    },
    "Disk": { // Store keys, contacts and settings on disk
        "Enabled": true,
        "Keys": { "Directory": "db/keys" }, // PGP keys location
        "Contacts": { "Directory": "db/contacts" },
        "UsersSettings": { "Directory": "db/settings" },
        "Addresses": { "Directory": "db/addresses" }
    }
}

Usage

To generate keys for a new user the first time, just click Sign up on the login page and enter your IMAP credentials.

Options

Build

Requirements:

# Get the code
go get -u github.com/emersion/neutron
cd $GOPATH/src/github.com/emersion/neutron

# Build the client
git submodule init
git submodule update
make build-client

# Start the server
make start

Docker

make build-docker
docker build -t neutron .
docker create -p 4000:4000 -v $PWD/config.json:/config.json -v $PWD/db:/db neutron

Backends

All backends must implement the backend interface. The main backend interface is split into multiple other backend interfaces for different roles: ContactsBackend, LabelsBackend and so on. This allows to build modular backends, e.g. a MessagesBackend which stores messages on an IMAP server with a ContactsBackend which stores contacts on a LDAP server and a SendBackend which sends outgoing messages to a SMTP server.

Writing a backend is just a matter of implementing the necessary functions. You can read the memory backend to understand how to do that. Docs for the backend are available here: https://godoc.org/github.com/emersion/neutron/backend#Backend

License

MIT