Lower TTLs to 1h

This commit is contained in:
nora 2024-07-27 12:44:34 +02:00
parent 63163a38d0
commit ea74393dcd
3 changed files with 23 additions and 15 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ pkgs, lib, ... }: {
# get the package for the debugging tools
environment.systemPackages = with pkgs; [ knot-dns ];
@ -29,10 +29,10 @@
zone:
- domain: noratrieb.dev
storage: /var/lib/knot/zones/
file: ${import ./noratrieb.dev.nix { inherit pkgs; }}
file: ${import ./noratrieb.dev.nix { inherit pkgs; inherit lib; }}
- domain: nilstrieb.dev
storage: /var/lib/knot/zones/
file: ${import ./nilstrieb.dev.nix { inherit pkgs; }}
file: ${import ./nilstrieb.dev.nix { inherit pkgs; inherit lib; }}
log:
- target: syslog
any: info

View file

@ -1,13 +1,17 @@
# https://github.com/nix-community/dns.nix
{ pkgs, ... }:
{ pkgs, lib, ... }:
let
data = with pkgs.nix-dns.lib.combinators;
let
dns1 = host "154.38.163.74" null;
dns2 = host "128.140.3.7" "2a01:4f8:c2c:d616::";
hour1 = 3600;
normalHost = ipv4: ipv6:
lib.optionalAttrs (ipv4 != null) { A = [ (ttl hour1 (a ipv4)) ]; } //
lib.optionalAttrs (ipv6 != null) { AAAA = [ (ttl hour1 (aaaa ipv6)) ]; };
dns1 = normalHost "154.38.163.74" null;
dns2 = normalHost "128.140.3.7" "2a01:4f8:c2c:d616::";
vps1 = host "161.97.165.1" null;
vps2 = host "184.174.32.252" null;
vps1 = normalHost "161.97.165.1" null;
vps2 = normalHost "184.174.32.252" null;
in
{
SOA = {
@ -26,14 +30,14 @@ let
"ns2.nilstrieb.dev"
];
A = [
A = map (ttl hour1) [
# GH Pages
(a "185.199.108.153")
(a "185.199.109.153")
(a "185.199.110.153")
(a "185.199.111.153")
];
AAAA = [
AAAA = map (ttl hour1) [
# GH Pages
(aaaa "2606:50c0:8002:0:0:0:0:153")
(aaaa "2606:50c0:8003:0:0:0:0:153")
@ -48,7 +52,7 @@ let
subdomains = {
www = vps2;
blog.CNAME = [ (cname "nilstrieb.github.io") ];
blog.CNAME = map (ttl hour1) [ (cname "nilstrieb.github.io") ];
# apps
bisect-rustc = vps2;

View file

@ -1,12 +1,16 @@
# https://github.com/nix-community/dns.nix
{ pkgs, ... }:
{ pkgs, lib, ... }:
let
data = with pkgs.nix-dns.lib.combinators;
let
dns1 = host "154.38.163.74" null;
dns2 = host "128.140.3.7" "2a01:4f8:c2c:d616::";
hour1 = 3600;
normalHost = ipv4: ipv6:
lib.optionalAttrs (ipv4 != null) { A = [ (ttl hour1 (a ipv4)) ]; } //
lib.optionalAttrs (ipv6 != null) { AAAA = [ (ttl hour1 (aaaa ipv6)) ]; };
dns1 = normalHost "154.38.163.74" null;
dns2 = normalHost "128.140.3.7" "2a01:4f8:c2c:d616::";
vps1 = host "161.97.165.1" null;
vps1 = normalHost "161.97.165.1" null;
in
# vps1 contains root noratrieb.dev
vps1 // {