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