Unverified Commit 98e4dad0 authored by Grimmauld's avatar Grimmauld Committed by GitHub
Browse files

ligolo-ng: refactor (#458429)

parents 5863cca8 75d0f2f2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -14586,6 +14586,12 @@
    githubId = 737767;
    name = "Thomas Gerbet";
  };
  letgamer = {
    github = "Letgamer";
    githubId = 62446107;
    matrix = "@letgamer:tchncs.de";
    name = "Alex Stephan";
  };
  lethalman = {
    email = "lucabru@src.gnome.org";
    github = "lucabrunox";
+39 −10
Original line number Diff line number Diff line
@@ -2,38 +2,67 @@
  lib,
  buildGoModule,
  fetchFromGitHub,
  nix-update-script,
  pkgsCross ? { },
  versionCheckHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "ligolo-ng";
  version = "0.8.2";

  src = fetchFromGitHub {
    owner = "tnpitsecurity";
    owner = "nicocha30";
    repo = "ligolo-ng";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-ND0SFB0xj4WK6okNzChZWfK5bhNc4PTWuZoq/PodTW0=";
  };

  vendorHash = "sha256-oc85xNPMFeaPC7TMcSh3i3Msd8sCJ5QGFmi2fKjcyvk=";

  postConfigure = ''
    export CGO_ENABLED=0
  '';
  env.CGO_ENABLED = 0;

  subPackages = [
    "cmd/agent"
    "cmd/proxy"
  ];

  ldflags = [
    "-s"
    "-w"
    "-extldflags '-static'"
    "-X main.version=${finalAttrs.version}"
  ];

  # This will prefix all the binaries with ligolo-
  postInstall = ''
    for f in $out/bin/*; do
      mv "$f" "$(dirname "$f")/ligolo-$(basename "$f")"
    done
  '';

  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/ligolo-agent";
  versionCheckProgramArg = "--version";
  doInstallCheck = true;

  passthru = {
    tests = {
      win = pkgsCross.mingwW64.ligolo-ng or null;
      linux64 = pkgsCross.gnu64.ligolo-ng or null;
    };
    updateScript = nix-update-script { };
  };

  # Tests require network access
  doCheck = false;

  meta = {
    description = "Tunneling/pivoting tool that uses a TUN interface";
    homepage = "https://github.com/tnpitsecurity/ligolo-ng";
    changelog = "https://github.com/nicocha30/ligolo-ng/releases/tag/v${version}";
    description = "Advanced TUN-based tunneling/pivoting tool";
    homepage = "https://github.com/nicocha30/ligolo-ng";
    changelog = "https://github.com/nicocha30/ligolo-ng/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ letgamer ];
    platforms = lib.platforms.linux ++ lib.platforms.windows;
  };
}
})