Define key tables
This commit is contained in:
parent
8b87a338e3
commit
8adf30eb96
12
dkim.nix
12
dkim.nix
|
@ -20,8 +20,8 @@ let
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ensureAllDkimCerts = keyDir:
|
ensureAllDkimCerts = keyDir: domains:
|
||||||
domains concatStringsSep "\n" (map (ensureDomainDkimCert keyDir) domains);
|
concatStringsSep "\n" (map (ensureDomainDkimCert keyDir) domains);
|
||||||
|
|
||||||
makeKeyTable = keyDir: domains:
|
makeKeyTable = keyDir: domains:
|
||||||
pkgs.writeText "opendkim-key-table" (concatStringsSep "\n"
|
pkgs.writeText "opendkim-key-table" (concatStringsSep "\n"
|
||||||
|
@ -73,6 +73,8 @@ in {
|
||||||
SyslogSuccess yes
|
SyslogSuccess yes
|
||||||
LogWhy yes
|
LogWhy yes
|
||||||
'';
|
'';
|
||||||
|
keyTable = makeKeyTable cfg.state-directory cfg.domains;
|
||||||
|
signingTable = makeSigningTable cfg.domains;
|
||||||
in pkgs.writeText "opendkim.conf" ''
|
in pkgs.writeText "opendkim.conf" ''
|
||||||
Canonicalization relaxed/simple
|
Canonicalization relaxed/simple
|
||||||
Socket inet:${toString cfg.port}
|
Socket inet:${toString cfg.port}
|
||||||
|
@ -88,7 +90,11 @@ in {
|
||||||
group = config.services.opendkim.group;
|
group = config.services.opendkim.group;
|
||||||
in [ "d ${cfg.state-directory} 0700 ${user} ${group} - -" ];
|
in [ "d ${cfg.state-directory} 0700 ${user} ${group} - -" ];
|
||||||
services.opendkim = {
|
services.opendkim = {
|
||||||
serviceConfig.ReadWritePaths = [ cfg.state-directory ];
|
serviceConfig = {
|
||||||
|
ExecStartPre = pkgs.writeShellScript "ensure-dkim-certs.sh"
|
||||||
|
(ensureAllDkimCerts cfg.state-directory cfg.domains);
|
||||||
|
ReadWritePaths = [ cfg.state-directory ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue