blob: 19ef74602c89396fba83cc9dd4472cacdb1b527b (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{ config, lib, pkgs, ... }:
with lib;
let
cnf = config.sentinel;
in {
options = {
services.sentinel = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the Turris Sentinel attact prevention system.
'';
};
deviceToken = mkOption {
type = types.str;
description = ''
Turris Sentinel token. You can use `sentinel-device-token -c` to get new one.
'';
};
sentinelCA = mkOption {
type = types.path;
default = ../sentinel-ca.pem;
description = ''
The CA certificate used with Sentinel.
Most of the times you do not want to modify this as it uses the
certificate shipped with NixOS modules.
'';
};
};
};
config = mkIf config.services.sentinel.enable {
environment.systemPackages = with pkgs; [
sentinel-proxy sentinel-certgen
];
# TODO we should probably rather pass token using configuration file
systemd.services.sentinel-proxy = {
description = "Turris Sentinel proxy";
wantedBy = [ "multi-user.target" ];
path = [ sentinel-proxy ];
serviceConfig.ExecStart = "${sentinel-proxy}/bin/sentinel-proxy"
+ "--ca=${cnf.sentinelCA}"
+ " --token=${cnf.deviceToken}";
};
};
}
|