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