From 930c1bd90ad04b4676a2f3e1e6e53debccac76a8 Mon Sep 17 00:00:00 2001 From: sinavir Date: Sun, 22 Dec 2024 02:46:44 +0100 Subject: [PATCH] feat(sni-proxy): init --- machines/labcore01/_configuration.nix | 1 + machines/labcore01/kfet/favicon.png | Bin 0 -> 3606 bytes machines/labcore01/kfet/index.html | 93 ++++++++++++++++++++++++++ machines/labcore01/nginx.nix | 8 +++ machines/router02/_configuration.nix | 1 + machines/router02/nginx-sni.nix | 21 ++++++ modules/default.nix | 3 + 7 files changed, 127 insertions(+) create mode 100644 machines/labcore01/kfet/favicon.png create mode 100644 machines/labcore01/kfet/index.html create mode 100644 machines/labcore01/nginx.nix create mode 100644 machines/router02/nginx-sni.nix diff --git a/machines/labcore01/_configuration.nix b/machines/labcore01/_configuration.nix index 5c0b9f5..01e49f2 100644 --- a/machines/labcore01/_configuration.nix +++ b/machines/labcore01/_configuration.nix @@ -8,6 +8,7 @@ lib.extra.mkConfig { enabledServices = [ # List of services to enable "unbound" + "nginx" ]; extraConfig = { }; diff --git a/machines/labcore01/kfet/favicon.png b/machines/labcore01/kfet/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..56fb42995770e3b66dcb1d383c634ebfb81fa8d4 GIT binary patch literal 3606 zcmV+x4(aiUP)9NB^z?L`GiT0&C4lG!3y==~ z*s_IlzNhl@vAeq)Nnkdc(QG!O$z(#EPKR2p7Be$5F(xJk)6&xL_U+sEgolW@`(H`o z7eFshPfSTkA*z6r`KLMKE0@c$uC5N9iLS0L@d{wh+_`w>>{&G3*J9{UT3X5(|JK%4 zbT-UpGx`r1Vw1nCkhA}{X=(8MbI%FFTOyIbl`B`k)6fK)1l zmfu@I>7``#e_Ka~!+F@aX%mbXF@m=;2L=R)XCIK9oXooN0RZyyPCCSYa%d=guw@Is zYkfrV2p~2#)}jAT96#pJ{}~w>k9We3w4{r_{>u9QMQ^?dzJmsdraZ)Rz^IWU;mXyk zoG@LqXc6q+zn`@LIvkh-)~#DdoYrJAL3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EyLM5gnLBr`=!T(7mo8C$4+;tr zRuy5(xdJGnMA0E8CPq{{;UAA3qYaBDs4Bw8$A^)QeEIU_wB{U6io1`4hYZ2u;$m!U zY{bf{Dpd9EP5aNXWy{2NCP42W05rk(=uXgHc=1I}GyT`7D4X%w?&x&1<}8u3W{Fz> zJ)PNTY}*k4@THetqAXBnXQ!2EBirY5PdyGvkks__bm*ek zLAtxULsV3hLlae0R1_eh-BlR?z~#&Ikz7a&4%~S@ShA2vpFVw<#Jv2|{BHDUr?srj z@4rtJQj#E9VJ$&)Dyr)zCx9EWq%s8O^&SWIZrc}xE7`RBzEw6DFr-KI8_3PnXluxHO6 zyWhP$J)xLE`1y#bPeXBWG3Df$l9IwGk95(vHXsxNsq3gQ~jvdKgL(!OPcg(1YCr002jf9O-nwt0ha8IOXnwufF<9 zyn$Ou@!Qp_u!~|Ya1;p%39xV9K34zc&_sS@+6zV50{{T!3I$_JYZ7eQw8^1-g-1kC z(!WSCKk>Q@<>Gnr$tO9j{1-V;?0M5%9-+}_9v%Sz00smE(1wbkLUnZwCL|={=+UEj zv5?bhwGWp7?mihA8N?yvGmad=m2a=YC!To1DS0_?-~ih@UpRdv!1I;nzP`Q?A0H2a zK|$almqT~A5wy3pP+3_C7YYmE*s)`jnpLi_WXTfPyLYe6Z(Utoyju6+qxj5!_F0-+ zLi``>WvJLudE*AkB~CQm`cd7p&E0);{W4Gj(V!Z7rN zUa#lHvhR`Y0eZcj(kZWbJn z?(S|Yp9q7&0PgPYkB1;#x7&G-lmn c0f-#`2L&H@H(bT$kN^Mx07*qoM6N<$f@V$TK>z>% literal 0 HcmV?d00001 diff --git a/machines/labcore01/kfet/index.html b/machines/labcore01/kfet/index.html new file mode 100644 index 0000000..501a2de --- /dev/null +++ b/machines/labcore01/kfet/index.html @@ -0,0 +1,93 @@ + + + + + + Ouverture K-Fêt + + + + +
+

Non défini

+

Fermé

+

Ouvert

+
+ + + diff --git a/machines/labcore01/nginx.nix b/machines/labcore01/nginx.nix new file mode 100644 index 0000000..9083b67 --- /dev/null +++ b/machines/labcore01/nginx.nix @@ -0,0 +1,8 @@ +{ + dgn-web.enable = true; + services.nginx.virtualHosts."kfet.lab.dgnum.eu" = { + enableACME = true; + forceSSL = true; + root = ./kfet; + }; +} diff --git a/machines/router02/_configuration.nix b/machines/router02/_configuration.nix index bcbef26..229f36b 100644 --- a/machines/router02/_configuration.nix +++ b/machines/router02/_configuration.nix @@ -9,6 +9,7 @@ lib.extra.mkConfig { # List of services to enable "networking" "wireguard" + "nginx-sni" ]; extraConfig = { }; diff --git a/machines/router02/nginx-sni.nix b/machines/router02/nginx-sni.nix new file mode 100644 index 0000000..ee8d586 --- /dev/null +++ b/machines/router02/nginx-sni.nix @@ -0,0 +1,21 @@ +{ meta, ... }: +let + # Beware, jool will not translate. Prefer ipv6 proxy target + machines = builtins.mapAttrs ( + host: { site, ... }: "v6.${host}.${site}.infra.lab.dgnum.eu:443" + ) meta.nodes; +in +{ + dgn-web.enable = true; + services.nginx = { + sni-proxy = { + preStreamConfig = '' + resolver 127.0.0.53; + ''; + enable = true; + redirects = { + "kfet.lab.dgnum.eu" = machines.labcore01; + }; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 40161a5..f0a7005 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -9,6 +9,9 @@ ++ [ "${sources."microvm.nix"}/nixos-modules/host" (import sources.proxmox-nixos).nixosModules.declarative-vms + ] + ++ (import sources.nix-modules { inherit lib; }).importModules [ + "services/nginx-sni" ]; dgn-notify.enable = false;