summaryrefslogtreecommitdiffstats
path: root/2configs/bgt/hidden_service.nix
blob: 5c997336dd6422f36dad145205882c33f0509fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ pkgs, lib, ... }:

with lib;
let
  name = "bgt_cyberwar_hidden_service";
  srvdir = "/var/lib/tor/onion/";
in
  {
  sops.secrets."bgt_cyberwar_hidden_service/private_key" = {
    path = "${srvdir}/${name}/private_key";
    owner = "tor";
    restartUnits = [ "tor.service" ];
  };
  sops.secrets."bgt_cyberwar_hidden_service/hostname" = {
    path = "${srvdir}/${name}/hostname";
    owner = "tor";
    restartUnits = [ "tor.service" ];
  };
  services.nginx.virtualHosts."cyberwar62fmmhe4.onion".locations."/" = {
    proxyPass = "https://blog.binaergewitter.de";
    extraConfig = ''
        proxy_set_header  Host blog.binaergewitter.de;
        proxy_ssl_server_name on;
    '';
  };
  services.tor = {
    enable = true;
    hiddenServices."${name}".map = [
     { port = 80; }
     # { port = 443; toHost = "blog.binaergewitter.de"; }
    ];
  };
}