Go to file
Robin Raymond 6c50206165
move setup guide to wiki
2018-02-28 13:57:08 +01:00
logo add logo 2017-09-13 14:03:04 +02:00
mail-server Merge branch 'v2.1-bugfixes' 2018-02-23 15:37:09 +01:00
nixops Fix syntax error in sample nixops config 2017-11-11 09:53:35 +00:00
tests fix tests 2018-02-18 12:57:06 +01:00
.editorconfig Remove makefile section from editorconfig 2017-11-11 09:47:25 +00:00
.gitignore add gitignore file for result links 2017-12-21 11:55:22 +01:00
.travis.yml ci: don't test on unstable to avoid timeout 2018-02-21 11:03:17 +10:30
ISSUE_TEMPLATE.md Update ISSUE_TEMPLATE.md 2018-02-23 16:29:22 +01:00
LICENSE Initial commit 2016-07-21 18:09:04 +02:00
README.md move setup guide to wiki 2018-02-28 13:57:08 +01:00
default.nix fix typo from merge 2018-02-22 23:08:52 +01:00
update.sh add updater script 2017-12-21 11:52:07 +01:00

README.md

Simple Nixos MailServer

license status

Stable Releases

Latest Release (Candidate)

Subscribe to SNM Announcement List This is a very low volume list where new releases of SNM are announced, so you can stay up to date with bug fixes and updates. All announcements are signed by the gpg key with fingerprint

D9FE 4119 F082 6F15 93BD  BD36 6162 DBA5 635E A16A

Features

v2.0

  • Continous Integration Testing
  • Multiple Domains
  • Postfix MTA
    • smtp on port 25
    • submission port 587
    • lmtp with dovecot
  • Dovecot
    • maildir folders
    • imap starttls on port 143
    • pop3 starttls on port 110
  • Certificates
    • manual certificates
    • on the fly creation
    • Let's Encrypt
  • Spam Filtering
    • via rspamd
  • Virus Scanning
    • via clamav
  • DKIM Signing
    • via opendkim
  • User Management
    • declarative user management
    • declarative password management
  • Sieves
    • A simple standard script that moves spam
    • Allow user defined sieve scripts
    • ManageSieve support
  • User Aliases
    • Regular aliases
    • Catch all aliases

In the future

  • DKIM Signing
    • Allow a per domain selector

Changelog

v1.0 -> v1.1

  • Changed structure to Nix Modules
  • Adds Sieve support

v1.1 -> v2.0

  • rename domain to fqdn, seperate fqdn from domains
  • multi domain support

Quick Start

{ config, pkgs, ... }:
{
  imports = [
    (builtins.fetchTarball "https://github.com/r-raymond/nixos-mailserver/archive/v2.1.3.tar.gz")
  ];

  mailserver = {
    enable = true;
    fqdn = "mail.example.com";
    domains = [ "example.com" "example2.com" ];
    loginAccounts = {
        "user1@example.com" = {
            hashedPassword = "$6$/z4n8AQl6K$kiOkBTWlZfBd7PvF5GsJ8PmPgdZsFGN1jPGZufxxr60PoR0oUsrvzm2oQiflyz5ir9fFJ.d/zKm/NgLXNUsNX/";

            aliases = [
                "info@example.com"
                "postmaster@example.com"
                "postmaster@example2.com"
            ];
        };
    };
  };
}

For a complete list of options, see default.nix.

How to Set Up a 10/10 Mail Server Guide

Check out the Complete Setup Guide in the project's wiki.

How to Backup

This is really easy. First off you should have a backup of your configuration.nix file where you have the server config (but that is already in a git repository right?)

Next you need to backup /var/vmail or whatever you have specified for the option mailDirectory. This is where all the mails reside. Good options are a cron job with rsync or scp. But really anything works, as it is simply a folder with plenty of files in it. If your backup solution does not preserve the owner of the files don't forget to chown them to virtualMail:virtualMail if you copy them back (or whatever you specified as vmailUserName, and vmailGoupName).

Finally you can (optionally) make a backup of /var/dkim (or whatever you specified as dkimKeyDirectory). If you should lose those don't worry, new ones will be created on the fly. But you will need to repeat step B)5 and correct all the dkim keys.

How to Test for Development

You can test the setup via nixops. After installation, do

nixops create nixops/single-server.nix nixops/vbox.nix -d mail
nixops deploy -d mail
nixops info -d mail

You can then test the server via e.g. telnet. To log into it, use

nixops ssh -d mail mailserver

To test imap manually use

openssl s_client -host mail.example.com -port 143 -starttls imap

A Complete Mail Server Without Moving Parts

Used Technologies

  • Nixos
  • Nixpkgs
  • Dovecot
  • Postfix
  • Rmilter
  • Rspamd
  • Clamav
  • Opendkim
  • Pam

Features

  • unlimited domain
  • unlimited mail accounts
  • unlimited aliases for every mail account
  • spam and virus checking
  • dkim signing of outgoing emails
  • imap (optionally pop3)
  • startTLS

Nonfeatures

  • moving parts
  • SQL databases
  • configurations that need to be made after nixos-rebuild switch
  • complicated storage schemes
  • webclients / http-servers

Contributors

  • Special thanks to @Infinisil for the module rewrite
  • Special thanks to @jbboehr for multidomain implementation
  • @danbst
  • @phdoerfler
  • @eqyiel

Alternative Implementations

Credits