summaryrefslogtreecommitdiff
path: root/nixos/modules/sentinel-fwlogs.nix
blob: d2bc8646eddc7070afe970ee1aaaf6ba55b4c2e1 (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
{ config, lib, pkgs, ... }:

with lib;

{

  imports = [ ./sentinel.nix ];


  options = {
    services.sentinel.fwlogs = {
        enable = mkOption {
          type = types.bool;
          default = true;
          description = ''
            Whether to enable the Turris Sentinel Firewall logs collector.
            The services.sentinel.enable has to be enabled as well.
          '';
        };
        nflog-group = mkOption {
          type = types.port;
          default = 1914;
          description = "Netfilter log group used to pass logs to sentinel-fwlogs.";
        };
      };
  };


  config = mkIf config.services.sentinel.enable && config.services.sentinel.fwlogs.enable {
    environment.systemPackages = [ pkgs.sentinel-fwlogs ];

    systemd.services.sentinel-fwlogs = {
      description = "Turris Sentinel Firewall Logs";
      wantedBy = [ "multi-user.target" ];
      path = [ pkgs.sentinel-fwlogs ];
      serviceConfig.ExecStart = "${pkgs.sentinel-fwlogs}/bin/sentinel-fwlogs";
    };

  };

}