1 { pkgs, lib, config, credentials, host, ... }:
3 domain = "i.sourcephile.fr";
5 gwIface = config.networking.defaultGateway.interface;
8 systemd.services.iodined.serviceConfig.LoadCredentialEncrypted = "password:${credentials}/iodine/password.secret";
9 systemd.sockets.iodined = {
11 listenDatagrams = [ "127.0.0.1:1053" ];
12 socketConfig.BindToDevice = "lo";
13 socketConfig.ReusePort = true;
14 wantedBy = [ "sockets.target" ];
16 services.iodine.server = {
19 passwordFile = "$CREDENTIALS_DIRECTORY/password";
21 extraConfig = "-4 -c -d ${dnsIface} -i 1800 -n ${host.ipv4}";
23 boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
24 networking.nftables.ruleset = ''
27 iifname ${dnsIface} udp dport domain counter accept comment "unbound: DNS"
30 iifname ${dnsIface} oifname ${gwIface} counter accept
31 iifname ${gwIface} oifname ${dnsIface} counter accept
36 iifname ${dnsIface} oifname ${gwIface} masquerade
40 services.unbound.settings.server = {
41 interface = [ "10.53.53.1" ];
42 access-control = [ "10.53.53.0/24 allow" ];