This repository has no description
16 kB
362 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 ../../2configs/services/radio/proxy.nix
86 ../../2configs/exim-smarthost.nix
87 ../../2configs/privoxy-retiolum.nix
88 ../../2configs/binary-cache/server.nix
89 ../../2configs/binary-cache/proxy.nix
90 ../../2configs/iodined.nix
91 ../../2configs/paste.nix
92 ../../2configs/syncthing.nix
93 ../../2configs/reaktor-coders.nix
94 ../../2configs/container-networking.nix
95 ../../2configs/fysiirc.nix
96 ../../2configs/bgt-bot
97 ../../2configs/services/matrix/proxy.nix
98 (self.inputs.stockholm + "/krebs/2configs/mastodon-proxy.nix")
99 {
100 services.tor = {
101 enable = true;
102 };
103 }
104 {
105 imports = [
106 ../../2configs/realwallpaper.nix
107 ];
108 services.nginx.virtualHosts."lassul.us".locations = {
109 "= /wallpaper-marker.png".extraConfig = ''
110 alias /var/realwallpaper/realwallpaper-marker.png;
111 '';
112 "= /wallpaper.png".extraConfig = ''
113 alias /var/realwallpaper/realwallpaper.png;
114 '';
115 "= /wallpaper-stars-berlin.png".extraConfig = ''
116 alias /var/realwallpaper/realwallpaper-krebs-stars-berlin.png;
117 '';
118 };
119 }
120 ../../2configs/minecraft.nix
121 ../../2configs/codimd.nix
122 ../../2configs/go.nix
123 {
124 lass.nichtparasoup.enable = true;
125 services.nginx = {
126 enable = true;
127 virtualHosts."lol.lassul.us" = {
128 forceSSL = true;
129 enableACME = true;
130 locations."/".extraConfig = ''
131 proxy_pass http://localhost:5001;
132 '';
133 };
134 };
135 }
136 {
137 imports = [
138 ../../2configs/wiregrill.nix
139 ];
140 krebs.iptables.tables.nat.PREROUTING.rules = lib.mkOrder 999 [
141 { v6 = false; predicate = "-s 10.244.0.0/16"; target = "ACCEPT"; }
142 { v4 = false; predicate = "-s 42:1::/32"; target = "ACCEPT"; }
143 ];
144 krebs.iptables.tables.filter.FORWARD.rules = lib.mkBefore [
145 { predicate = "-i wiregrill -o retiolum"; target = "ACCEPT"; }
146 { predicate = "-i retiolum -o wiregrill"; target = "ACCEPT"; }
147 ];
148 krebs.iptables.tables.nat.POSTROUTING.rules = [
149 { v4 = false; predicate = "-s 42:1::/32 ! -d 42:1::/48"; target = "MASQUERADE"; }
150 { v6 = false; predicate = "-s 10.244.0.0/16 ! -d 10.244.0.0/16"; target = "MASQUERADE"; }
151 ];
152 services.dnsmasq = {
153 enable = true;
154 resolveLocalQueries = false;
155
156 extraConfig= ''
157 bind-interfaces
158 interface=wiregrill
159 interface=retiolum
160 '';
161 };
162 }
163 {
164 krebs.iptables.tables.filter.INPUT.rules = [
165 { predicate = "-p udp --dport 60000:61000"; target = "ACCEPT"; }
166 ];
167 }
168 ../../2configs/services/coms/murmur.nix
169 {
170
171 services.nginx.virtualHosts."flix.lassul.us" = {
172 forceSSL = true;
173 enableACME = true;
174 locations."/" = {
175 proxyPass = "http://yellow.r:8096";
176 proxyWebsockets = true;
177 recommendedProxySettings = true;
178 };
179 };
180 services.nginx.virtualHosts."lassul.us" = {
181 locations."^~ /flix/".extraConfig = ''
182 if ($scheme != "https") {
183 rewrite ^ https://$host$request_uri permanent;
184 }
185 auth_basic "Restricted Content";
186 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
187 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
188 ''};
189 proxy_pass http://yellow.r:80/;
190 proxy_set_header Accept-Encoding "";
191 sub_filter "https://lassul.us/" "https://lassul.us/flix/";
192 sub_filter_once off;
193 '';
194 locations."^~ /chatty/".extraConfig = ''
195 rewrite ^ https://$host/flix/$request_uri permanent;
196 '';
197 #locations."^~ /transmission".return = "301 https://$host/transmission/web/";
198 locations."^~ /transmission/".extraConfig = ''
199 if ($scheme != "https") {
200 rewrite ^ https://$host$request_uri permanent;
201 }
202 auth_basic "Restricted Content";
203 auth_basic_user_file ${pkgs.writeText "transmission-user-pass" ''
204 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
205 ''};
206 proxy_pass_header X-Transmission-Session-Id;
207 proxy_pass http://10.233.2.14:9091;
208 '';
209 };
210
211 users.groups.download = {};
212 users.users = {
213 download = {
214 createHome = false;
215 group = "download";
216 name = "download";
217 home = "/var/download";
218 useDefaultShell = true;
219 uid = slib.genid "download";
220 isSystemUser = true;
221 openssh.authorizedKeys.keys = with config.krebs.users; [
222 lass.pubkey
223 makefu.pubkey
224 palo.pubkey
225 "ssh-r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Y0UFonjBMXCBg2tXtwfnlzdx2SyuQVv55x+0AuRKsi85G2xLpXu1A3921pseBTW6Q6kbYK9eqxAay2c/kNbwNqFnO+nCvQ6Ier/hvGddOtItMu96IuU2E7mPN6WgvM8/3fjJRFWnZxFxqu/k7iH+yYT8qwRgdiSqZc76qvkYEuabdk2itstTRY0A3SpI3hFMZDw/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"
227 mic92.pubkey
228 qubasa.pubkey
229 ];
230 };
231 };
232
233 system.activationScripts.downloadFolder = ''
234 mkdir -p /var/download
235 chmod 775 /var/download
236 ln -fnsT /var/lib/containers/yellow/var/download/finished /var/download/finished || :
237 chown download: /var/download/finished
238 '';
239
240 fileSystems."/export/download" = {
241 device = "/var/lib/containers/yellow/var/download/finished";
242 options = [ "bind" ];
243 };
244 services.nfs.server = {
245 enable = true;
246 exports = ''
247 /export 42::/16(insecure,ro,crossmnt)
248 '';
249 lockdPort = 4001;
250 mountdPort = 4002;
251 statdPort = 4000;
252 };
253
254 services.samba = {
255 enable = true;
256 enableNmbd = false;
257 extraConfig = ''
258 workgroup = WORKGROUP
259 netbios name = PRISM
260 server string = ${config.networking.hostName}
261 # only allow retiolum addresses
262 hosts allow = 42::/16 10.243.0.0/16 10.244.0.0/16
263
264 # Use sendfile() for performance gain
265 use sendfile = true
266
267 # No NetBIOS is needed
268 disable netbios = true
269
270 # Only mangle non-valid NTFS names, don't care about DOS support
271 mangled names = illegal
272
273 # Performance optimizations
274 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
275
276 # Disable all printing
277 load printers = false
278 disable spoolss = true
279 printcap name = /dev/null
280
281 map to guest = Bad User
282 max log size = 50
283 dns proxy = no
284 security = user
285
286 [global]
287 syslog only = yes
288 '';
289 shares.public = {
290 comment = "Warez";
291 path = "/export";
292 public = "yes";
293 "only guest" = "yes";
294 "create mask" = "0644";
295 "directory mask" = "2777";
296 writable = "no";
297 printable = "no";
298 };
299 };
300
301 krebs.iptables.tables.filter.INPUT.rules = [
302 # smbd
303 { predicate = "-i retiolum -p tcp --dport 445"; target = "ACCEPT"; }
304 { predicate = "-i retiolum -p tcp --dport 111"; target = "ACCEPT"; }
305 { predicate = "-i retiolum -p udp --dport 111"; target = "ACCEPT"; }
306 { predicate = "-i retiolum -p tcp --dport 2049"; target = "ACCEPT"; }
307 { predicate = "-i retiolum -p udp --dport 2049"; target = "ACCEPT"; }
308 { predicate = "-i retiolum -p tcp --dport 4000:4002"; target = "ACCEPT"; }
309 { predicate = "-i retiolum -p udp --dport 4000:4002"; target = "ACCEPT"; }
310 { predicate = "-i wiregrill -p tcp --dport 445"; target = "ACCEPT"; }
311 { predicate = "-i wiregrill -p tcp --dport 111"; target = "ACCEPT"; }
312 { predicate = "-i wiregrill -p udp --dport 111"; target = "ACCEPT"; }
313 { predicate = "-i wiregrill -p tcp --dport 2049"; target = "ACCEPT"; }
314 { predicate = "-i wiregrill -p udp --dport 2049"; target = "ACCEPT"; }
315 { predicate = "-i wiregrill -p tcp --dport 4000:4002"; target = "ACCEPT"; }
316 { predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; }
317 ];
318 }
319 { # acme fallback for neoprism migration
320 services.nginx.virtualHosts."lassul.us".acmeFallbackHost = "orange.r";
321 services.nginx.virtualHosts."radio.lassul.us".acmeFallbackHost = "neoprism.r";
322 services.nginx.virtualHosts."flix.lassul.us".acmeFallbackHost = "neoprism.r";
323 services.nginx.virtualHosts."jitsi.lassul.us".acmeFallbackHost = "neoprism.r";
324 services.nginx.virtualHosts."cgit.lassul.us".acmeFallbackHost = "orange.r";
325 services.nginx.virtualHosts."mail.lassul.us".acmeFallbackHost = "neoprism.r";
326 services.nginx.virtualHosts."mumble.lassul.us".acmeFallbackHost = "neoprism.r";
327 services.nginx.virtualHosts."mail.ubikmedia.eu" = {
328 enableACME = true;
329 forceSSL = true;
330 acmeFallbackHost = "ubik.r";
331 locations."/" = {
332 recommendedProxySettings = true;
333 proxyWebsockets = true;
334 proxyPass = "https://ubik.r";
335 };
336 };
337 }
338 ];
339
340 krebs.build.host = config.krebs.hosts.prism;
341 services.earlyoom = {
342 enable = true;
343 freeMemThreshold = 5;
344 };
345
346 # test stable-confusion external access
347 services.nginx.virtualHosts."testing.lassul.us" = {
348 forceSSL = true;
349 enableACME = true;
350 locations."/".extraConfig = ''
351 auth_basic "Restricted Content";
352 auth_basic_user_file ${pkgs.writeText "flix-user-pass" ''
353 krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0
354 ''};
355 proxy_pass http://stable-confusion.r:80/;
356 proxy_http_version 1.1;
357 proxy_set_header Upgrade $http_upgrade;
358 proxy_set_header Connection "Upgrade";
359 proxy_set_header Accept-Encoding "";
360 '';
361 };
362}