Commit a667834a authored by Neyts Zupan's avatar Neyts Zupan
Browse files

paretosecurity: 0.2.39 -> 0.3.2

Test for linking had to be removed because now the linking is more
complex and it would take too much mocking to test it.

The test in question was moved to the dashboard codebase that is
closed-source, if that helps in any way.
parent 4c23f3cd
Loading
Loading
Loading
Loading
+6 −44
Original line number Diff line number Diff line
@@ -8,35 +8,8 @@
    {
      imports = [ ./common/user-account.nix ];

      networking.firewall.enable = true;
      services.paretosecurity = {
        enable = true;

        # Create a patched version of the package that points to the local dashboard
        # for easier testing
        package = pkgs.paretosecurity.overrideAttrs (oldAttrs: {
          postPatch = oldAttrs.postPatch or "" + ''
            substituteInPlace team/report.go \
              --replace-warn 'const reportURL = "https://cloud.paretosecurity.com"' \
                             'const reportURL = "http://cloud"'
          '';
        });
      };

    };

  nodes.cloud = {
    networking.firewall.allowedTCPPorts = [ 80 ];
      services.paretosecurity.enable = true;

    services.nginx = {
      enable = true;
      virtualHosts."cloud" = {
        locations."/api/v1/team/".extraConfig = ''
          add_header Content-Type application/json;
          return 200 '{"message": "Linked device."}';
        '';
      };
    };
    };

  nodes.xfce =
@@ -70,9 +43,8 @@
  testScript = ''
    # Test setup
    terminal.succeed("su - alice -c 'mkdir -p /home/alice/.config'")
    for m in [terminal, cloud]:
      m.systemctl("start network-online.target")
      m.wait_for_unit("network-online.target")
    terminal.systemctl("start network-online.target")
    terminal.wait_for_unit("network-online.target")

    # Test 1: Test the systemd socket is installed & enabled
    terminal.succeed('systemctl is-enabled paretosecurity.socket')
@@ -91,17 +63,7 @@
      + "'"
    )

    # Test 3: Test linking
    terminal.succeed("su - alice -c 'paretosecurity link"
    + " paretosecurity://enrollTeam/?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."
    + "eyJ0b2tlbiI6ImR1bW15LXRva2VuIiwidGVhbUlEIjoiZHVtbXktdGVhbS1pZCIsImlhdCI6"
    + "MTcwMDAwMDAwMCwiZXhwIjoxOTAwMDAwMDAwfQ.WgnL6_S0EBJHwF1wEVUG8GtIcoVvK5IjWbZpUeZr4Qw'")

    config = terminal.succeed("cat /home/alice/.config/pareto.toml")
    assert 'AuthToken = "dummy-token"' in config
    assert 'TeamID = "dummy-team-id"' in config

    # Test 4: Test the tray icon
    # Test 3: Test the tray icon
    xfce.wait_for_x()
    for unit in [
        'paretosecurity-trayicon',
@@ -115,7 +77,7 @@
    xfce.succeed("xdotool click 1")
    xfce.wait_for_text("Run Checks")

    # Test 5: Desktop entry
    # Test 4: Desktop entry
    xfce.succeed("xdotool mousemove 10 10")
    xfce.succeed("xdotool click 1")  # hide the tray icon window
    xfce.succeed("xdotool click 1")  # show the Applications menu
@@ -123,7 +85,7 @@
    xfce.succeed("xdotool click 1")
    xfce.wait_for_text("Pareto Security")

    # Test 6: paretosecurity:// URL handler is registered
    # Test 5: paretosecurity:// URL handler is registered
    xfce.succeed("su - alice -c 'xdg-open paretosecurity://foo'")
  '';
}
+3 −3
Original line number Diff line number Diff line
@@ -17,16 +17,16 @@ buildGoModule (finalAttrs: {
    webkitgtk_4_1
  ];
  pname = "paretosecurity";
  version = "0.2.39";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "ParetoSecurity";
    repo = "agent";
    rev = finalAttrs.version;
    hash = "sha256-goINqrt4ZEC5/WklC4D35wMTpjfJ0dZWfGU3vLWTLjM=";
    hash = "sha256-TXKymCFr2lrbgmbCxI3vIKx61nbOaRmuUTwNn7k0Hm0=";
  };

  vendorHash = "sha256-tYpTXCx0vp+JX7keu+m5ePrPlGVJZen38HSfQHS4f7s=";
  vendorHash = "sha256-DlCGCheJHa4HPM7kfX/UbOfLukAiaoP7QZnabkZVASM=";
  proxyVendor = true;

  # Skip building the Windows installer