feat: add c2 and fix code-server

This commit is contained in:
2025-10-28 23:35:46 +08:00
parent 3f63ea2c43
commit 123e1cc5e0
4 changed files with 63 additions and 9 deletions

View File

@@ -129,8 +129,12 @@ in
networking.networkmanager.enable = false;
networking.useDHCP = false;
systemd.network.enable = true;
networking.firewall.allowedTCPPorts = [ 12022 ];
networking.nftables.enable = true;
networking.firewall.allowedTCPPorts = [ 12022 ];
networking.firewall.extraInputRules = ''
ip saddr 192.168.16.0/21 accept
ip6 saddr fd01:da8:bf::/48 accept
'';
networking.extraHosts = ''
192.168.16.1 ssh.nasp.fit git.nasp.fit jump.nasp.fit
192.168.16.115 g15.nasp g15 lm1
@@ -264,12 +268,9 @@ in
serverName = "proxy.nasp.fit";
locations."~ ^/${config.networking.hostName}/([A-Za-z0-9]+)/(.*)" = {
proxyWebsockets = true;
proxyPass = "http://unix:/home2/run/$1.sock";
extraConfig = ''
rewrite "^/${config.networking.hostName}/([A-Za-z0-9]+)/(.*)" /$2 break;
proxy_pass "http://unix:/home2/run/$1.sock";
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
'';
};
@@ -462,10 +463,6 @@ in
(lib.mkIf (cCfg.enable) {
networking.hostName = "c" + (builtins.toString cCfg.serial);
networking.nameservers = [ "192.168.20.1" ];
networking.firewall.extraInputRules = ''
ip saddr 192.168.20.0/24 accept
ip6 saddr fd01:da8:bf:14::/64 accept
'';
nasp.docker.enable = lib.mkDefault true;
nasp.registry.enable = lib.mkDefault true;
nasp.nginx.enable = lib.mkDefault true;