1import ./make-test-python.nix ({ lib, ... }: with lib;
2
3rec {
4 name = "tor";
5 meta.maintainers = with maintainers; [ joachifm ];
6
7 common =
8 { ... }:
9 { boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
10 networking.firewall.enable = false;
11 networking.useDHCP = false;
12 };
13
14 nodes.client =
15 { pkgs, ... }:
16 { imports = [ common ];
17 environment.systemPackages = with pkgs; [ netcat ];
18 services.tor.enable = true;
19 services.tor.client.enable = true;
20 services.tor.settings.ControlPort = 9051;
21 };
22
23 testScript = ''
24 client.wait_for_unit("tor.service")
25 client.wait_for_open_port(9051)
26 assert "514 Authentication required." in client.succeed(
27 "echo GETINFO version | nc 127.0.0.1 9051"
28 )
29 '';
30})