3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/monkeysphere/default.nix

104 lines
3.8 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, makeWrapper
, perl, libassuan, libgcrypt
, perlPackages, lockfileProgs, gnupg, coreutils
2018-10-17 18:59:15 +01:00
# For the tests:
, bash, openssh, which, socat, cpio, hexdump, openssl
}:
2015-08-01 10:03:40 +01:00
let
# A patch is needed to run the tests inside the Nix sandbox:
# /etc/passwd: "nixbld:x:1000:100:Nix build user:/build:/noshell"
# sshd: "User nixbld not allowed because shell /noshell does not exist"
opensshUnsafe = openssh.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches ++ [ ./openssh-nixos-sandbox.patch ];
});
in stdenv.mkDerivation rec {
2015-08-01 10:03:40 +01:00
name = "monkeysphere-${version}";
version = "0.43";
2015-08-01 10:03:40 +01:00
# The patched OpenSSH binary MUST NOT be used (except in the check phase):
disallowedRequisites = [ opensshUnsafe ];
2015-08-01 10:03:40 +01:00
src = fetchurl {
url = "http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${version}.orig.tar.gz";
sha256 = "18i7qpvp5qb7mmd0z5rqai550rya9l3nbsq2hamwkl3smqsjdqc0";
2015-08-01 10:03:40 +01:00
};
patches = [ ./monkeysphere.patch ];
postPatch = ''
sed -i "s,/usr/bin/env,${coreutils}/bin/env," src/share/ma/update_users
'';
nativeBuildInputs = [ makeWrapper ];
2018-10-17 18:59:15 +01:00
buildInputs = [ perl libassuan libgcrypt ]
++ stdenv.lib.optional doCheck
([ gnupg opensshUnsafe which socat cpio hexdump lockfileProgs ] ++
2018-10-17 18:59:15 +01:00
(with perlPackages; [ CryptOpenSSLRSA CryptOpenSSLBignum ]));
2015-08-01 10:03:40 +01:00
makeFlags = ''
PREFIX=/
DESTDIR=$(out)
'';
# The tests should be run (and succeed) when making changes to this package
# but they aren't enabled by default because they "drain" entropy (GnuPG
# still uses /dev/random).
2018-10-17 18:59:15 +01:00
doCheck = false;
preCheck = stdenv.lib.optionalString doCheck ''
patchShebangs tests/
patchShebangs src/
sed -i \
-e "s,/usr/sbin/sshd,${opensshUnsafe}/bin/sshd," \
-e "s,/bin/true,${coreutils}/bin/true," \
-e "s,/bin/false,${coreutils}/bin/false," \
-e "s,openssl\ req,${openssl}/bin/openssl req," \
tests/basic
2018-10-17 18:59:15 +01:00
sed -i "s/<(hd/<(hexdump/" tests/keytrans
'';
postFixup =
let wrapperArgs = runtimeDeps:
"--prefix PERL5LIB : "
+ (with perlPackages; makePerlPath [
CryptOpenSSLRSA
CryptOpenSSLBignum
])
+ stdenv.lib.optionalString
(builtins.length runtimeDeps > 0)
" --prefix PATH : ${stdenv.lib.makeBinPath runtimeDeps}";
wrapMonkeysphere = runtimeDeps: program:
"wrapProgram $out/bin/${program} ${wrapperArgs runtimeDeps}\n";
wrapPrograms = runtimeDeps: programs: stdenv.lib.concatMapStrings
(wrapMonkeysphere runtimeDeps)
programs;
in wrapPrograms [ gnupg ] [ "monkeysphere-authentication" "monkeysphere-host" ]
+ wrapPrograms [ lockfileProgs ] [ "monkeysphere" ]
+ ''
# These 4 programs depend on the program name ($0):
for program in openpgp2pem openpgp2spki openpgp2ssh pem2openpgp; do
rm $out/bin/$program
ln -sf keytrans $out/share/monkeysphere/$program
makeWrapper $out/share/monkeysphere/$program $out/bin/$program \
${wrapperArgs [ ]}
done
'';
2015-08-01 10:03:40 +01:00
meta = with stdenv.lib; {
homepage = http://web.monkeysphere.info/;
2015-08-01 11:28:41 +01:00
description = "Leverage the OpenPGP web of trust for SSH and TLS authentication";
longDescription = ''
2015-08-01 10:03:40 +01:00
The Monkeysphere project's goal is to extend OpenPGP's web of
trust to new areas of the Internet to help us securely identify
servers we connect to, as well as each other while we work online.
The suite of Monkeysphere utilities provides a framework to
transparently leverage the web of trust for authentication of
TLS/SSL communications through the normal use of tools you are
familiar with, such as your web browser0 or secure shell.
'';
license = licenses.gpl3Plus;
2015-08-01 10:03:40 +01:00
platforms = platforms.all;
maintainers = with maintainers; [ primeos ];
2015-08-01 10:03:40 +01:00
};
}