2018-09-06 15:09:48 +02:00
|
|
|
{ stdenv, fetchurl, makeWrapper
|
2018-09-07 12:22:56 +02:00
|
|
|
, perl, libassuan, libgcrypt
|
2018-10-19 10:27:36 +02:00
|
|
|
, perlPackages, lockfileProgs, gnupg, coreutils
|
2018-10-17 19:59:15 +02:00
|
|
|
# For the tests:
|
2019-06-16 21:59:06 +02:00
|
|
|
, openssh, which, socat, cpio, hexdump, procps, openssl
|
2018-09-06 15:09:48 +02:00
|
|
|
}:
|
2015-08-01 11:03:40 +02:00
|
|
|
|
2018-12-20 16:41:00 +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 {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "monkeysphere";
|
2019-05-20 21:44:46 +02:00
|
|
|
version = "0.44";
|
2015-08-01 11:03:40 +02:00
|
|
|
|
2018-12-20 16:41:00 +01:00
|
|
|
# The patched OpenSSH binary MUST NOT be used (except in the check phase):
|
|
|
|
disallowedRequisites = [ opensshUnsafe ];
|
|
|
|
|
2015-08-01 11:03:40 +02:00
|
|
|
src = fetchurl {
|
2018-09-06 15:09:48 +02:00
|
|
|
url = "http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${version}.orig.tar.gz";
|
2019-05-20 21:44:46 +02:00
|
|
|
sha256 = "1ah7hy8r9gj96pni8azzjb85454qky5l17m3pqn37854l6grgika";
|
2015-08-01 11:03:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./monkeysphere.patch ];
|
|
|
|
|
2018-10-19 10:27:36 +02:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "s,/usr/bin/env,${coreutils}/bin/env," src/share/ma/update_users
|
|
|
|
'';
|
|
|
|
|
2018-09-07 12:22:56 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2018-10-17 19:59:15 +02:00
|
|
|
buildInputs = [ perl libassuan libgcrypt ]
|
|
|
|
++ stdenv.lib.optional doCheck
|
2019-05-20 21:44:46 +02:00
|
|
|
([ gnupg opensshUnsafe which socat cpio hexdump procps lockfileProgs ] ++
|
2018-10-17 19:59:15 +02:00
|
|
|
(with perlPackages; [ CryptOpenSSLRSA CryptOpenSSLBignum ]));
|
2018-09-07 12:22:56 +02:00
|
|
|
|
2019-10-29 23:21:22 +01:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=/"
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
];
|
2015-08-01 11:03:40 +02:00
|
|
|
|
2018-12-20 16:41:00 +01:00
|
|
|
# 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 19:59:15 +02:00
|
|
|
doCheck = false;
|
2018-12-20 16:41:00 +01:00
|
|
|
preCheck = stdenv.lib.optionalString doCheck ''
|
2018-10-19 10:27:36 +02:00
|
|
|
patchShebangs tests/
|
|
|
|
patchShebangs src/
|
2018-12-20 16:41:00 +01:00
|
|
|
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 19:59:15 +02:00
|
|
|
sed -i "s/<(hd/<(hexdump/" tests/keytrans
|
|
|
|
'';
|
|
|
|
|
2018-09-07 12:22:56 +02:00
|
|
|
postFixup =
|
2018-09-07 13:07:10 +02:00
|
|
|
let wrapperArgs = runtimeDeps:
|
|
|
|
"--prefix PERL5LIB : "
|
2019-05-20 21:44:46 +02:00
|
|
|
+ (with perlPackages; makePerlPath [ # Optional (only required for keytrans)
|
2018-09-07 13:07:10 +02:00
|
|
|
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";
|
2018-09-07 12:22:56 +02:00
|
|
|
wrapPrograms = runtimeDeps: programs: stdenv.lib.concatMapStrings
|
|
|
|
(wrapMonkeysphere runtimeDeps)
|
|
|
|
programs;
|
|
|
|
in wrapPrograms [ gnupg ] [ "monkeysphere-authentication" "monkeysphere-host" ]
|
2019-05-20 21:44:46 +02:00
|
|
|
+ wrapPrograms [ gnupg lockfileProgs ] [ "monkeysphere" ]
|
2018-09-07 13:07:10 +02:00
|
|
|
+ ''
|
|
|
|
# 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 11:03:40 +02:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://web.monkeysphere.info/";
|
2015-08-01 12:28:41 +02:00
|
|
|
description = "Leverage the OpenPGP web of trust for SSH and TLS authentication";
|
|
|
|
longDescription = ''
|
2015-08-01 11:03:40 +02: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.
|
|
|
|
'';
|
2018-09-06 15:09:48 +02:00
|
|
|
license = licenses.gpl3Plus;
|
2019-10-22 11:01:29 +02:00
|
|
|
platforms = platforms.linux;
|
2018-09-06 15:09:48 +02:00
|
|
|
maintainers = with maintainers; [ primeos ];
|
2015-08-01 11:03:40 +02:00
|
|
|
};
|
|
|
|
}
|