nixos/systems/proxy/default.nix

68 lines
2.1 KiB
Nix
Raw Normal View History

2023-05-29 16:21:23 +02:00
{ hostname }: { inputs, pkgs, ... }:
2022-02-28 21:19:55 +01:00
{
imports = [
2023-05-29 16:21:23 +02:00
(import "${inputs.self}/systems/raspi4" {
2022-09-06 19:38:53 +02:00
ip = "10.7.89.99";
2023-05-29 16:21:23 +02:00
inherit hostname;
2022-02-28 21:19:55 +01:00
})
];
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
services = {
2023-06-05 15:58:28 +02:00
az-acme-base.enable = true;
2023-06-05 15:14:06 +02:00
az-grav.enable = true;
2023-06-05 15:21:11 +02:00
az-haproxy.enable = true;
2023-06-05 15:23:53 +02:00
az-heimdall.enable = true;
2023-06-06 22:09:36 +02:00
az-restic-client-server = {
enable = true;
path = "/home/andreas";
time = "00:00";
};
2023-06-05 15:14:06 +02:00
nginx = {
commonHttpConfig = ''
# Add HSTS header with preloading to HTTPS requests.
# Adding this header to HTTP requests is discouraged
# Enable CSP for your services.
#add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
# Minimize information leaked to other domains
add_header 'Referrer-Policy' 'origin-when-cross-origin';
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
# Disable embedding as a frame
add_header X-Frame-Options DENY;
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
# Prevent injection of code in other mime types (XSS Attacks)
add_header X-Content-Type-Options nosniff;
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
# Enable XSS protection of the browser.
# May be unnecessary when CSP is configured properly (see above)
add_header X-XSS-Protection "1; mode=block";
2022-09-06 19:38:53 +02:00
2023-06-05 15:14:06 +02:00
# This might create errors
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
'';
recommendedProxySettings = true;
virtualHosts = {
"2li.ch" = {
serverAliases = [ "www.2li.ch" ];
enableACME = true;
forceSSL = true;
listen = [{ port = 4433; addr = "127.0.0.1"; ssl = true; }];
locations."/" = {
proxyPass = "http://127.0.0.1:8080";
proxyWebsockets = true; # needed if you need to use WebSocket
};
2022-09-06 19:38:53 +02:00
};
2023-06-05 15:14:06 +02:00
"heimdall.2li.ch" = {
enableACME = true;
forceSSL = true;
listen = [{ port = 4433; addr = "127.0.0.1"; ssl = true; }];
locations."/" = {
proxyPass = "http://127.0.0.1:8081";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
};
2022-09-06 19:38:53 +02:00
};
};
2022-02-28 21:19:55 +01:00
}