about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/tor.nix
blob: 71ec9df4641fae14e7645c80feef67ac9d679721 (plain) (blame)
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
import ./make-test-python.nix ({ lib, ... }: with lib;

{
  name = "tor";
  meta.maintainers = with maintainers; [ joachifm ];

  nodes.client = { pkgs, ... }: {
    boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
    networking.firewall.enable = false;
    networking.useDHCP = false;

    environment.systemPackages = with pkgs; [ netcat ];
    services.tor.enable = true;
    services.tor.client.enable = true;
    services.tor.settings.ControlPort = 9051;
  };

  testScript = ''
    client.wait_for_unit("tor.service")
    client.wait_for_open_port(9051)
    assert "514 Authentication required." in client.succeed(
        "echo GETINFO version | nc 127.0.0.1 9051"
    )
  '';
})