feat(dns,nginx): add some weird magic

This commit is contained in:
Luj 2024-10-26 04:09:35 +02:00
parent ab03b23b45
commit 714a279fc2
Signed by: luj
GPG key ID: 6FC74C847011FD83
8 changed files with 127 additions and 72 deletions

View file

@ -36,17 +36,11 @@ rec {
mkVPNSubdomain = name: port: {
luj.nginx.enable = true;
security.acme.certs."${name}.luj".server = "https://ca.luj/acme/acme/directory";
services.nginx.virtualHosts."${name}.luj" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
extraConfig = ''
allow 100.100.45.0/24;
allow fd7a:115c:a1e0::/48;
deny all;
'';
};
};
};

View file

@ -4,6 +4,16 @@ with lib;
rec {
allowedDomains = [
"luj.fr"
"julienmalka.me"
"malka.family"
"luj"
"malka.sh"
];
isVPNDomain = hasSuffix "luj";
hasSuffix' = flip strings.hasSuffix;
domainToZone = allowedDomains: domain: (findFirst (hasSuffix' domain) null allowedDomains);