From 6e8142862f23ab99e1cc57838c02b733361e8d50 Mon Sep 17 00:00:00 2001 From: Lionello Lunesu Date: Sun, 24 Oct 2021 15:46:44 -0700 Subject: [PATCH] opendkim: don't recreate keys if private key is present --- mail-server/opendkim.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mail-server/opendkim.nix b/mail-server/opendkim.nix index 3dd7d57..27df835 100644 --- a/mail-server/opendkim.nix +++ b/mail-server/opendkim.nix @@ -29,7 +29,7 @@ let dkim_txt = "${cfg.dkimKeyDirectory}/${dom}.${cfg.dkimSelector}.txt"; in '' - if [ ! -f "${dkim_key}" ] || [ ! -f "${dkim_txt}" ] + if [ ! -f "${dkim_key}" ] then ${pkgs.opendkim}/bin/opendkim-genkey -s "${cfg.dkimSelector}" \ -d "${dom}" \ @@ -42,10 +42,10 @@ let ''; createAllCerts = lib.concatStringsSep "\n" (map createDomainDkimCert cfg.domains); - keyTable = pkgs.writeText "opendkim-KeyTable" - (lib.concatStringsSep "\n" (lib.flip map cfg.domains + keyTable = pkgs.writeText "opendkim-KeyTable" + (lib.concatStringsSep "\n" (lib.flip map cfg.domains (dom: "${dom} ${dom}:${cfg.dkimSelector}:${cfg.dkimKeyDirectory}/${dom}.${cfg.dkimSelector}.key"))); - signingTable = pkgs.writeText "opendkim-SigningTable" + signingTable = pkgs.writeText "opendkim-SigningTable" (lib.concatStringsSep "\n" (lib.flip map cfg.domains (dom: "${dom} ${dom}"))); dkim = config.services.opendkim;