This repository has no description
18 kB
418 lines
1{ self, config, lib, pkgs, ... }: let
2 slib = self.inputs.stockholm.lib;
3in {
4
5 system.stateVersion = "23.05";
6 imports = [
7 ./backup.nix
8 ../../2configs/ssh-redirect.nix
9 ../../2configs/retiolum.nix
10 ../../2configs/libvirt.nix
11 ../../2configs/websites/lassulus.nix
12 ../../2configs/services/git/proxy.nix
13 ../../2configs/monitoring/telegraf.nix
14 ../../2configs/consul.nix
15 {
16 services.nginx.enable = true;
17 imports = [
18 ../../2configs/websites/domsen.nix
19 ];
20 # needed by domsen.nix ^^
21 lass.usershadow = {
22 enable = true;
23 };
24
25 krebs.iptables.tables.filter.INPUT.rules = [
26 { predicate = "-p tcp --dport http"; target = "ACCEPT"; }
27 { predicate = "-p tcp --dport https"; target = "ACCEPT"; }
28 ];
29 }
30 { # TODO make new hfos.nix out of this vv
31 users.users.riot = {
32 uid = slib.genid_uint31 "riot";
33 isNormalUser = true;
34 extraGroups = [ "libvirtd" ];
35 openssh.authorizedKeys.keys = [
36 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6o6sdTu/CX1LW2Ff5bNDqGEAGwAsjf0iIe5DCdC7YikCct+7x4LTXxY+nDlPMeGcOF88X9/qFwdyh+9E4g0nUAZaeL14Uc14QDqDt/aiKjIXXTepxE/i4JD9YbTqStAnA/HYAExU15yqgUdj2dnHu7OZcGxk0ZR1OY18yclXq7Rq0Fd3pN3lPP1T4QHM9w66r83yJdFV9szvu5ral3/QuxQnCNohTkR6LoJ4Ny2RbMPTRtb+jPbTQYTWUWwV69mB8ot5nRTP4MRM9pu7vnoPF4I2S5DvSnx4C5zdKzsb7zmIvD4AmptZLrXj4UXUf00Xf7Js5W100Ne2yhYyhq+35 riot@lagrange"
37 ];
38 };
39 krebs.iptables.tables.filter.FORWARD.rules = lib.mkBefore [
40 { v6 = false; predicate = "--destination 95.216.1.130"; target = "ACCEPT"; }
41 { v6 = false; predicate = "--source 95.216.1.130"; target = "ACCEPT"; }
42 ];
43 }
44 {
45 users.users.tv = {
46 uid = slib.genid_uint31 "tv";
47 isNormalUser = true;
48 openssh.authorizedKeys.keys = [
49 config.krebs.users.tv.pubkey
50 ];
51 };
52 users.users.makefu = {
53 uid = slib.genid_uint31 "makefu";
54 isNormalUser = true;
55 openssh.authorizedKeys.keys = [
56 config.krebs.users.makefu.pubkey
57 ];
58 };
59 users.extraUsers.dritter = {
60 uid = slib.genid_uint31 "dritter";
61 isNormalUser = true;
62 extraGroups = [
63 "download"
64 ];
65 openssh.authorizedKeys.keys = [
66 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnqOWDDk7QkSAvrSLkEoz7dY22+xPyv5JDn2zlfUndfavmTMfZvPx9REMjgULbcCSM4m3Ncf40yUjciDpVleGoEz82+p/ObHAkVWPQyXRS3ZRM2IJJultBHEFc61+61Pi8k3p5pBhPPaig6VncJ4uUuuNqen9jqLesSTVXNtdntU2IvnC8B8k1Kq6fu9q1T2yEOMxkD31D5hVHlqAly0LdRiYvtsRIoCSmRvlpGl70uvPprhQxhtoiEUeDqmIL7BG9x7gU0Swdl7R0/HtFXlFuOwSlNYDmOf/Zrb1jhOpj4AlCliGUkM0iKIJhgH0tnJna6kfkGKHDwuzITGIh6SpZ dritter@Janeway"
67 ];
68 };
69 users.extraUsers.juhulian = {
70 uid = 1339;
71 isNormalUser = true;
72 openssh.authorizedKeys.keys = [
73 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBQhLGvfv4hyQ/nqJGy1YgHXPSVl6igeWTroJSvAhUFgoh+rG+zvqY0EahKXNb3sq0/OYDCTJVuucc0hgCg7T2KqTqMtTb9EEkRmCFbD7F7DWZojCrh/an6sHneqT5eFvzAPZ8E5hup7oVQnj5P5M3I9keRHBWt1rq6q0IcOEhsFvne4qJc73aLASTJkxzlo5U8ju3JQOl6474ECuSn0lb1fTrQ/SR1NgF7jV11eBldkS8SHEB+2GXjn4Yrn+QUKOnDp+B85vZmVlJSI+7XR1/U/xIbtAjGTEmNwB6cTbBv9NCG9jloDDOZG4ZvzzHYrlBXjaigtQh2/4mrHoKa5eV juhulian@juhulian"
74 ];
75 };
76 users.users.hellrazor = {
77 uid = slib.genid_uint31 "hellrazor";
78 isNormalUser = true;
79 extraGroups = [
80 "download"
81 ];
82 openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDQFaYOWRUvHP6I37q9Dd4PJOq8FNQqAeJZ8pLx0G62uC450kbPGcG80rHHvXmk7HqQP6biJmMg48bOsvXAScPot2Qhp1Qc35CuUqVhLiTvUAsi8l/iJjhjZ23yRGDCAmW5+JIOzIvECkcbMnG7YoYAQ9trNGHe9qwGzQGhpt3QVClE23WtE3PVKRLQx1VbiabSnAm6tXVd2zpUoSdpWt8Gpi2taM4XXJ5+l744MNxFHvDapN5xqpYzwrA34Ii13jNLWcGbtgxESpR+VjnamdWByrkBsW4X5/xn2K1I1FrujaM/DBHV1QMaDKst9V8+uL5X7aYNt0OUBu2eyZdg6aujY2BYovB9uRyR1JIuSbA/a54MM96yN9WirMUufJF/YZrV0L631t9EW8ORyWUo1GRzMuBHVHQlfApj7NCU/jEddUuTqKgwyRgTmMFMUI4M0tRULAB/7pBE1Vbcx9tg6RsKIk8VkskfbBJW9Y6Sx6YoFlxPdgMNIrBefqEjIV62piP7YLMlvfIDCJ7TNd9dLN86XGggZ/nD5zt6SL1o61vVnw9If8pHosppxADPJsJvcdN6fOe16/tFAeE0JRo0jTcyFVTBGfhpey+rFfuW8wtUyuO5WPUxkOn7xMHGMWHJAtWX2vwVIDtLxvqn48B4SmEOpPD6ii+vcpwqAex3ycqBUQ==" ];
83 };
84 }
85 {
86 services.nginx.virtualHosts."radio.lassul.us" = {
87 enableACME = true;
88 addSSL = true;
89 locations."/" = {
90 # recommendedProxySettings = true;
91 proxyWebsockets = true;
92 proxyPass = "http://radio.r";
93 extraConfig = ''
94 proxy_set_header Host radio.r;
95 # get source ip for weather reports
96 proxy_set_header user-agent "$http_user_agent; client-ip=$remote_addr";
97 '';
98 };
99 };
100 krebs.htgen.radio-redirect = {
101 port = 8000;
102 scriptFile = pkgs.writers.writeDash "redir" ''
103 printf 'HTTP/1.1 301 Moved Permanently\r\n'
104 printf "Location: http://radio.lassul.us''${Request_URI}\r\n"
105 printf '\r\n'
106 '';
107 };
108 krebs.iptables.tables.filter.INPUT.rules = [
109 { predicate = "-p tcp --dport 8000"; target = "ACCEPT"; }
110 ];
111 }
112 ../../2configs/exim-smarthost.nix
113 ../../2configs/privoxy-retiolum.nix
114 ../../2configs/binary-cache/server.nix
115 ../../2configs/binary-cache/proxy.nix
116 ../../2configs/iodined.nix
117 ../../2configs/paste.nix
118 ../../2configs/syncthing.nix
119 ../../2configs/reaktor-coders.nix
120 ../../2configs/container-networking.nix
121 ../../2configs/fysiirc.nix
122 ../../2configs/bgt-bot
123 ../../2configs/services/matrix/proxy.nix
124 (self.inputs.stockholm + "/krebs/2configs/mastodon-proxy.nix")
125 {
126 services.tor = {
127 enable = true;
128 };
129 }
130 {
131 imports = [
132 ../../2configs/realwallpaper.nix
133 ];
134 services.nginx.virtualHosts."lassul.us".locations = {
135 "= /wallpaper-marker.png".extraConfig = ''
136 alias /var/realwallpaper/realwallpaper-marker.png;
137 '';
138 "= /wallpaper.png".extraConfig = ''
139 alias /var/realwallpaper/realwallpaper.png;
140 '';
141 "= /wallpaper-stars-berlin.png".extraConfig = ''
142 alias /var/realwallpaper/realwallpaper-krebs-stars-berlin.png;
143 '';
144 };
145 }
146 ../../2configs/minecraft.nix
147 ../../2configs/codimd.nix
148 ../../2configs/go.nix
149 {
150 lass.nichtparasoup.enable = true;
151 services.nginx = {
152 enable = true;
153 virtualHosts."lol.lassul.us" = {
154 forceSSL = true;
155 enableACME = true;
156 locations."/".extraConfig = ''
157 proxy_pass http://localhost:5001;
158 '';
159 };
160 };
161 }
162 {
163 imports = [
164 ../../2configs/wiregrill.nix
165 ];
166 krebs.iptables.tables.nat.PREROUTING.rules = lib.mkOrder 999 [
167 { v6 = false; predicate = "-s 10.244.0.0/16"; target = "ACCEPT"; }
168 { v4 = false; predicate = "-s 42:1::/32"; target = "ACCEPT"; }
169 ];
170 krebs.iptables.tables.filter.FORWARD.rules = lib.mkBefore [
171 { predicate = "-i wiregrill -o retiolum"; target = "ACCEPT"; }
172 { predicate = "-i retiolum -o wiregrill"; target = "ACCEPT"; }
173 ];
174 krebs.iptables.tables.nat.POSTROUTING.rules = [
175 { v4 = false; predicate = "-s 42:1::/32 ! -d 42:1::/48"; target = "MASQUERADE"; }
176 { v6 = false; predicate = "-s 10.244.0.0/16 ! -d 10.244.0.0/16"; target = "MASQUERADE"; }
177 ];
178 services.dnsmasq = {
179 enable = true;
180 resolveLocalQueries = false;
181
182 extraConfig= ''
183 bind-interfaces
184 interface=wiregrill
185 interface=retiolum
186 '';
187 };
188 }
189 {
190 krebs.iptables.tables.filter.INPUT.rules = [
191 { predicate = "-p udp --dport 60000:61000"; target = "ACCEPT"; }
192 ];
193 }
194 ../../2configs/services/coms/murmur.nix
195 {
196
197 services.nginx.virtualHosts."flix.lassul.us" = {
198 forceSSL = true;
199 enableACME = true;
200 locations."/" = {
201 proxyPass = "http://yellow.r:8096";
202 proxyWebsockets = true;
203 recommendedProxySettings = true;
204 };
205 };
206 services.nginx.virtualHosts."flex.lassul.us" = {
207 forceSSL = true;
208 enableACME = true;
209 locations."/" = {
210 proxyPass = "http://radar.r:7878";
211 proxyWebsockets = true;
212 recommendedProxySettings = true;
213 extraConfig = ''
214 auth_basic "Restricted Content";
215 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
216 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
217 ''};
218 '';
219 };
220 };
221 services.nginx.virtualHosts."flux.lassul.us" = {
222 forceSSL = true;
223 enableACME = true;
224 locations."/" = {
225 proxyPass = "http://sonar.r:8989";
226 proxyWebsockets = true;
227 recommendedProxySettings = true;
228 extraConfig = ''
229 auth_basic "Restricted Content";
230 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
231 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
232 ''};
233 '';
234 };
235 };
236 services.nginx.virtualHosts."lassul.us" = {
237 locations."^~ /flix/".extraConfig = ''
238 if ($scheme != "https") {
239 rewrite ^ https://$host$request_uri permanent;
240 }
241 auth_basic "Restricted Content";
242 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
243 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
244 ''};
245 proxy_pass http://yellow.r:80/;
246 proxy_set_header Accept-Encoding "";
247 sub_filter "https://lassul.us/" "https://lassul.us/flix/";
248 sub_filter_once off;
249 '';
250 locations."^~ /chatty/".extraConfig = ''
251 rewrite ^ https://$host/flix/$request_uri permanent;
252 '';
253 #locations."^~ /transmission".return = "301 https://$host/transmission/web/";
254 locations."^~ /transmission/".extraConfig = ''
255 if ($scheme != "https") {
256 rewrite ^ https://$host$request_uri permanent;
257 }
258 auth_basic "Restricted Content";
259 auth_basic_user_file ${pkgs.writeText "transmission-user-pass" ''
260 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
261 ''};
262 proxy_pass_header X-Transmission-Session-Id;
263 proxy_pass http://10.233.2.14:9091;
264 '';
265 };
266
267 users.groups.download = {};
268 users.users = {
269 download = {
270 createHome = false;
271 group = "download";
272 name = "download";
273 home = "/var/download";
274 useDefaultShell = true;
275 uid = slib.genid "download";
276 isSystemUser = true;
277 openssh.authorizedKeys.keys = with config.krebs.users; [
278 lass.pubkey
279 makefu.pubkey
280 palo.pubkey
281 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDB0d0JA20Vqn7I4lCte6Ne2EOmLZyMJyS9yIKJYXNLjbLwkQ4AYoQKantPBkTxR75M09E7d3j5heuWnCjWH45TrfQfe1EOSSC3ppCI6C6aIVlaNs+KhAYZS0m2Y8WkKn+TT5JLEa8yybYVN/RlZPOilpj/1Qgj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Dw/7bxgMZtqpfyoRk5s= philip@shiki11:15 <Profpatsch> AAAAB3NzaC1yc2EAAAADAQABAAABgQC4ECL9NSCWqs4KVe+FF+2BPtl5Bv5aQPHqnXllCyiESZykwRKLx6/AbF5SbUAUMVZtp9oDSdp28m3BvVeWJ/q7hAbIxUtfd/jp+JBRZ8Kj6K5GzUO7Bhgl/o0A7xEjAeOKHiYuLjdPMcFUyl6Ah4ey/mcQYf6AdU0+hYUDeUlKe/YxxYD6202W0GJq2xGdIqs/TbopT9iaX+sv0wdXDVfFY72nFqOUwJW3u6O2viKKRugrz/eo50Eo3ts7pYz/FpDXExrUvV9Vu/bQ34pa8nKgF3/AKQHgmzljNQSVZKyAV8OY0UFonjBMXCBg2tXtwfnlzdx2SyuQVv55x+0AuRKsi85G2xLpXu1A3921pseBTW6Q6kbYK9eqxAay2c/kNbwNqFnO+nCvQ6Ier/hvGddOtItMu96IuU2E7mPN6WgvM8/3fjJRFWnZxFxqu/k7iH+yYT8qwRgdiSqZc76qvkYEuabdk2itstTRY0A3SpI3hFMZDw/7bxgMZtqpfyoRk5s= philip@shiki"
283 mic92.pubkey
284 qubasa.pubkey
285 ];
286 };
287 };
288
289 system.activationScripts.downloadFolder = ''
290 mkdir -p /var/download
291 chmod 775 /var/download
292 ln -fnsT /var/lib/containers/yellow/var/download/finished /var/download/finished || :
293 chown download: /var/download/finished
294 '';
295
296 fileSystems."/export/download" = {
297 device = "/var/lib/containers/yellow/var/download/finished";
298 options = [ "bind" ];
299 };
300 services.nfs.server = {
301 enable = true;
302 exports = ''
303 /export 42::/16(insecure,ro,crossmnt)
304 '';
305 lockdPort = 4001;
306 mountdPort = 4002;
307 statdPort = 4000;
308 };
309
310 services.samba = {
311 enable = true;
312 enableNmbd = false;
313 extraConfig = ''
314 workgroup = WORKGROUP
315 netbios name = PRISM
316 server string = ${config.networking.hostName}
317 # only allow retiolum addresses
318 hosts allow = 42::/16 10.243.0.0/16 10.244.0.0/16
319
320 # Use sendfile() for performance gain
321 use sendfile = true
322
323 # No NetBIOS is needed
324 disable netbios = true
325
326 # Only mangle non-valid NTFS names, don't care about DOS support
327 mangled names = illegal
328
329 # Performance optimizations
330 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
331
332 # Disable all printing
333 load printers = false
334 disable spoolss = true
335 printcap name = /dev/null
336
337 map to guest = Bad User
338 max log size = 50
339 dns proxy = no
340 security = user
341
342 [global]
343 syslog only = yes
344 '';
345 shares.public = {
346 comment = "Warez";
347 path = "/export";
348 public = "yes";
349 "only guest" = "yes";
350 "create mask" = "0644";
351 "directory mask" = "2777";
352 writable = "no";
353 printable = "no";
354 };
355 };
356
357 krebs.iptables.tables.filter.INPUT.rules = [
358 # smbd
359 { predicate = "-i retiolum -p tcp --dport 445"; target = "ACCEPT"; }
360 { predicate = "-i retiolum -p tcp --dport 111"; target = "ACCEPT"; }
361 { predicate = "-i retiolum -p udp --dport 111"; target = "ACCEPT"; }
362 { predicate = "-i retiolum -p tcp --dport 2049"; target = "ACCEPT"; }
363 { predicate = "-i retiolum -p udp --dport 2049"; target = "ACCEPT"; }
364 { predicate = "-i retiolum -p tcp --dport 4000:4002"; target = "ACCEPT"; }
365 { predicate = "-i retiolum -p udp --dport 4000:4002"; target = "ACCEPT"; }
366 { predicate = "-i wiregrill -p tcp --dport 445"; target = "ACCEPT"; }
367 { predicate = "-i wiregrill -p tcp --dport 111"; target = "ACCEPT"; }
368 { predicate = "-i wiregrill -p udp --dport 111"; target = "ACCEPT"; }
369 { predicate = "-i wiregrill -p tcp --dport 2049"; target = "ACCEPT"; }
370 { predicate = "-i wiregrill -p udp --dport 2049"; target = "ACCEPT"; }
371 { predicate = "-i wiregrill -p tcp --dport 4000:4002"; target = "ACCEPT"; }
372 { predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; }
373 ];
374 }
375 { # acme fallback for neoprism migration
376 services.nginx.virtualHosts."lassul.us".acmeFallbackHost = "orange.r";
377 services.nginx.virtualHosts."radio.lassul.us".acmeFallbackHost = "neoprism.r";
378 services.nginx.virtualHosts."flix.lassul.us".acmeFallbackHost = "neoprism.r";
379 services.nginx.virtualHosts."jitsi.lassul.us".acmeFallbackHost = "neoprism.r";
380 services.nginx.virtualHosts."cgit.lassul.us".acmeFallbackHost = "orange.r";
381 services.nginx.virtualHosts."mail.lassul.us".acmeFallbackHost = "neoprism.r";
382 services.nginx.virtualHosts."mumble.lassul.us".acmeFallbackHost = "neoprism.r";
383 services.nginx.virtualHosts."mail.ubikmedia.eu" = {
384 enableACME = true;
385 forceSSL = true;
386 acmeFallbackHost = "ubik.r";
387 locations."/" = {
388 recommendedProxySettings = true;
389 proxyWebsockets = true;
390 proxyPass = "https://ubik.r";
391 };
392 };
393 }
394 ];
395
396 krebs.build.host = config.krebs.hosts.prism;
397 services.earlyoom = {
398 enable = true;
399 freeMemThreshold = 5;
400 };
401
402 # test stable-confusion external access
403 services.nginx.virtualHosts."testing.lassul.us" = {
404 forceSSL = true;
405 enableACME = true;
406 locations."/".extraConfig = ''
407 auth_basic "Restricted Content";
408 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
409 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
410 ''};
411 proxy_pass http://stable-confusion.r:80/;
412 proxy_http_version 1.1;
413 proxy_set_header Upgrade $http_upgrade;
414 proxy_set_header Connection "Upgrade";
415 proxy_set_header Accept-Encoding "";
416 '';
417 };
418}