blob: 384bf98cd352ce1783e4a1b65a2ded60160dd7f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
{
inputs.opendmarc = {
path = "../../opendmarc";
type = "path";
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
description = "Private configuration for opendmarc";
outputs = { self, nixpkgs, opendmarc }:
let
cfg = name': { config, lib, pkgs, name, ... }: lib.mkIf (name == name') {
users.users."${config.services.opendmarc.user}".extraGroups = [ "keys" ];
systemd.services.opendmarc.serviceConfig.Slice = "mail.slice";
services.opendmarc = {
enable = true;
socket = "local:${config.myServices.mail.milters.sockets.opendmarc}";
configFile = pkgs.writeText "opendmarc.conf" ''
AuthservID HOSTNAME
FailureReports false
FailureReportsBcc postmaster@immae.eu
FailureReportsOnNone true
FailureReportsSentBy postmaster@immae.eu
IgnoreAuthenticatedClients true
IgnoreHosts ${config.secrets.fullPaths."opendmarc/ignore.hosts"}
SoftwareHeader true
SPFIgnoreResults true
SPFSelfValidate true
UMask 002
'';
group = config.services.postfix.group;
};
services.filesWatcher.opendmarc = {
restart = true;
paths = [
config.secrets.fullPaths."opendmarc/ignore.hosts"
];
};
secrets.keys = [
{
dest = "opendmarc/ignore.hosts";
user = config.services.opendmarc.user;
group = config.services.opendmarc.group;
permissions = "0400";
text = let
mxes = lib.attrsets.filterAttrs
(n: v: v.mx.enable)
config.myEnv.servers;
in
builtins.concatStringsSep "\n" ([
config.myEnv.mail.dmarc.ignore_hosts
] ++ lib.mapAttrsToList (n: v: v.fqdn) mxes);
}
];
};
in
opendmarc.outputs //
{ nixosModules = opendmarc.nixosModules or {} // nixpkgs.lib.genAttrs ["eldiron" "backup-2"] cfg; };
}
|