Merge branch 'master' of github.com:r-raymond/nixos-mailserver

This commit is contained in:
Robin Raymond 2017-12-21 11:52:15 +01:00
commit 129e36c5e6
3 changed files with 47 additions and 6 deletions

View file

@ -5,7 +5,7 @@
## Stable Releases ## Stable Releases
* [SNM v2.0.2](https://github.com/r-raymond/nixos-mailserver/releases/v2.0.2) * [SNM v2.0.4](https://github.com/r-raymond/nixos-mailserver/releases/v2.0.4)
[Latest Release (Candidate)](https://github.com/r-raymond/nixos-mailserver/releases/latest) [Latest Release (Candidate)](https://github.com/r-raymond/nixos-mailserver/releases/latest)
@ -46,11 +46,12 @@ D9FE 4119 F082 6F15 93BD BD36 6162 DBA5 635E A16A
* Sieves * Sieves
- [x] A simple standard script that moves spam - [x] A simple standard script that moves spam
- [x] Allow user defined sieve scripts - [x] Allow user defined sieve scripts
* User Aliases
- [x] Regular aliases
- [x] Catch all aliases
### In the future ### In the future
* User Aliases
- [ ] More complete alias support (Differentiate between forwarding addresses and sending aliases)
* DKIM Signing * DKIM Signing
- [ ] Allow a per domain selector - [ ] Allow a per domain selector
@ -123,7 +124,7 @@ common ones.
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [
(builtins.fetchTarball "https://github.com/r-raymond/nixos-mailserver/archive/v2.0.2.tar.gz") (builtins.fetchTarball "https://github.com/r-raymond/nixos-mailserver/archive/v2.0.4.tar.gz")
]; ];
mailserver = { mailserver = {
@ -141,6 +142,13 @@ common ones.
"postmaster@example.com" "postmaster@example.com"
"postmaster@example2.com" "postmaster@example2.com"
]; ];
# Make this user the catchAll address for domains example.com and
# example2.com
catchAll = [
"example.com"
"example2.com"
];
}; };
"user2@example.com" = { ... }; "user2@example.com" = { ... };

View file

@ -26,7 +26,7 @@ let
valiases_postfix = lib.flatten (lib.mapAttrsToList valiases_postfix = lib.flatten (lib.mapAttrsToList
(name: value: (name: value:
let to = name; let to = name;
in map (from: "${from} ${to}") value.aliases) in map (from: "${from} ${to}") (value.aliases ++ lib.singleton name))
cfg.loginAccounts); cfg.loginAccounts);
# catchAllPostfix :: [ String ] # catchAllPostfix :: [ String ]

View file

@ -48,7 +48,9 @@ import <nixpkgs/nixos/tests/make-test.nix> {
}; };
client = { config, pkgs, ... }: client = { config, pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ fetchmail msmtp procmail ]; environment.systemPackages = with pkgs; [
fetchmail msmtp procmail findutils
];
}; };
}; };
@ -88,6 +90,13 @@ import <nixpkgs/nixos/tests/make-test.nix> {
from chuck\@example.com from chuck\@example.com
user user2\@example.com user user2\@example.com
password user2 password user2
account test4
host SERVER
port 587
from postmaster\@example.com
user user1\@example.com
password user1
''; '';
email1 = email1 =
'' ''
@ -117,6 +126,20 @@ import <nixpkgs/nixos/tests/make-test.nix> {
XOXO User1 XOXO User1
''; '';
email3 =
''
From: Postmaster <postmaster@example.com>
To: Chuck <chuck@example.com>
Cc:
Bcc:
Subject: This is a test Email from postmaster\@example.com to chuck
Reply-To:
Hello Chuck,
I think I may have misconfigured the mail server
XOXO Postmaster
'';
in in
'' ''
startAll; startAll;
@ -196,6 +219,16 @@ import <nixpkgs/nixos/tests/make-test.nix> {
$client->succeed("sleep 5"); $client->succeed("sleep 5");
# fetchmail returns EXIT_CODE 0 when it retrieves mail # fetchmail returns EXIT_CODE 0 when it retrieves mail
$client->succeed("fetchmail -v"); $client->succeed("fetchmail -v");
$client->succeed("rm ~/mail/*");
$client->succeed("rm mail.txt");
$client->succeed("echo '${email2}' > mail.txt");
# send email from user1 to chuck
$client->succeed("msmtp -a test4 --tls=on --tls-certcheck=off --auth=on chuck\@example.com < mail.txt >&2");
$client->succeed("sleep 5");
# fetchmail returns EXIT_CODE 1 when no new mail
# if this succeeds, it means that user1 recieved the mail that was intended for chuck.
$client->fail("fetchmail -v");
}; };