2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, makeWrapper, file, findutils
|
2020-04-24 23:36:52 +00:00
|
|
|
, binutils-unwrapped, glibc, coreutils, sysctl, openssl
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "checksec";
|
2021-10-28 06:52:43 +00:00
|
|
|
version = "2.5.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "slimm609";
|
|
|
|
repo = "checksec.sh";
|
|
|
|
rev = version;
|
2021-10-28 06:52:43 +00:00
|
|
|
sha256 = "sha256-GxWXocz+GCEssRrIQP6E9hjVIhVh2EmZrefELxQlV1Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./0001-attempt-to-modprobe-config-before-checking-kernel.patch ];
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = let
|
2021-02-05 17:12:51 +00:00
|
|
|
path = lib.makeBinPath [
|
2020-04-24 23:36:52 +00:00
|
|
|
findutils file binutils-unwrapped sysctl openssl
|
|
|
|
];
|
|
|
|
in ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install checksec $out/bin
|
|
|
|
substituteInPlace $out/bin/checksec --replace /lib/libc.so.6 ${glibc.out}/lib/libc.so.6
|
|
|
|
substituteInPlace $out/bin/checksec --replace "/usr/bin/id -" "${coreutils}/bin/id -"
|
|
|
|
wrapProgram $out/bin/checksec \
|
|
|
|
--prefix PATH : ${path}
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A tool for checking security bits on executables";
|
2021-02-05 17:12:51 +00:00
|
|
|
homepage = "https://www.trapkit.de/tools/checksec/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice globin ];
|
|
|
|
};
|
|
|
|
}
|