]> Git — Sourcephile - sourcephile-nix.git/blob - servers/losurdo/transmission.nix
transmission: fix and improve the hardening
[sourcephile-nix.git] / servers / losurdo / transmission.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config.services) transmission;
4 inherit (config.users) users;
5 in
6 {
7 users.groups.transmission.members = [
8 users."julm".name
9 ];
10 networking.nftables.ruleset = ''
11 add rule inet filter net2fw tcp dport ${toString transmission.settings.peer-port} counter accept comment "Transmission"
12 add rule inet filter net2fw udp dport ${toString transmission.settings.peer-port} counter accept comment "Transmission"
13 add rule inet filter fw2net ip protocol udp skuid ${users.transmission.name} counter accept comment "BitTorrent"
14 '';
15 services.transmission = {
16 enable = true;
17 enableSandbox = true;
18 settings = {
19 dht-enabled = true;
20 download-dir = "Downloads";
21 incomplete-dir-enabled = false;
22 preallocation = 0;
23 umask = 63;
24
25 peer-port = 6882;
26 peer-port-random-on-start = false;
27 port-forwarding-enabled = true;
28
29 speed-limit-up = 50;
30 speed-limit-up-enabled = true;
31 alt-speed-enabled = true;
32 alt-speed-time-enabled = true;
33 alt-speed-down = 0;
34 alt-speed-up = 5;
35 alt-speed-time-day = 127; # all days. 65; # weekend only
36 alt-speed-time-begin = 240; # 04h00 UTC
37 alt-speed-time-end = 1260; # 21h00 UTC
38
39 rpc-enabled = true;
40 rpc-bind-address = "127.0.0.1";
41 rpc-port = 9091;
42 rpc-whitelist = "127.0.0.1";
43 rpc-whitelist-enabled = true;
44 };
45 };
46 }