summaryrefslogtreecommitdiff
path: root/os/srv/ntopng.nix
blob: 692fe2c041ecca0eabc61ac174f693ec4ea0cbc9 (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
34
35
36
37
38
39
40
41
42
43
{
  config,
  lib,
  masterDomain,
  securityTemplates,
  ...
}:
let
  cfg = config.os.srv.ntopng;
in
{
  options.os.srv.ntopng = {
    enable = lib.mkEnableOption "enables ntopng monitoring";
    proxyConfig = lib.mkOption {
      type = lib.types.attrs;
      default = { };
    };
  };
  config = lib.mkIf cfg.enable {
    services.ntopng = {
      enable = true;
      extraConfig = "--packet-fanout 'cluster' -g 2 -m '192.168.0.0/16,10.0.0.0/8' -X 50000 --community";

      # TODO fill interfaces
      interfaces = [
        "" # WAN Interface
        "" # LAN Interface
        "" # Virtual Bridge
      ];
    };
    os.srv.ntopng.proxyConfig = {
      "ntopng.${masterDomain}" = {
        enableACME = true;
        forceSSL = true;

        locations."/" = {
          proxyPass = "http://${config.os.core.network.ips.vm2-gateway}:3000";
          extraConfig = securityTemplates.restrictToInternal;
        };
      };
    };
  };
}