summary refs log tree commit diff
path: root/pkgs/tools/security/monkeysphere/default.nix
blob: f4def72b728cf926251fdd64255f433e5ee25059 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ stdenv, fetchurl, makeWrapper
, perl, libassuan, libgcrypt
, perlPackages, lockfileProgs, gnupg
}:

stdenv.mkDerivation rec {
  name = "monkeysphere-${version}";
  version = "0.41";

  src = fetchurl {
    url = "http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${version}.orig.tar.gz";
    sha256 = "0jz7kwkwgylqprnl8bwvl084s5gjrilza77ln18i3f6x48b2y6li";
  };

  patches = [ ./monkeysphere.patch ];

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ perl libassuan libgcrypt ];

  makeFlags = ''
    PREFIX=/
    DESTDIR=$(out)
  '';

  postFixup =
    let wrapperArgs = runtimeDeps:
          "--prefix PERL5LIB : "
          + (with perlPackages; stdenv.lib.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
      '';

  meta = with stdenv.lib; {
    homepage = http://web.monkeysphere.info/;
    description = "Leverage the OpenPGP web of trust for SSH and TLS authentication";
    longDescription = ''
      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;
    platforms = platforms.all;
    maintainers = with maintainers; [ primeos ];
  };
}