From 2afb0b0aaea156716c748e08b04fd46fc3d73a71 Mon Sep 17 00:00:00 2001 From: goeranh Date: Fri, 27 Feb 2026 20:28:49 +0100 Subject: [PATCH] proxy formatting --- hosts/proxy/default.nix | 193 ++++++++++++++++++++++++---------------- 1 file changed, 117 insertions(+), 76 deletions(-) diff --git a/hosts/proxy/default.nix b/hosts/proxy/default.nix index 808848c..2db90b4 100644 --- a/hosts/proxy/default.nix +++ b/hosts/proxy/default.nix @@ -7,6 +7,7 @@ { imports = [ ./hardware-configuration.nix + ./hetzner-disk.nix ]; networking = { @@ -36,88 +37,128 @@ }; }; - services = { - openssh = { - enable = true; - listenAddresses = [ - { - addr = "141.56.51.1"; - port = 1005; - } - ]; - }; - haproxy = - let - forwards = { - plone = { - dest = "141.56.51.3"; - domain = "stura.htw-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - plone_alt = { - dest = "141.56.51.3"; - domain = "www.stura.htw-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - tix = { - dest = "141.56.51.220"; - domain = "tix.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - vot = { - dest = "141.56.51.57"; - domain = "vot.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - dat = { - dest = "141.56.51.81"; - domain = "dat.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - pro = { - dest = "141.56.51.15"; - domain = "pro.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - cloud = { - dest = "141.56.51.16"; - domain = "cloud.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - wiki = { - dest = "141.56.51.13"; - domain = "wiki.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - beach = { - dest = "141.56.51.51"; - domain = "beach.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; - }; - studicloud = { - dest = "141.56.51.17"; - domain = "dat.stu.htw.stura-dresden.de"; - httpPort = 80; - httpsPort = 443; + services = + let + forwards = { + plone = { + dest = "141.56.51.3"; + domain = "stura.htw-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + plone_alt = { + dest = "141.56.51.3"; + domain = "www.stura.htw-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + tix = { + dest = "141.56.51.220"; + domain = "tix.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + vot = { + dest = "141.56.51.57"; + domain = "vot.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + dat = { + dest = "141.56.51.81"; + domain = "dat.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + pro = { + dest = "141.56.51.15"; + domain = "pro.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + cloud = { + dest = "141.56.51.16"; + domain = "cloud.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + wiki = { + dest = "141.56.51.13"; + domain = "wiki.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + beach = { + dest = "141.56.51.51"; + domain = "beach.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + studicloud = { + dest = "141.56.51.17"; + domain = "dat.stu.htw.stura-dresden.de"; + httpPort = 80; + httpsPort = 443; + }; + }; + indexPage = pkgs.writeTextFile { + name = "index.html"; + text = '' + + + + StuRa HTWD Index + + + + + + + + ''; + }; + in + { + openssh = { + enable = true; + listenAddresses = [ + { + addr = "141.56.51.1"; + port = 1005; + } + ]; + }; + nginx = { + enable = true; + virtualHosts."localhost" = { + listen = [ + { + addr = "127.0.0.1"; + port = 6942; + } + ]; + locations."/" = { + extraConfig = '' + try_files ${indexPage} =404; + ''; }; }; - in - { + }; + haproxy = { enable = true; config = '' global log /dev/log format raw local0 maxconn 50000 - stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners + #stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners tune.bufsize 32762 defaults @@ -198,7 +239,7 @@ ) "" forwards} ''; }; - }; + }; environment.systemPackages = with pkgs; [ openvpn