mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-06-08 02:09:04 +02:00
feat(dns,nginx): add some weird magic
This commit is contained in:
parent
ab03b23b45
commit
714a279fc2
8 changed files with 127 additions and 72 deletions
|
@ -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;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
10
lib/dns.nix
10
lib/dns.nix
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue