64 lines
2.3 KiB
Markdown
64 lines
2.3 KiB
Markdown
# PVV-DNS
|
|
|
|
This repository contains both the code and data needed to generate PVVs DNS configuration.
|
|
|
|
> [!NOTE]
|
|
> This is currently very WIP, and not in production use. At the minute, DNS is still managed manually in /etc/bind/zones on ameno.
|
|
|
|
Normal PVV "hosts" (servers, mostly) should be defined in ./hosts.nix, and configuration and additional records can be placed in each zone configuration file in ./zones, such as ./zones/pvv.ntnu.no.nix.
|
|
|
|
The code in this repository is basically a whole heap of pre-processing to turn the hosts-file and zone-specific options into the format used by [nix-community/dns.nix](https://github.com/nix-community/dns.nix), that in turn generates zone files.
|
|
|
|
## Building DNS zone files
|
|
|
|
Provided you have nix on your system, you should be able to run `nix build .#`, and the resulting config is placed in `./result/zones`.
|
|
|
|
## Examples;
|
|
|
|
A host configuration like
|
|
|
|
```nix
|
|
drolsum = {
|
|
ipv4 = pvvv4 217;
|
|
ipv6 = pvvv6 217;
|
|
aliases = [ "login2" ];
|
|
};
|
|
|
|
roundrobin = {
|
|
ipv4 = [ (pvvv4 101) (pvvv4 202) ];
|
|
ipv6 = [ (pvvv6 101) (pvvv6 202) ];
|
|
};
|
|
|
|
```
|
|
|
|
... will generate zone files like
|
|
|
|
|
|
```bind
|
|
drolsum.pvv.ntnu.no. IN A 129.241.210.217
|
|
drolsum.pvv.ntnu.no. IN AAAA 2001:700:300:1900::217
|
|
login2.pvv.ntnu.no. IN CNAME drolsum
|
|
|
|
roundrobin.pvv.ntnu.no. IN A 129.241.210.201
|
|
roundrobin.pvv.ntnu.no. IN A 129.241.210.202
|
|
roundrobin.pvv.ntnu.no. IN AAAA 2001:700:300:1900::201
|
|
roundrobin.pvv.ntnu.no. IN AAAA 2001:700:300:1900::202
|
|
|
|
201.128-255.210.241.129.in-addr.arpa. PTR roundrobin.pvv.ntnu.no
|
|
202.128-255.210.241.129.in-addr.arpa. PTR roundrobin.pvv.ntnu.no
|
|
217.128-255.210.241.129.in-addr.arpa. PTR drolsum.pvv.ntnu.no
|
|
|
|
1.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.1.0.0.3.0.0.0.7.0.1.0.0.2.ip6.arpa PTR roundrobin.pvv.ntnu.no
|
|
2.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.1.0.0.3.0.0.0.7.0.1.0.0.2.ip6.arpa PTR roundrobin.pvv.ntnu.no
|
|
7.1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.1.0.0.3.0.0.0.7.0.1.0.0.2.ip6.arpa PTR drolsum.pvv.ntnu.no
|
|
|
|
```
|
|
|
|
## Future plans
|
|
|
|
- Also generate DHCP server configurations
|
|
- Build and verify with CI/CD
|
|
- Automatically push updated configurations to the DNS server
|
|
- Replace dns.nix with homemade zonefile generators to make them more human readable
|
|
- Host-customizable TTL (e.g. for moving a CNAME around when replacing a service/server)
|