Skip to content

Commit

Permalink
feat(torrserver): protect dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnvgr committed Apr 6, 2024
1 parent 4e6d8d7 commit aeb1e2e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hosts/cloud/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
torrserver = {
enable = true;
expose = true;
users = import ./secrets/tsdb.nix;
users = import ./secrets/tsusers.nix;
webUsers = import ./secrets/tsweb.nix;
};
};
};
Expand Down
File renamed without changes.
Binary file added hosts/cloud/secrets/tsweb.nix
Binary file not shown.
10 changes: 9 additions & 1 deletion modules/server/misc/torrserver/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ in {
type = types.attrsOf types.str;
default = {};
};

webUsers = mkOption {
type = types.attrsOf types.str;
default = {};
};
};

config = mkIf cfg.enable {
Expand Down Expand Up @@ -87,7 +92,10 @@ in {
networking.firewall.allowedUDPPorts = mkIf cfg.expose [ cfg.port ];

services.nginx.virtualHosts."ts.${domain}" = mkIf webIsSupported {
locations."/".proxyPass = "http://localhost:${toString cfg.port}";
locations."/" = {
proxyPass = "http://localhost:${toString cfg.port}";
basicAuth = cfg.webUsers;
};

enableACME = true;
forceSSL = true;
Expand Down

0 comments on commit aeb1e2e

Please sign in to comment.