blob: 681cb97fb2038ed31e2297f3f02d0a8918b803d4 (
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
|
{ config, pkgs, ... }:
{
users.users.matrirc.isSystemUser = true;
systemd.services.matrirc = {
description = "matrirc service";
serviceConfig = {
BindReadOnlyPaths = [
"/etc/ssl/certs/ca-certificates.crt"
];
Type = "simple";
User = "matrirc";
EnvironmentFile = "/etc/nixos/secrets/matrirc";
StateDirectory = "matrirc";
ExecStart = "${pkgs.matrirc}/bin/matrirc";
Restart = "always";
NoNewPrivileges = "yes";
};
wantedBy = [ "default.target" ];
confinement = {
enable = true;
binSh = null;
mode = "chroot-only";
};
};
services.stunnel = {
enable = true;
servers = {
bitlbee = {
accept = ":::16697";
connect = 16667;
cert = "/var/lib/acme/jormungand.codewreck.org/full.pem";
};
};
};
systemd.services.stunnel = {
serviceConfig.BindReadOnlyPaths = [
"/var/lib/acme/jormungand.codewreck.org/full.pem"
"/dev/null" "/etc/passwd" "/etc/group"
];
confinement = {
enable = true;
binSh = null;
mode = "chroot-only";
};
};
networking.firewall.extraCommands = ''
ip6tables -A nixos-fw -p tcp -m tcp --dport 16697 -s 2001:41d0:1:7a93::1 -j ACCEPT
'';
}
|