cluster/services/dns: put coredns in front of powerdns
This commit is contained in:
parent
59795e6fb1
commit
2a5094c284
1 changed files with 26 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
||||||
{ cluster, config, hosts, lib, ... }:
|
{ cluster, config, hosts, lib, tools, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (hosts.${config.networking.hostName}) interfaces;
|
inherit (hosts.${config.networking.hostName}) interfaces;
|
||||||
|
inherit (tools.meta) domain;
|
||||||
|
|
||||||
patroni = cluster.config.links.patroni-pg-access;
|
patroni = cluster.config.links.patroni-pg-access;
|
||||||
|
|
||||||
|
@ -9,6 +10,8 @@ let
|
||||||
configList = lib.mapAttrsToList (n: v: "${n}=${v}") cfg;
|
configList = lib.mapAttrsToList (n: v: "${n}=${v}") cfg;
|
||||||
in lib.concatStringsSep "\n" configList;
|
in lib.concatStringsSep "\n" configList;
|
||||||
in {
|
in {
|
||||||
|
links.localAuthoritativeDNS = {};
|
||||||
|
|
||||||
age.secrets = {
|
age.secrets = {
|
||||||
pdns-db-credentials = {
|
pdns-db-credentials = {
|
||||||
file = ./pdns-db-credentials.age;
|
file = ./pdns-db-credentials.age;
|
||||||
|
@ -27,7 +30,7 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraConfig = translateConfig {
|
extraConfig = translateConfig {
|
||||||
launch = "gpgsql";
|
launch = "gpgsql";
|
||||||
local-address = interfaces.primary.addr;
|
local-address = config.links.localAuthoritativeDNS.tuple;
|
||||||
gpgsql-host = patroni.ipv4;
|
gpgsql-host = patroni.ipv4;
|
||||||
gpgsql-port = patroni.portStr;
|
gpgsql-port = patroni.portStr;
|
||||||
gpgsql-dbname = "powerdns";
|
gpgsql-dbname = "powerdns";
|
||||||
|
@ -36,4 +39,25 @@ in {
|
||||||
version-string = "Private Void DNS";
|
version-string = "Private Void DNS";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.coredns = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
. {
|
||||||
|
bind ${interfaces.primary.addr}
|
||||||
|
chaos "Private Void DNS" info@privatevoid.net
|
||||||
|
cache {
|
||||||
|
success 4000 86400
|
||||||
|
denial 0
|
||||||
|
prefetch 3
|
||||||
|
serve_stale 86400s
|
||||||
|
}
|
||||||
|
forward . ${config.links.localAuthoritativeDNS.tuple}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.coredns = {
|
||||||
|
after = [ "pdns.service" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue