{ config, lib, pkgs, ... }: with import ; { imports = [ { services.nginx.enable = true; imports = [ ]; # needed by domsen.nix ^^ lass.usershadow = { enable = true; }; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport http"; target = "ACCEPT"; } { predicate = "-p tcp --dport https"; target = "ACCEPT"; } ]; } { # TODO make new hfos.nix out of this vv boot.kernel.sysctl."net.ipv4.ip_forward" = 1; users.users.riot = { uid = genid_uint31 "riot"; isNormalUser = true; extraGroups = [ "libvirtd" ]; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6o6sdTu/CX1LW2Ff5bNDqGEAGwAsjf0iIe5DCdC7YikCct+7x4LTXxY+nDlPMeGcOF88X9/qFwdyh+9E4g0nUAZaeL14Uc14QDqDt/aiKjIXXTepxE/i4JD9YbTqStAnA/HYAExU15yqgUdj2dnHu7OZcGxk0ZR1OY18yclXq7Rq0Fd3pN3lPP1T4QHM9w66r83yJdFV9szvu5ral3/QuxQnCNohTkR6LoJ4Ny2RbMPTRtb+jPbTQYTWUWwV69mB8ot5nRTP4MRM9pu7vnoPF4I2S5DvSnx4C5zdKzsb7zmIvD4AmptZLrXj4UXUf00Xf7Js5W100Ne2yhYyhq+35 riot@lagrange" ]; packages = [ (pkgs.writeDashBin "kick-routing" '' /run/wrappers/bin/sudo ${pkgs.systemd}/bin/systemctl restart krebs-iptables.service '') ]; }; security.sudo.extraConfig = '' riot ALL=(root) NOPASSWD: ${pkgs.systemd}/bin/systemctl restart krebs-iptables.service ''; # TODO write function for proxy_pass (ssl/nonssl) krebs.iptables.tables.filter.FORWARD.rules = [ { v6 = false; precedence = 1000; predicate = "-d 192.168.122.141"; target = "ACCEPT"; } ]; krebs.iptables.tables.nat.PREROUTING.rules = [ { v6 = false; precedence = 1000; predicate = "-d 95.216.1.130"; target = "DNAT --to-destination 192.168.122.141"; } ]; } { users.users.tv = { uid = genid_uint31 "tv"; isNormalUser = true; openssh.authorizedKeys.keys = [ config.krebs.users.tv.pubkey ]; }; users.users.makefu = { uid = genid_uint31 "makefu"; isNormalUser = true; openssh.authorizedKeys.keys = [ config.krebs.users.makefu.pubkey ]; }; users.extraUsers.dritter = { uid = genid_uint31 "dritter"; isNormalUser = true; extraGroups = [ "download" ]; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnqOWDDk7QkSAvrSLkEoz7dY22+xPyv5JDn2zlfUndfavmTMfZvPx9REMjgULbcCSM4m3Ncf40yUjciDpVleGoEz82+p/ObHAkVWPQyXRS3ZRM2IJJultBHEFc61+61Pi8k3p5pBhPPaig6VncJ4uUuuNqen9jqLesSTVXNtdntU2IvnC8B8k1Kq6fu9q1T2yEOMxkD31D5hVHlqAly0LdRiYvtsRIoCSmRvlpGl70uvPprhQxhtoiEUeDqmIL7BG9x7gU0Swdl7R0/HtFXlFuOwSlNYDmOf/Zrb1jhOpj4AlCliGUkM0iKIJhgH0tnJna6kfkGKHDwuzITGIh6SpZ dritter@Janeway" ]; }; users.extraUsers.juhulian = { uid = 1339; isNormalUser = true; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBQhLGvfv4hyQ/nqJGy1YgHXPSVl6igeWTroJSvAhUFgoh+rG+zvqY0EahKXNb3sq0/OYDCTJVuucc0hgCg7T2KqTqMtTb9EEkRmCFbD7F7DWZojCrh/an6sHneqT5eFvzAPZ8E5hup7oVQnj5P5M3I9keRHBWt1rq6q0IcOEhsFvne4qJc73aLASTJkxzlo5U8ju3JQOl6474ECuSn0lb1fTrQ/SR1NgF7jV11eBldkS8SHEB+2GXjn4Yrn+QUKOnDp+B85vZmVlJSI+7XR1/U/xIbtAjGTEmNwB6cTbBv9NCG9jloDDOZG4ZvzzHYrlBXjaigtQh2/4mrHoKa5eV juhulian@juhulian" ]; }; users.users.hellrazor = { uid = genid_uint31 "hellrazor"; isNormalUser = true; extraGroups = [ "download" ]; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDQFaYOWRUvHP6I37q9Dd4PJOq8FNQqAeJZ8pLx0G62uC450kbPGcG80rHHvXmk7HqQP6biJmMg48bOsvXAScPot2Qhp1Qc35CuUqVhLiTvUAsi8l/iJjhjZ23yRGDCAmW5+JIOzIvECkcbMnG7YoYAQ9trNGHe9qwGzQGhpt3QVClE23WtE3PVKRLQx1VbiabSnAm6tXVd2zpUoSdpWt8Gpi2taM4XXJ5+l744MNxFHvDapN5xqpYzwrA34Ii13jNLWcGbtgxESpR+VjnamdWByrkBsW4X5/xn2K1I1FrujaM/DBHV1QMaDKst9V8+uL5X7aYNt0OUBu2eyZdg6aujY2BYovB9uRyR1JIuSbA/a54MM96yN9WirMUufJF/YZrV0L631t9EW8ORyWUo1GRzMuBHVHQlfApj7NCU/jEddUuTqKgwyRgTmMFMUI4M0tRULAB/7pBE1Vbcx9tg6RsKIk8VkskfbBJW9Y6Sx6YoFlxPdgMNIrBefqEjIV62piP7YLMlvfIDCJ7TNd9dLN86XGggZ/nD5zt6SL1o61vVnw9If8pHosppxADPJsJvcdN6fOe16/tFAeE0JRo0jTcyFVTBGfhpey+rFfuW8wtUyuO5WPUxkOn7xMHGMWHJAtWX2vwVIDtLxvqn48B4SmEOpPD6ii+vcpwqAex3ycqBUQ==" ]; }; users.users.kmein = { uid = genid_uint31 "kmein"; isNormalUser = true; openssh.authorizedKeys.keys = [ config.krebs.users.kmein.pubkey ]; }; } { #hotdog systemd.services."container@hotdog".reloadIfChanged = mkForce false; containers.hotdog = { config = { ... }: { imports = [ ]; environment.systemPackages = [ pkgs.git ]; services.openssh.enable = true; users.users.root.openssh.authorizedKeys.keys = [ config.krebs.users.lass.pubkey ]; }; autoStart = true; enableTun = true; privateNetwork = true; hostAddress = "10.233.2.1"; localAddress = "10.233.2.2"; }; } { # quasi bepasty.nix imports = [ ]; krebs.bepasty.servers."paste.r".nginx.extraConfig = '' if ( $server_addr = "${config.krebs.build.host.nets.internet.ip4.addr}" ) { return 403; } ''; } { services.tor = { enable = true; }; } { lass.ejabberd = { enable = true; hosts = [ "lassul.us" ]; }; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport xmpp-client"; target = "ACCEPT"; } { predicate = "-p tcp --dport xmpp-server"; target = "ACCEPT"; } ]; } { imports = [ ]; services.nginx.virtualHosts."lassul.us".locations."/wallpaper.png".extraConfig = '' alias /var/realwallpaper/realwallpaper.png; ''; } { users.users.jeschli = { uid = genid_uint31 "jeschli"; isNormalUser = true; openssh.authorizedKeys.keys = with config.krebs.users; [ jeschli.pubkey jeschli-bln.pubkey jeschli-bolide.pubkey jeschli-brauerei.pubkey ]; }; krebs.git.rules = [ { user = with config.krebs.users; [ jeschli jeschli-bln jeschli-bolide jeschli-brauerei ]; repo = [ config.krebs.git.repos.xmonad-stockholm ]; perm = with git; push "refs/heads/jeschli*" [ fast-forward non-fast-forward create delete merge ]; } { user = with config.krebs.users; [ jeschli jeschli-bln jeschli-bolide jeschli-brauerei ]; repo = [ config.krebs.git.repos.stockholm ]; perm = with git; push "refs/heads/staging/jeschli*" [ fast-forward non-fast-forward create delete merge ]; } ]; } { krebs.repo-sync.repos.stockholm.timerConfig = { OnBootSec = "5min"; OnUnitInactiveSec = "2min"; RandomizedDelaySec = "2min"; }; } { services.taskserver = { enable = true; fqdn = "lassul.us"; listenHost = "::"; listenPort = 53589; organisations.lass.users = [ "lass" "android" ]; }; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport 53589"; target = "ACCEPT"; } ]; } { environment.systemPackages = [ pkgs.cryptsetup ]; systemd.services."container@red".reloadIfChanged = mkForce false; containers.red = { config = { ... }: { environment.systemPackages = [ pkgs.git ]; services.openssh.enable = true; users.users.root.openssh.authorizedKeys.keys = [ config.krebs.users.lass.pubkey ]; }; autoStart = false; enableTun = true; privateNetwork = true; hostAddress = "10.233.2.3"; localAddress = "10.233.2.4"; }; services.nginx.virtualHosts."rote-allez-fraktion.de" = { enableACME = true; forceSSL = true; locations."/" = { extraConfig = '' proxy_set_header Host rote-allez-fraktion.de; proxy_pass http://10.233.2.4; ''; }; }; } { imports = [ ]; lass.restic = genAttrs [ "daedalus" "icarus" "littleT" "mors" "shodan" "skynet" ] (dest: { dirs = [ "/home/chat/.weechat" "/bku/sql_dumps" ]; passwordFile = (toString ) + "/restic/${dest}"; repo = "sftp:backup@${dest}.r:/backups/prism"; extraArguments = [ "sftp.command='ssh backup@${dest}.r -i ${config.krebs.build.host.ssh.privkey.path} -s sftp'" ]; timerConfig = { OnCalendar = "00:05"; RandomizedDelaySec = "5h"; }; }); } { users.users.download.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDB0d0JA20Vqn7I4lCte6Ne2EOmLZyMJyS9yIKJYXNLjbLwkQ4AYoQKantPBkTxR75M09E7d3j5heuWnCjWH45TrfQfe1EOSSC3ppCI6C6aIVlaNs+KhAYZS0m2Y8WkKn+TT5JLEa8yybYVN/RlZPOilpj/1QgjU6CQK+eJ1k/kK+QFXcwN82GDVh5kbTVcKUNp2tiyxFA+z9LY0xFDg/JHif2ROpjJVLQBJ+YPuOXZN5LDnVcuyLWKThjxy5srQ8iDjoxBg7dwLHjby5Mv41K4W61Gq6xM53gDEgfXk4cQhJnmx7jA/pUnsn2ZQDeww3hcc7vRf8soogXXz2KC9maiq0M/svaATsa9Ul4hrKnqPZP9Q8ScSEAUX+VI+x54iWrnW0p/yqBiRAzwsczdPzaQroUFTBxrq8R/n5TFdSHRMX7fYNOeVMjhfNca/gtfw9dYBVquCvuqUuFiRc0I7yK44rrMjjVQRcAbw6F8O7+04qWCmaJ8MPlmApwu2c05VMv9hiJo5p6PnzterRSLCqF6rIdhSnuOwrUIt1s/V+EEZXHCwSaNLaQJnYL0H9YjaIuGz4c8kVzxw4c0B6nl+hqW5y5/B2cuHiumnlRIDKOIzlv8ufhh21iN7QpIsPizahPezGoT1XqvzeXfH4qryo8O4yTN/PW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5IEE2m+5+YaK0NMNsk2munNrN96ZE3r5xe/BDqfaLMpPfosOTXBtT7tLMlV6zkQ== palo@workout" ]; } { } { lass.nichtparasoup.enable = true; services.nginx = { enable = true; virtualHosts."lol.lassul.us" = { forceSSL = true; enableACME = true; locations."/".extraConfig = '' proxy_pass http://localhost:5001; ''; }; }; } { imports = [ ]; krebs.iptables.tables.nat.PREROUTING.rules = [ { v6 = false; precedence = 1000; predicate = "-s 10.244.1.0/24"; target = "ACCEPT"; } { v4 = false; precedence = 1000; predicate = "-s 42:1::/32"; target = "ACCEPT"; } ]; krebs.iptables.tables.filter.FORWARD.rules = [ { precedence = 1000; predicate = "-i wiregrill -o retiolum"; target = "ACCEPT"; } { precedence = 1000; predicate = "-i retiolum -o wiregrill"; target = "ACCEPT"; } ]; krebs.iptables.tables.nat.POSTROUTING.rules = [ { v4 = false; predicate = "-s 42:1::/32 ! -d 42:1::/48"; target = "MASQUERADE"; } { v6 = false; predicate = "-s 10.244.1.0/24 ! -d 10.244.1.0/24"; target = "MASQUERADE"; } ]; services.dnsmasq = { enable = true; resolveLocalQueries = false; extraConfig= '' listen-address=42:1:ce16::1 except-interface=lo interface=wg0 ''; }; } { krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p udp --dport 60000:61000"; target = "ACCEPT";} ]; } { services.murmur.enable = true; services.murmur.registerName = "lassul.us"; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport 64738"; target = "ACCEPT";} ]; } { systemd.services."container@yellow".reloadIfChanged = mkForce false; containers.yellow = { config = { ... }: { environment.systemPackages = [ pkgs.git ]; services.openssh.enable = true; users.users.root.openssh.authorizedKeys.keys = [ config.krebs.users.lass.pubkey ]; }; autoStart = false; enableTun = true; privateNetwork = true; hostAddress = "10.233.2.13"; localAddress = "10.233.2.14"; }; services.nginx.virtualHosts."lassul.us".locations."^~ /transmission".extraConfig = '' if ($scheme != "https") { rewrite ^ https://$host$uri permanent; } auth_basic "Restricted Content"; auth_basic_user_file ${pkgs.writeText "transmission-user-pass" '' krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0 ''}; proxy_pass http://10.233.2.14:9091; ''; users.groups.download = {}; users.users = { download = { createHome = true; group = "download"; name = "download"; home = "/var/download"; useDefaultShell = true; uid = genid "download"; openssh.authorizedKeys.keys = with config.krebs.users; [ lass.pubkey lass-shodan.pubkey lass-icarus.pubkey lass-daedalus.pubkey lass-helios.pubkey lass-android.pubkey makefu.pubkey wine-mors.pubkey ]; }; }; system.activationScripts.downloadFolder = '' mkdir -p /var/download chmod 775 /var/download ln -fnsT /var/lib/containers/yellow/var/download/finished /var/download/finished || : chown download: /var/download/finished ''; fileSystems."/export/download" = { device = "/var/lib/containers/yellow/var/download/finished"; options = [ "bind" ]; }; services.nfs.server = { enable = true; exports = '' /export 42::/16(insecure,ro,crossmnt) ''; lockdPort = 4001; mountdPort = 4002; statdPort = 4000; }; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-i retiolum -p tcp --dport 111"; target = "ACCEPT"; } { predicate = "-i retiolum -p udp --dport 111"; target = "ACCEPT"; } { predicate = "-i retiolum -p tcp --dport 2049"; target = "ACCEPT"; } { predicate = "-i retiolum -p udp --dport 2049"; target = "ACCEPT"; } { predicate = "-i retiolum -p tcp --dport 4000:4002"; target = "ACCEPT"; } { predicate = "-i retiolum -p udp --dport 4000:4002"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 111"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 111"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 2049"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 2049"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 4000:4002"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; } ]; } { nix.trustedUsers = [ "Mic92" ]; users.users.Mic92 = { uid = genid_uint31 "Mic92"; isNormalUser = true; openssh.authorizedKeys.keys = [ config.krebs.users.Mic92.pubkey ]; }; } { #macos mounting of yellow krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-i wiregrill -p tcp --dport 139"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 445"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 137"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 138"; target = "ACCEPT"; } ]; users.users.smbguest = { name = "smbguest"; uid = config.ids.uids.smbguest; description = "smb guest user"; home = "/home/share"; createHome = true; }; services.samba = { enable = true; enableNmbd = true; shares = { download = { path = "/var/download/finished"; "read only" = "yes"; browseable = "yes"; "guest ok" = "yes"; }; }; extraConfig = '' guest account = smbguest map to guest = bad user # disable printing load printers = no printing = bsd printcap name = /dev/null disable spoolss = yes ''; }; } ]; krebs.build.host = config.krebs.hosts.prism; services.earlyoom = { enable = true; freeMemThreshold = 5; }; # prism rsa hack services.openssh.hostKeys = [{ path = toString + "ssh.id_rsa"; type = "rsa"; }]; }