working split dns config :3
This commit is contained in:
parent
f374e8bd1f
commit
df629af5ab
|
@ -1,18 +1,26 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
let
|
||||||
services.dnsmasq.enable = true;
|
adblockLocalZones = pkgs.stdenv.mkDerivation {
|
||||||
services.dnsmasq.extraConfig = ''
|
name = "unbound-zones-adblock";
|
||||||
domain-needed
|
|
||||||
no-resolv
|
src = (pkgs.fetchFromGitHub
|
||||||
local=/lan/
|
{
|
||||||
local=/moss/
|
owner = "StevenBlack";
|
||||||
cache-size=5000
|
repo = "hosts";
|
||||||
addn-hosts=/etc/adblock.hosts
|
rev = "3.12.21";
|
||||||
''; # TODO find a way to make adblock hosts reproducible and updateable
|
sha256 = "Yzr6PY/zqQE+AHH0J6ioHTsgkikM+dz4aelbGpQJa1s=";
|
||||||
services.dnsmasq.servers = [ "45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8" ];
|
} + "/hosts");
|
||||||
# TODO use this list in mossnet-hosts
|
|
||||||
networking.hosts = {
|
phases = [ "installPhase" ];
|
||||||
"192.168.1.240" = [
|
|
||||||
|
installPhase = ''
|
||||||
|
${pkgs.gawk}/bin/awk '{sub(/\r$/,"")} {sub(/^127\.0\.0\.1/,"0.0.0.0")} BEGIN { OFS = "" } NF == 2 && $1 == "0.0.0.0" { print "local-zone: \"", $2, "\" static"}' $src | tr '[:upper:]' '[:lower:]' | sort -u > $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
mossnet = "192.168.1.240"; # The local lan-ip for box
|
||||||
|
wg-mossnet = "10.0.69.4"; # The wireguard ip for box
|
||||||
|
mossnet-hosts = [
|
||||||
"mossnet.lan"
|
"mossnet.lan"
|
||||||
"links.mossnet.lan"
|
"links.mossnet.lan"
|
||||||
"read.mossnet.lan"
|
"read.mossnet.lan"
|
||||||
|
@ -29,10 +37,40 @@
|
||||||
"tracks.mossnet.lan"
|
"tracks.mossnet.lan"
|
||||||
"grasp.mossnet.lan"
|
"grasp.mossnet.lan"
|
||||||
];
|
];
|
||||||
"192.168.1.226" = [
|
in
|
||||||
"df-web.lan"
|
{
|
||||||
];
|
services.unbound = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
include = "${adblockLocalZones}";
|
||||||
|
interface = [ "0.0.0.0" ];
|
||||||
|
access-control = [ "127.0.0.0/24 allow" "192.168.0.0/24 allow" "10.0.69.0/24 allow" ];
|
||||||
|
access-control-view = "10.0.69.0/24 wireguard";
|
||||||
|
local-zone = ''"mossnet.lan." redirect'';
|
||||||
|
local-data = ''"mossnet.lan. IN A ${mossnet}"'';
|
||||||
};
|
};
|
||||||
|
forward-zone = [{
|
||||||
|
name = ".";
|
||||||
|
forward-addr = [ "45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8" ];
|
||||||
|
}];
|
||||||
|
view = {
|
||||||
|
name = "wireguard";
|
||||||
|
local-zone = ''"mossnet.lan." redirect'';
|
||||||
|
local-data = ''"mossnet.lan. IN A ${wg-mossnet}"'';
|
||||||
|
};
|
||||||
|
do-not-query-localhost = "no";
|
||||||
|
# Eventually we'll add DNSSEC / DoT
|
||||||
|
# so-reuseport: yes
|
||||||
|
# tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
|
||||||
|
# tls-upstream: yes
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# With unbound we're doing wildcard redirects, so we don't need that anymore
|
||||||
|
# networking.hosts = {
|
||||||
|
# mossnet = mossnet-hosts;
|
||||||
|
# };
|
||||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue