depot/third_party/nixpkgs/nixos/tests/tor.nix
Default email ffc78d3539 Project import generated by Copybara.
GitOrigin-RevId: d9dba88d08a9cdf483c3d45f0d7220cf97a4ce64
2021-01-05 19:05:55 +02:00

30 lines
776 B
Nix

import ./make-test-python.nix ({ lib, ... }: with lib;
rec {
name = "tor";
meta.maintainers = with maintainers; [ joachifm ];
common =
{ ... }:
{ boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
networking.firewall.enable = false;
networking.useDHCP = false;
};
nodes.client =
{ pkgs, ... }:
{ imports = [ common ];
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"
)
'';
})