From 8434df5efd9292190774211ae15995b26a290f2d Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 23 Dec 2023 13:57:04 +0100 Subject: [PATCH] certificate-ripper: init at 2.2.0 --- .../fix-test-temp-dir-path.patch | 13 ++++ .../make-deterministic.patch | 68 +++++++++++++++++++ .../by-name/ce/certificate-ripper/package.nix | 56 +++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 pkgs/by-name/ce/certificate-ripper/fix-test-temp-dir-path.patch create mode 100644 pkgs/by-name/ce/certificate-ripper/make-deterministic.patch create mode 100644 pkgs/by-name/ce/certificate-ripper/package.nix diff --git a/pkgs/by-name/ce/certificate-ripper/fix-test-temp-dir-path.patch b/pkgs/by-name/ce/certificate-ripper/fix-test-temp-dir-path.patch new file mode 100644 index 000000000000..ff9b7d3bebd5 --- /dev/null +++ b/pkgs/by-name/ce/certificate-ripper/fix-test-temp-dir-path.patch @@ -0,0 +1,13 @@ +diff --git a/src/test/java/nl/altindag/crip/command/FileBaseTest.java b/src/test/java/nl/altindag/crip/command/FileBaseTest.java +index 674ca10..f140601 100644 +--- a/src/test/java/nl/altindag/crip/command/FileBaseTest.java ++++ b/src/test/java/nl/altindag/crip/command/FileBaseTest.java +@@ -26,7 +26,7 @@ import java.util.stream.Collectors; + + public class FileBaseTest extends BaseTest { + +- protected static final Path TEMP_DIRECTORY = Paths.get(System.getProperty("user.home"), "certificate-ripper-temp"); ++ protected static final Path TEMP_DIRECTORY = Paths.get(System.getenv("TMP"), "certificate-ripper-temp"); + + @BeforeEach + void createTempDirAndClearConsoleCaptor() throws IOException { diff --git a/pkgs/by-name/ce/certificate-ripper/make-deterministic.patch b/pkgs/by-name/ce/certificate-ripper/make-deterministic.patch new file mode 100644 index 000000000000..b9e7aa1d0a1e --- /dev/null +++ b/pkgs/by-name/ce/certificate-ripper/make-deterministic.patch @@ -0,0 +1,68 @@ +diff --git a/pom.xml b/pom.xml +index dd0075d..46ac184 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -46,6 +46,7 @@ + 4.2.rc3 + 2021 + UTF-8 ++ 1980-01-01T00:00:02Z + + + +@@ -103,6 +104,55 @@ + + + ++ ++ org.apache.maven.plugins ++ maven-enforcer-plugin ++ 3.4.1 ++ ++ ++ enforce-plugin-versions ++ ++ enforce ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ org.apache.maven.plugins ++ maven-deploy-plugin ++ 3.1.1 ++ ++ ++ org.apache.maven.plugins ++ maven-resources-plugin ++ 3.3.1 ++ ++ ++ org.apache.maven.plugins ++ maven-site-plugin ++ 4.0.0-M13 ++ ++ ++ org.apache.maven.plugins ++ maven-install-plugin ++ 3.1.1 ++ ++ ++ org.apache.maven.plugins ++ maven-clean-plugin ++ 3.3.2 ++ ++ ++ org.apache.maven.plugins ++ maven-jar-plugin ++ 3.3.0 ++ ++ + + org.apache.maven.plugins + maven-compiler-plugin diff --git a/pkgs/by-name/ce/certificate-ripper/package.nix b/pkgs/by-name/ce/certificate-ripper/package.nix new file mode 100644 index 000000000000..0b03b395789f --- /dev/null +++ b/pkgs/by-name/ce/certificate-ripper/package.nix @@ -0,0 +1,56 @@ +{ lib +, maven +, fetchFromGitHub +, buildGraalvmNativeImage +}: + +let + pname = "certificate-ripper"; + version = "2.2.0"; + + jar = maven.buildMavenPackage { + pname = "${pname}-jar"; + inherit version; + + src = fetchFromGitHub { + owner = "Hakky54"; + repo = "certificate-ripper"; + rev = version; + hash = "sha256-snavZVLY8sHinLnG6k61eSQlR9sb8+k5tRHqu4kzQKM="; + }; + + patches = [ + ./make-deterministic.patch + ./fix-test-temp-dir-path.patch + ]; + + mvnHash = "sha256-ahw9VVlvBPlWChcJzXFna55kxqVeJMmdaLtwWcJ+qSA="; + + installPhase = '' + install -Dm644 target/crip.jar $out + ''; + }; +in +buildGraalvmNativeImage { + inherit pname version; + + src = jar; + + executable = "crip"; + + # Copied from pom.xml + extraNativeImageBuildArgs = [ + "--no-fallback" + "-H:ReflectionConfigurationResources=graalvm_config.json" + "-H:EnableURLProtocols=https" + "-H:EnableURLProtocols=http" + ]; + + meta = { + changelog = "https://github.com/Hakky54/certificate-ripper/releases/tag/${version}"; + description = "A CLI tool to extract server certificates"; + homepage = "https://github.com/Hakky54/certificate-ripper"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ tomasajt ]; + }; +}