-{ pkgs, lib, config, machines, ... }:
+{ inputs, pkgs, lib, config, machines, ... }:
let
domain = "autogeree.net";
domainID = lib.replaceStrings ["."] ["_"] domain;
inherit (builtins) attrValues;
- inherit (builtins.extraBuiltins) git;
inherit (config) networking;
+ inherit (config.security) gnupg;
inherit (config.services) knot;
- inherit (config.security) pass;
- inherit (config.users) users groups;
- # Use the Git commit time of the ${domain}.nix file to set the serial number.
- # WARNING: the ${domain}.nix must be committed into Git for this to work.
- # WARNING: this does not take other .nix into account, though they may contribute to the zone's data.
- serial = domain: toString (git ./. [ "log" "-1" "--format=%ct" "--" (domain + ".nix") ]);
+ inherit (config.users) users;
in
{
services.knot.zones."${domain}" = {
action: update
update-owner: name
update-owner-match: equal
- update-owner-name: [_acme-challenge.${domain}]
+ update-owner-name: [_acme-challenge]
update-type: [TXT]
- id: acl_tsig_acme_${domainID}
- address: ${machines.losurdo.extraArgs.ipv4}
key: acme_${domainID}
action: update
update-owner: name
update-owner-match: equal
- update-owner-name: [_acme-challenge.${domain}]
+ update-owner-name: [_acme-challenge]
update-type: [TXT]
zone:
$TTL 500
; SOA (Start Of Authority)
- @ SOA ns admin (
- ${serial domain} ; Serial number
+ @ SOA ns root (
+ ${toString inputs.self.lastModified} ; Serial number
24h ; Refresh
15m ; Retry
1000h ; Expire (1000h)
@ CAA 128 issue "letsencrypt.org"
'';
};
+users.groups.keys.members = [ users.knot.name ];
services.knot = {
- keyFiles = [ pass.secrets."knot/tsig/${domain}/acme.conf".path ];
+ keyFiles = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".path ];
};
-security.pass.secrets."knot/tsig/${domain}/acme.conf" = {
+security.gnupg.secrets."knot/tsig/${domain}/acme.conf" = {
# Generated with: keymgr -t acme_${domainID}
user = users.knot.name;
};
systemd.services.knot = {
- after = [ pass.secrets."knot/tsig/${domain}/acme.conf".service ];
- wants = [ pass.secrets."knot/tsig/${domain}/acme.conf".service ];
+ after = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
+ wants = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
};
/* Useless since the zone is public
services.unbound.extraConfig = ''