proxy formatting

This commit is contained in:
goeranh 2026-02-27 20:28:49 +01:00
parent 28464391dc
commit 2afb0b0aae
No known key found for this signature in database

View file

@ -7,6 +7,7 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./hetzner-disk.nix
]; ];
networking = { networking = {
@ -36,88 +37,128 @@
}; };
}; };
services = { services =
openssh = { let
enable = true; forwards = {
listenAddresses = [ plone = {
{ dest = "141.56.51.3";
addr = "141.56.51.1"; domain = "stura.htw-dresden.de";
port = 1005; httpPort = 80;
} httpsPort = 443;
]; };
}; plone_alt = {
haproxy = dest = "141.56.51.3";
let domain = "www.stura.htw-dresden.de";
forwards = { httpPort = 80;
plone = { httpsPort = 443;
dest = "141.56.51.3"; };
domain = "stura.htw-dresden.de"; tix = {
httpPort = 80; dest = "141.56.51.220";
httpsPort = 443; domain = "tix.htw.stura-dresden.de";
}; httpPort = 80;
plone_alt = { httpsPort = 443;
dest = "141.56.51.3"; };
domain = "www.stura.htw-dresden.de"; vot = {
httpPort = 80; dest = "141.56.51.57";
httpsPort = 443; domain = "vot.htw.stura-dresden.de";
}; httpPort = 80;
tix = { httpsPort = 443;
dest = "141.56.51.220"; };
domain = "tix.htw.stura-dresden.de"; dat = {
httpPort = 80; dest = "141.56.51.81";
httpsPort = 443; domain = "dat.htw.stura-dresden.de";
}; httpPort = 80;
vot = { httpsPort = 443;
dest = "141.56.51.57"; };
domain = "vot.htw.stura-dresden.de"; pro = {
httpPort = 80; dest = "141.56.51.15";
httpsPort = 443; domain = "pro.htw.stura-dresden.de";
}; httpPort = 80;
dat = { httpsPort = 443;
dest = "141.56.51.81"; };
domain = "dat.htw.stura-dresden.de"; cloud = {
httpPort = 80; dest = "141.56.51.16";
httpsPort = 443; domain = "cloud.htw.stura-dresden.de";
}; httpPort = 80;
pro = { httpsPort = 443;
dest = "141.56.51.15"; };
domain = "pro.htw.stura-dresden.de"; wiki = {
httpPort = 80; dest = "141.56.51.13";
httpsPort = 443; domain = "wiki.htw.stura-dresden.de";
}; httpPort = 80;
cloud = { httpsPort = 443;
dest = "141.56.51.16"; };
domain = "cloud.htw.stura-dresden.de"; beach = {
httpPort = 80; dest = "141.56.51.51";
httpsPort = 443; domain = "beach.htw.stura-dresden.de";
}; httpPort = 80;
wiki = { httpsPort = 443;
dest = "141.56.51.13"; };
domain = "wiki.htw.stura-dresden.de"; studicloud = {
httpPort = 80; dest = "141.56.51.17";
httpsPort = 443; domain = "dat.stu.htw.stura-dresden.de";
}; httpPort = 80;
beach = { httpsPort = 443;
dest = "141.56.51.51"; };
domain = "beach.htw.stura-dresden.de"; };
httpPort = 80; indexPage = pkgs.writeTextFile {
httpsPort = 443; name = "index.html";
}; text = ''
studicloud = { <html>
dest = "141.56.51.17"; <head>
domain = "dat.stu.htw.stura-dresden.de"; <title>
httpPort = 80; StuRa HTWD Index
httpsPort = 443;
</title>
</head>
<body>
<ul>
${lib.foldlAttrs (
prev: name: value:
prev
+ ''
<li><a href="https://${value.domain}">${name}</a></li>
''
) "" forwards}
</ul>
</body>
</html>
'';
};
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; enable = true;
config = '' config = ''
global global
log /dev/log format raw local0 log /dev/log format raw local0
maxconn 50000 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 tune.bufsize 32762
defaults defaults
@ -198,7 +239,7 @@
) "" forwards} ) "" forwards}
''; '';
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
openvpn openvpn