maxwell/nameserver.nix

69 lines
1.9 KiB
Nix
Raw Normal View History

2023-08-15 16:21:59 +02:00
{ config, lib, ... }:
2020-10-20 01:11:28 +02:00
# Setup:
# PDNS recursor on port 53
2023-08-15 16:21:59 +02:00
# DNSCrypt wrapper on port 5353
2020-10-20 01:11:28 +02:00
# NCDNS for Namecoin bit. zone resolution
2023-08-15 16:21:59 +02:00
# sslh handling both HTTP and DSN on 443
2020-10-20 01:11:28 +02:00
{
# Recursive DNS resolver
2023-08-15 16:21:59 +02:00
services.pdns-recursor =
{ enable = true;
# Configures the bit. zone
resolveNamecoin = true;
# Use both IPv4 and IPv6
dns.allowFrom = [ "0.0.0.0/0" "::0/0" ];
settings.local-address = [ "0.0.0.0" "::" ];
};
2020-10-20 01:11:28 +02:00
2024-02-25 18:58:01 +01:00
# Wrap the local recursive resolver in DNSCrypt
2023-08-15 16:21:59 +02:00
services.dnscrypt-wrapper =
{ enable = true;
address = "[::]";
providerKey.public = config.secrets.dnscrypt.pub;
providerKey.secret = config.secrets.dnscrypt.sec;
};
# Demultiplex HTTP and DNS from port 443
services.sslh =
{ enable = true;
method = "ev";
settings.transparent = true;
settings.listen = with config.var; lib.mkForce
[ { host = hostname; port = "443"; is_udp = false; }
{ host = hostname; port = "443"; is_udp = true; }
];
settings.protocols =
[ # Send TLS to nginx (TCP)
2024-02-25 18:58:01 +01:00
{ name = "tls"; host = "localhost"; port= "443"; }
2023-08-15 16:21:59 +02:00
# Send DNSCrypt to dnscrypt-wrapper (TCP or UDP)
{ name = "anyprot"; host = "localhost"; port = "5353"; }
2024-02-25 18:58:01 +01:00
{ name = "anyprot"; host = "localhost"; port = "5353"; is_udp = true; }
2023-08-15 16:21:59 +02:00
];
};
# This is needed for the rotation of DNSCrypt keys
security.polkit.enable = true;
2020-10-20 01:11:28 +02:00
# Namecoin resolver
2023-08-15 16:21:59 +02:00
services.ncdns =
{ enable = true;
# This is currently broken, see ncdns issue:
# https://github.com/namecoin/ncdns/issues/127
dnssec.enable = false;
};
2020-10-20 01:11:28 +02:00
# Namecoin daemon with RPC server
2023-08-15 16:21:59 +02:00
services.namecoind =
{ enable = true;
# This are used by the resolver (ncdns)
# to query the blockchain.
rpc.user = config.secrets.namecoin.user;
rpc.password = config.secrets.namecoin.password;
};
2020-10-20 01:11:28 +02:00
2021-12-21 00:31:25 +01:00
users.users.namecoin.group = "namecoin";
2020-10-20 01:11:28 +02:00
}