This repository has no description
18 kB
420 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 ../../.
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/matrix.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/jitsi.nix
195 ../../2configs/services/coms/murmur.nix
196 {
197
198 services.nginx.virtualHosts."flix.lassul.us" = {
199 forceSSL = true;
200 enableACME = true;
201 locations."/" = {
202 proxyPass = "http://yellow.r:8096";
203 proxyWebsockets = true;
204 recommendedProxySettings = true;
205 };
206 };
207 services.nginx.virtualHosts."flex.lassul.us" = {
208 forceSSL = true;
209 enableACME = true;
210 locations."/" = {
211 proxyPass = "http://radar.r:7878";
212 proxyWebsockets = true;
213 recommendedProxySettings = true;
214 extraConfig = ''
215 auth_basic "Restricted Content";
216 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
217 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
218 ''};
219 '';
220 };
221 };
222 services.nginx.virtualHosts."flux.lassul.us" = {
223 forceSSL = true;
224 enableACME = true;
225 locations."/" = {
226 proxyPass = "http://sonar.r:8989";
227 proxyWebsockets = true;
228 recommendedProxySettings = true;
229 extraConfig = ''
230 auth_basic "Restricted Content";
231 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
232 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
233 ''};
234 '';
235 };
236 };
237 services.nginx.virtualHosts."lassul.us" = {
238 locations."^~ /flix/".extraConfig = ''
239 if ($scheme != "https") {
240 rewrite ^ https://$host$request_uri permanent;
241 }
242 auth_basic "Restricted Content";
243 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
244 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
245 ''};
246 proxy_pass http://yellow.r:80/;
247 proxy_set_header Accept-Encoding "";
248 sub_filter "https://lassul.us/" "https://lassul.us/flix/";
249 sub_filter_once off;
250 '';
251 locations."^~ /chatty/".extraConfig = ''
252 rewrite ^ https://$host/flix/$request_uri permanent;
253 '';
254 #locations."^~ /transmission".return = "301 https://$host/transmission/web/";
255 locations."^~ /transmission/".extraConfig = ''
256 if ($scheme != "https") {
257 rewrite ^ https://$host$request_uri permanent;
258 }
259 auth_basic "Restricted Content";
260 auth_basic_user_file ${pkgs.writeText "transmission-user-pass" ''
261 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
262 ''};
263 proxy_pass_header X-Transmission-Session-Id;
264 proxy_pass http://10.233.2.14:9091;
265 '';
266 };
267
268 users.groups.download = {};
269 users.users = {
270 download = {
271 createHome = false;
272 group = "download";
273 name = "download";
274 home = "/var/download";
275 useDefaultShell = true;
276 uid = slib.genid "download";
277 isSystemUser = true;
278 openssh.authorizedKeys.keys = with config.krebs.users; [
279 lass.pubkey
280 lass-android.pubkey
281 makefu.pubkey
282 palo.pubkey
283 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDB0d0JA20Vqn7I4lCte6Ne2EOmLZyMJyS9yIKJYXNLjbLwkQ4AYoQKantPBkTxR75M09E7d3j5heuWnCjWH45TrfQfe1EOSSC3ppCI6C6aIVlaNs+KhAYZS0m2Y8WkKn+TT5JLEa8yybYV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stTRY0A3SpI3hFMZDw/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"
285 mic92.pubkey
286 qubasa.pubkey
287 ];
288 };
289 };
290
291 system.activationScripts.downloadFolder = ''
292 mkdir -p /var/download
293 chmod 775 /var/download
294 ln -fnsT /var/lib/containers/yellow/var/download/finished /var/download/finished || :
295 chown download: /var/download/finished
296 '';
297
298 fileSystems."/export/download" = {
299 device = "/var/lib/containers/yellow/var/download/finished";
300 options = [ "bind" ];
301 };
302 services.nfs.server = {
303 enable = true;
304 exports = ''
305 /export 42::/16(insecure,ro,crossmnt)
306 '';
307 lockdPort = 4001;
308 mountdPort = 4002;
309 statdPort = 4000;
310 };
311
312 services.samba = {
313 enable = true;
314 enableNmbd = false;
315 extraConfig = ''
316 workgroup = WORKGROUP
317 netbios name = PRISM
318 server string = ${config.networking.hostName}
319 # only allow retiolum addresses
320 hosts allow = 42::/16 10.243.0.0/16 10.244.0.0/16
321
322 # Use sendfile() for performance gain
323 use sendfile = true
324
325 # No NetBIOS is needed
326 disable netbios = true
327
328 # Only mangle non-valid NTFS names, don't care about DOS support
329 mangled names = illegal
330
331 # Performance optimizations
332 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
333
334 # Disable all printing
335 load printers = false
336 disable spoolss = true
337 printcap name = /dev/null
338
339 map to guest = Bad User
340 max log size = 50
341 dns proxy = no
342 security = user
343
344 [global]
345 syslog only = yes
346 '';
347 shares.public = {
348 comment = "Warez";
349 path = "/export";
350 public = "yes";
351 "only guest" = "yes";
352 "create mask" = "0644";
353 "directory mask" = "2777";
354 writable = "no";
355 printable = "no";
356 };
357 };
358
359 krebs.iptables.tables.filter.INPUT.rules = [
360 # smbd
361 { predicate = "-i retiolum -p tcp --dport 445"; target = "ACCEPT"; }
362 { predicate = "-i retiolum -p tcp --dport 111"; target = "ACCEPT"; }
363 { predicate = "-i retiolum -p udp --dport 111"; target = "ACCEPT"; }
364 { predicate = "-i retiolum -p tcp --dport 2049"; target = "ACCEPT"; }
365 { predicate = "-i retiolum -p udp --dport 2049"; target = "ACCEPT"; }
366 { predicate = "-i retiolum -p tcp --dport 4000:4002"; target = "ACCEPT"; }
367 { predicate = "-i retiolum -p udp --dport 4000:4002"; target = "ACCEPT"; }
368 { predicate = "-i wiregrill -p tcp --dport 445"; target = "ACCEPT"; }
369 { predicate = "-i wiregrill -p tcp --dport 111"; target = "ACCEPT"; }
370 { predicate = "-i wiregrill -p udp --dport 111"; target = "ACCEPT"; }
371 { predicate = "-i wiregrill -p tcp --dport 2049"; target = "ACCEPT"; }
372 { predicate = "-i wiregrill -p udp --dport 2049"; target = "ACCEPT"; }
373 { predicate = "-i wiregrill -p tcp --dport 4000:4002"; target = "ACCEPT"; }
374 { predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; }
375 ];
376 }
377 { # acme fallback for neoprism migration
378 services.nginx.virtualHosts."lassul.us".acmeFallbackHost = "orange.r";
379 services.nginx.virtualHosts."radio.lassul.us".acmeFallbackHost = "neoprism.r";
380 services.nginx.virtualHosts."flix.lassul.us".acmeFallbackHost = "neoprism.r";
381 services.nginx.virtualHosts."jitsi.lassul.us".acmeFallbackHost = "neoprism.r";
382 services.nginx.virtualHosts."cgit.lassul.us".acmeFallbackHost = "orange.r";
383 services.nginx.virtualHosts."mail.lassul.us".acmeFallbackHost = "neoprism.r";
384 services.nginx.virtualHosts."mumble.lassul.us".acmeFallbackHost = "neoprism.r";
385 services.nginx.virtualHosts."mail.ubikmedia.eu" = {
386 enableACME = true;
387 forceSSL = true;
388 acmeFallbackHost = "ubik.r";
389 locations."/" = {
390 recommendedProxySettings = true;
391 proxyWebsockets = true;
392 proxyPass = "https://ubik.r";
393 };
394 };
395 }
396 ];
397
398 krebs.build.host = config.krebs.hosts.prism;
399 services.earlyoom = {
400 enable = true;
401 freeMemThreshold = 5;
402 };
403
404 # test stable-confusion external access
405 services.nginx.virtualHosts."testing.lassul.us" = {
406 forceSSL = true;
407 enableACME = true;
408 locations."/".extraConfig = ''
409 auth_basic "Restricted Content";
410 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
411 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
412 ''};
413 proxy_pass http://stable-confusion.r:80/;
414 proxy_http_version 1.1;
415 proxy_set_header Upgrade $http_upgrade;
416 proxy_set_header Connection "Upgrade";
417 proxy_set_header Accept-Encoding "";
418 '';
419 };
420}