nixos-configuration/hetzner-vpn1.nix

76 lines
2.1 KiB
Nix
Raw Normal View History

2024-03-02 13:46:13 +01:00
{
pkgs,
lib,
...
}: let
servicesDomain = "services.zerforschen.plus";
2024-03-02 13:54:39 +01:00
mkServiceConfig = host: port: {
2024-03-02 13:46:13 +01:00
addSSL = true;
enableACME = true;
locations."/" = {
2024-03-09 13:43:27 +01:00
proxyPass = "http://${host}:${toString port}/";
2024-03-02 13:46:13 +01:00
extraConfig = ''
# bind to tailscale ip
proxy_bind 100.88.118.60;
# pam auth
auth_pam "Password Required";
auth_pam_service_name "nginx";
'';
};
};
2024-03-02 13:54:39 +01:00
lpt2 = "vinzenz-lpt2.donkey-pentatonic.ts.net";
2024-03-09 13:43:27 +01:00
pc2 = "vinzenz-pc2.donkey-pentatonic.ts.net";
2024-03-02 13:46:13 +01:00
in {
2023-09-10 14:12:01 +02:00
imports = [
(import ./modules {
hostName = "hetzner-vpn1";
enableHomeManager = false;
})
2023-09-10 14:12:01 +02:00
];
config = {
2023-09-24 14:59:21 +02:00
my = {
2024-03-02 13:27:17 +01:00
enabledUsers = ["ronja" "vinzenz"];
2023-12-04 22:45:50 +01:00
tailscale.enable = true;
2023-09-24 14:59:21 +02:00
};
2023-09-11 19:16:26 +02:00
2023-09-10 14:12:01 +02:00
users.users.root.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICdYqY3Y1/f1bsAi5Qfyr/UWuX9ixu96IeAlhoQaJkbf''
2023-12-05 14:50:19 +01:00
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFCJUpbpB3KEKVoKWsKoar9J4RNah8gmQoSH6jQEw5dY vinzenz-pixel-JuiceSSH''
2023-12-05 15:00:02 +01:00
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO1CRn4yYTL4XUdCebE8Z4ZeuMujBjorTdWifg911EOv vinzenz-pc2 home roaming''
2024-03-01 17:39:37 +01:00
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDNpLDmctyqGpow/ElQvdhY4BLBPS/sigDJ1QEcC7wC vinzenz-lpt2-roaming''
2023-09-10 14:12:01 +02:00
];
security.acme = {
acceptTerms = true;
defaults.email = "acme@zerforschen.plus";
};
2024-03-02 13:18:05 +01:00
security.pam.services.nginx.setEnvironment = false;
systemd.services.nginx.serviceConfig = {
SupplementaryGroups = ["shadow"];
};
services.nginx = {
enable = true;
2024-03-02 13:18:05 +01:00
additionalModules = [pkgs.nginxModules.pam];
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
virtualHosts = {
2024-03-02 13:46:13 +01:00
"vscode.${servicesDomain}" = lib.mkMerge [
2024-03-09 13:43:27 +01:00
(mkServiceConfig pc2 8542)
2024-03-02 13:46:13 +01:00
{locations."/" .proxyWebsockets = true;}
];
2024-03-09 13:43:27 +01:00
"preon-app.${servicesDomain}" = mkServiceConfig pc2 8543;
2024-03-03 12:45:55 +01:00
"preon-api.${servicesDomain}" = mkServiceConfig lpt2 8544;
};
};
2024-03-02 13:02:14 +01:00
networking.firewall.allowedTCPPorts = [80 443];
2023-09-10 14:12:01 +02:00
};
}