Automatically generated hosts file for Wireguard VPN

This commit is contained in:
Andrea Ciceri 2023-12-16 16:52:38 +01:00
parent 7ab5ee99d6
commit a123364777
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg

View file

@ -1,4 +1,9 @@
{config, ...}: {
{
lib,
config,
vpn,
...
}: {
networking.firewall.interfaces.wg0 = {
allowedUDPPortRanges = [
{
@ -18,4 +23,12 @@
privateKeyFile = config.age.secrets."${config.networking.hostName}-wireguard-private-key".path;
listenPort = 51820;
};
networking.hosts =
lib.mapAttrs'
(hostname: vpnConfig: {
name = vpnConfig.ip;
value = ["${hostname}.fleet"];
})
vpn;
}