summaryrefslogtreecommitdiff
path: root/app-crypt/monkeysphere
diff options
context:
space:
mode:
Diffstat (limited to 'app-crypt/monkeysphere')
-rw-r--r--app-crypt/monkeysphere/Manifest24
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_default_shell.patch12
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_hd_od.patch14
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_non_default_port.patch14
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_openpgp2ssh_sanity_check.patch34
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_tests_gnupg2.patch50
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.36_userid_empty_line.patch12
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.37_default_shell.patch12
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.37_hd_od.patch14
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.38-asprintf.patch45
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.38-revert-executable-patch.patch98
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.38-syssharedir-whitespace.patch53
-rw-r--r--app-crypt/monkeysphere/files/monkeysphere-0.39-make-tests-work-with-gnupg-2.1.15.patch45
-rw-r--r--app-crypt/monkeysphere/metadata.xml8
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.36-r1.ebuild57
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.36-r2.ebuild67
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.37.ebuild57
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.38.ebuild60
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.39.ebuild56
-rw-r--r--app-crypt/monkeysphere/monkeysphere-0.41.ebuild54
20 files changed, 786 insertions, 0 deletions
diff --git a/app-crypt/monkeysphere/Manifest b/app-crypt/monkeysphere/Manifest
new file mode 100644
index 000000000000..fca383926336
--- /dev/null
+++ b/app-crypt/monkeysphere/Manifest
@@ -0,0 +1,24 @@
+AUX monkeysphere-0.36_default_shell.patch 466 BLAKE2B be3f2818c3d31400235fe413fb55ea79cdad0cf441a3a841465d11c9467f948f790337dfc1c07bd1bead1f3c58a3b157800b64eb9bc98ada7f263fd7b1c221f4 SHA512 c77042e07372ae2b7434c03529a10afd5d13f99af025cecf53bd433341a3c70ada4cedd904de67090f36cd3dcd7f77f7a46b739116b1248b432803fc137fa7e8
+AUX monkeysphere-0.36_hd_od.patch 528 BLAKE2B 9ba0ae67297716b2379fc7141f6e60f0af68f9290654641946ad94fb6e04d16ede747bd334639c96c6f241e98331cba1373bf5a1c012a15460b58cffe0227ce3 SHA512 412656731fced9ca5e7b1c253e8cacfc47bf45ce7ff28da9e1db1582aa84fa75f098cdd098dc6d33198eedbc87ea397569ebf0045b6291106481e7a11fb04e55
+AUX monkeysphere-0.36_non_default_port.patch 418 BLAKE2B 8abc99d21b539e1b11eab3c689783646c15337e3276c55baf8ef43577fc08c1cd68c85f6555a8685ba1741988e0f2ae31b757795a40ecd30411b00e05958799b SHA512 2a173500e0b659a79a7274e042e49a282f708cda0f6a78ce8fa126013e35c4f6f117e606b90ce31da5158e58ab52a236038a913cc98c5ae1fc8e04a5dcbf816e
+AUX monkeysphere-0.36_openpgp2ssh_sanity_check.patch 1194 BLAKE2B af75804e5ea457c63e6e904e2f1ffde393e3ab06a8222527b825212f44b253ad7d418a1d10a6abd2204332065a2ba5bbbdff09a14181f0fc8bcac6808cdc64fd SHA512 b14c421e5880407b3acb845b235c89c5338a1fc1285b514679de09371db38e42aa3371ef2916c57d5ab10f08bc19f5c864762ff7eaf0a054d2817bc6bcaab488
+AUX monkeysphere-0.36_tests_gnupg2.patch 2272 BLAKE2B fd690dfe4fd357f7a6c551698c8cc897d2c5f34ae44fffd77f4a63de9a25173b3f84dfe7aa3877cd0c724650de250c72ee55f63e1aa658421188658691f02270 SHA512 e75f82793419dd2e99aa95765e9d954437d0e78294ed4188a9e7fa246b85ddbcd755eb566a1e9a9c20f2f2634150d65caa0715993863f59f9146f5cc95457975
+AUX monkeysphere-0.36_userid_empty_line.patch 292 BLAKE2B 5ce813bca6235a365d69f3c8d19b6f39dbb981af57e8171efeeb921f2e0b9c4e73c531838a87e3275809e427a3d7b7e75ad88341ab3dc05a5258f6a7fab6af6d SHA512 15b8e8ff71537e79d069d0f298326cc6705931c58ff1cf2f16c5486e587fe69f610dc1e0ebd0006e0bdef12f936685a0594dc3f9dbdadb928fba25a8e2982eb7
+AUX monkeysphere-0.37_default_shell.patch 466 BLAKE2B be3f2818c3d31400235fe413fb55ea79cdad0cf441a3a841465d11c9467f948f790337dfc1c07bd1bead1f3c58a3b157800b64eb9bc98ada7f263fd7b1c221f4 SHA512 c77042e07372ae2b7434c03529a10afd5d13f99af025cecf53bd433341a3c70ada4cedd904de67090f36cd3dcd7f77f7a46b739116b1248b432803fc137fa7e8
+AUX monkeysphere-0.37_hd_od.patch 528 BLAKE2B 9ba0ae67297716b2379fc7141f6e60f0af68f9290654641946ad94fb6e04d16ede747bd334639c96c6f241e98331cba1373bf5a1c012a15460b58cffe0227ce3 SHA512 412656731fced9ca5e7b1c253e8cacfc47bf45ce7ff28da9e1db1582aa84fa75f098cdd098dc6d33198eedbc87ea397569ebf0045b6291106481e7a11fb04e55
+AUX monkeysphere-0.38-asprintf.patch 1569 BLAKE2B 2acab74551104685ff7735ba732362be00fcaa4e83326b52a36fda5ad514a5f367f03889e05181013531b1f1a15a36dbd80085cac6271f4484e399fd6839b150 SHA512 d750a948a9149c6110ca513743403588b4d861fbbe5c661401f4e0406d4ecbf03d9ca02e4eaf4f469aaa23925f2bc8dde4c155d72fadf26c02291e76571a6c70
+AUX monkeysphere-0.38-revert-executable-patch.patch 4379 BLAKE2B e599a5e13454aa9748c57d02df67f902b9337b345347622fdbdda428b0340a8672baef2ee254a17526077cc56eb2563b248a4bf42db8f24f374f139ffddfed4f SHA512 21c38c63200de7250ce90724f3dd51ee39fc2110f52b0815a592d4c49e7c32e08b3aa56b17b5a680e77727793768bed04938e7d3e85a15308ef894fbe2593f8b
+AUX monkeysphere-0.38-syssharedir-whitespace.patch 2408 BLAKE2B 89fa5bafb1c450216bdbabb7c202f2ad472c4a06720c976798852c2f8c996328e0da2dfc4c7bfaff212cd689609658976d5afa5795ed8c9c99eedc82d8ff7ca6 SHA512 7287ddcead490b188265c7bd001072125e5abe25431303853ba7bd512330d8bef9197b563745211dbde358a4107880915bd8489164be1dce72e46d9d790d2620
+AUX monkeysphere-0.39-make-tests-work-with-gnupg-2.1.15.patch 1700 BLAKE2B 81e72232976d71d7b3570c0fbb4852862997fe7e38e5858826fb1772fb8dbb51b1790e9c99bb6fcd082a54f0d9556ca0e05aa1ea34a2e5410da4ea6f4e938399 SHA512 1a23a1f02e98c86f45701105819ea1ff78f87132d7195ac2aebb0fda8c867b360e12ab8701c9579625af6d54851db30a93647c351ecbb3d99c5963b039628cbb
+DIST monkeysphere_0.36.orig.tar.gz 98876 BLAKE2B 5f8dcd5349cd038208fcc00dff19c7d001ca8b763f223e832c820bc4f09391ff78667f80af691c0234aed810f4d5aa77d26a378a88b41a4b115ab528e0cdd9ed SHA512 eb6776bd9996db8a5d6a1d16b5b06e6733069cbb3cb35f4e3965508575e084c6f08576f31c71429432daf93910d145804ecf155c3d7550a0f4550a056cb4f0c8
+DIST monkeysphere_0.37.orig.tar.gz 99557 BLAKE2B d32d127927bcf3494933282fcc343ffd32841a8afe84c78b9b29ae30fa374328295d3610475aacd8e2cf0962130c2a73b338c702dff4f904b6fd23b33ad0331b SHA512 ebf636caaa0985a2495314375a9d78d131173ccedc116993e02b7bbc0ddc8c43c718dc65cb725619ecf7e72e0b7e11b941f3eb342d7c23d17ca0507b2ab28512
+DIST monkeysphere_0.38.orig.tar.gz 107546 BLAKE2B 627b0fbed52e651d57fd359e79b91689eeca47ea58335125061cba72f863a582d39536504124e18805c39b3c43e5096edb6db0e32c5c80570689bd55e2936a3b SHA512 fd87460fe16b0133fd507ff93926a5dea6419343b45c3ba33e6e981333646f4fa840c127bb1f3e7750bc3ede66c5e07f4155557a8354cf38d89159422dca390f
+DIST monkeysphere_0.39.orig.tar.gz 107735 BLAKE2B 5e4df72c8c78f6325f79c93b7de1407af2ceb1d2b6be43476d3e0dc5b2505ae97c589deec2bcb64a7dbb3a661221891b89e126086d08df09aef07b07452344f7 SHA512 069acbc3e4f1409a130d4efc95875c72b9e4c55af6ff211fb954a90ff26605ecf9cdbbe7d7f7849de479cafaab7957a33fccefd5f2d54a2317f18bc5454190c2
+DIST monkeysphere_0.41.orig.tar.gz 109040 BLAKE2B dadbd65c879bc8e73e7dd1360ebe7f7242aef125af3907d4487f8d0711afda6d87736ab82938867201eead5c1008d192dbd90602eff5a4843d990b3c87ee2949 SHA512 fcc3dd6c191635ed7ef27a8219d4c9d7043629dc8a02de947fcc4dfc8e612ec767f68d4e4c41252a0c0fc80e4184018e53991d85fcde50cb5def75b925341962
+EBUILD monkeysphere-0.36-r1.ebuild 1187 BLAKE2B 6b0f8b0e240a372e13b1aaf0dd4f7fdbfd08093d2e8f9e0a3dc71e7590643eb814978573a9098a134f402470162459832040252bcb19657a958e7ede5caada87 SHA512 380cd2eb925360506c6a3237d642131c9a6e257e219d19d5b6902034b056f6984296f9f1621d81c012f75456658eb57487fa609a0748df7aa11397fc0d5b89bc
+EBUILD monkeysphere-0.36-r2.ebuild 1781 BLAKE2B 76df9b0b9204bdc2b9250b00e30660ac613c34efa3a2bff2f7a01aa05bf838455c8fd0dda653594619e0255b42ddf7ebcd8f5d3dc3ee65e949948d7249424395 SHA512 f6da7b96ffce5bc0e6eb4fa83df65f47b12882b65fe44f3c8e45b2d38387cc82de9185262ad6fe93a9cddb61929ea3651c7a30979a572dc9ac5a1d24550255f8
+EBUILD monkeysphere-0.37.ebuild 1459 BLAKE2B e9196602c64910a1cc816993c36fce60926354958403c78753cd9eaf5b737ecc6194639614387fa8bd65c4cfb398d0eb548583a95f2b20649f8d7ec575e7355a SHA512 5181dc7b06a7a5910bafe37438c152f54d4c0f6949cc6fc8a8e203324d16c345e18475c7a854709c722ff3d4d72c66b121a653c6f86d3a33a24ad16b0097f0c3
+EBUILD monkeysphere-0.38.ebuild 1635 BLAKE2B 7382941a153716cdafcb925258a75e52cc334cd2ec467f4a1908a03388c92dcc13b05a144d259f727acc93bb5b02133e15e7b91af8d7f1606c2c98de08bea371 SHA512 6dd69c21f73158cc68e4df4c4ba9a3e15387d20effadf8bb3566955acd8b62d9c5e59c8b47d98d3470dc5cfaa9e28e343ac8cec43aed5642b1568352150c3041
+EBUILD monkeysphere-0.39.ebuild 1441 BLAKE2B 588283fd2a272a963781f0ee4a6a1e24b157642a987bd4a54d40e82a3d5cca3d3cb8d408250a369916041abe16ae722824ad863ba4cb374144a0388cd4b841a6 SHA512 1eac7528acd605c46e1b0c869afc43e6e603b4f191650568b5ca9c478f22efdd0b41c31d09daf341309d8a31cdac8f2bc1ac29408f48315709a9923589f46b1a
+EBUILD monkeysphere-0.41.ebuild 1372 BLAKE2B a290eb661701e8e2e930a25c584d54fc9c31b9373e0d181ffaa03074d04b8c39c7540c9e2a5bb4fc4558354103d34d9ebcdee29a5d941b32a7be673f2efb7f9f SHA512 5f044379bf2b0577bd322685eed5951c6271e8b55ee8338ccc517fc239f743ee43160c32b8293e8a8c345ef395fea7845e1cb4ddc33a705f75c5ef25f227b91f
+MISC metadata.xml 251 BLAKE2B 958e5ce6ef310471d4c88ef4cfd054eb9476b56abe4e8b82b003632bae4d56a800530601a7fd4b0129fdf22fe5124e8642f60835c6792cdfe38e09afb2d701ec SHA512 10bbd614739518c3b33fc05f34caa511ad71c599e2df0cb58514f05186b9c4ef73e00e3c78018c38581376a90a7968a01c35620fca32fdc5a91a762233a8c5fd
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_default_shell.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_default_shell.patch
new file mode 100644
index 000000000000..f979114181d1
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_default_shell.patch
@@ -0,0 +1,12 @@
+diff -r d0c02fe6a949 src/share/common
+--- a/src/share/common Sun Oct 06 19:21:18 2013 +0200
++++ b/src/share/common Sun Oct 06 19:21:49 2013 +0200
+@@ -108,7 +108,7 @@
+ # if root, su command as monkeysphere user
+ 'root')
+ # requote arguments using bash builtin feature (see "help printf"):
+- su "$MONKEYSPHERE_USER" -c "$(printf "%q " "$@")"
++ su -s /bin/bash "$MONKEYSPHERE_USER" -c "$(printf "%q " "$@")"
+ ;;
+
+ # otherwise, fail
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_hd_od.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_hd_od.patch
new file mode 100644
index 000000000000..7cdaa74b5735
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_hd_od.patch
@@ -0,0 +1,14 @@
+diff -r 6150774ec7f4 tests/keytrans
+--- a/tests/keytrans Sun Feb 16 20:11:02 2014 +0100
++++ b/tests/keytrans Sun Feb 16 20:11:40 2014 +0100
+@@ -104,8 +104,8 @@
+ <(gpg --list-packets < "$TEMPDIR"/converted.secret.key)
+
+ diff -u \
+- <(hd "$TEMPDIR"/secret.key) \
+- <(hd "$TEMPDIR"/converted.secret.key)
++ <(od -xc "$TEMPDIR"/secret.key) \
++ <(od -xc "$TEMPDIR"/converted.secret.key)
+
+ KEYFPR=$(gpg --fingerprint --with-colons --list-keys | grep ^fpr | cut -f10 -d:)
+ KEYID=$(printf "%s" "$KEYFPR" | cut -b25-40)
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_non_default_port.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_non_default_port.patch
new file mode 100644
index 000000000000..f14550280fcf
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_non_default_port.patch
@@ -0,0 +1,14 @@
+diff -r 5f7ee764ec1f src/share/common
+--- a/src/share/common Mon Oct 07 19:22:36 2013 +0200
++++ b/src/share/common Mon Oct 07 19:22:58 2013 +0200
+@@ -863,6 +863,10 @@
+ ;;
+ ('known_hosts')
+ host=${userID#ssh://}
++ if [[ "${host}" == *:* ]]; then
++ IFS=':' read -a ARR <<< "${host}"
++ host="[${ARR[0]}]:${ARR[1]}"
++ fi
+ remove_line "$keyFile" "$host" "$sshKey"
+ ;;
+ esac
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_openpgp2ssh_sanity_check.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_openpgp2ssh_sanity_check.patch
new file mode 100644
index 000000000000..aec90eb07661
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_openpgp2ssh_sanity_check.patch
@@ -0,0 +1,34 @@
+diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication
+index edc7995..2711ff2 100755
+--- a/src/monkeysphere-authentication
++++ b/src/monkeysphere-authentication
+@@ -84,6 +84,13 @@ gpg_sphere() {
+ su_monkeysphere_user gpg --fixed-list-mode --no-greeting --quiet --no-tty "$@"
+ }
+
++check_openpgp2ssh_sanity() {
++ if [[ `su_monkeysphere_user openpgp2ssh ABC &>/dev/null || echo $?` != "255" ]]; then
++ echo "openpgp2ssh command gives unexpected return code. This can lead to a scenario where no authorized keys are populated, even though they are otherwise valid. Aborting!"
++ exit 1
++ fi;
++}
++
+ # output to stdout the core fingerprint from the gpg core secret
+ # keyring
+ core_fingerprint() {
+@@ -163,6 +170,7 @@ case $COMMAND in
+ 'update-users'|'update-user'|'update'|'u')
+ source "${MASHAREDIR}/setup"
+ setup
++ check_openpgp2ssh_sanity
+ source "${MASHAREDIR}/update_users"
+ OUTPUT_STDOUT= update_users "$@"
+ ;;
+@@ -171,6 +179,7 @@ case $COMMAND in
+ (( $# > 0 )) || failure "Must specify user."
+ source "${MASHAREDIR}/setup"
+ setup
++ check_openpgp2ssh_sanity
+ source "${MASHAREDIR}/update_users"
+ OUTPUT_STDOUT=true update_users "$1"
+ ;;
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_tests_gnupg2.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_tests_gnupg2.patch
new file mode 100644
index 000000000000..712734459054
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_tests_gnupg2.patch
@@ -0,0 +1,50 @@
+diff -r c13f4b11061e tests/keytrans
+--- a/tests/keytrans Sun Feb 16 19:24:08 2014 +0100
++++ b/tests/keytrans Sun Feb 16 19:27:42 2014 +0100
+@@ -131,9 +131,9 @@
+ cat >"$TEMPDIR"/expectedout <<EOF
+ pub:u:1024:1:$KEYID:$timestamp:::u:::scSC:
+ uid:u::::$timestamp::E90EC72E68C6C2A0751DADC70F54F60D27B88C3D::monkeymonkey:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
+ uid:u::::$timestamp::8200BD0425CC70C7D698DF3FE412044EAAB83F94::testtest:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
+ EOF
+
+ diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -v ^tru)
+@@ -159,10 +159,10 @@
+ cat >"$TEMPDIR"/expectedout <<EOF
+ pub:u:1024:1:$KEYID:$timestamp:::u:::scSC:
+ uid:u::::$timestamp::E90EC72E68C6C2A0751DADC70F54F60D27B88C3D::monkeymonkey:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
+ uid:r::::::8200BD0425CC70C7D698DF3FE412044EAAB83F94::testtest:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
+-rev:!::1:$KEYID:$revtime::::monkeymonkey:30x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
++rev:!::1:$KEYID:$revtime::::monkeymonkey:30x:::::8:
+ EOF
+
+
+@@ -190,15 +190,15 @@
+ cat >"$TEMPDIR"/expectedout <<EOF
+ pub:u:1024:1:$KEYID:$timestamp:::u:::scSC:
+ uid:u::::$timestamp::E90EC72E68C6C2A0751DADC70F54F60D27B88C3D::monkeymonkey:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
+ uid:r::::::8200BD0425CC70C7D698DF3FE412044EAAB83F94::testtest:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
+-rev:!::1:$KEYID:$revtime::::monkeymonkey:30x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
++rev:!::1:$KEYID:$revtime::::monkeymonkey:30x:::::8:
+ uid:u::::$timestamp::EDDC32D783E7F4C7B6982D9AE5DC4A61000648BA::baz:
+-sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:
++sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8:
+ pub:-:1024:1:$NEWKEYID:$(($timestamp + 1)):::-:::caCA:
+ uid:-::::$(($timestamp + 1))::A0D708F51CC257DEFC01AEDE1E0A5F329DFD8F16::fubar:
+-sig:!::1:$NEWKEYID:$(($timestamp + 1))::::fubar:13x:
++sig:!::1:$NEWKEYID:$(($timestamp + 1))::::fubar:13x:::::8:
+ EOF
+
+ echo "test: diff expected gpg list output"
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.36_userid_empty_line.patch b/app-crypt/monkeysphere/files/monkeysphere-0.36_userid_empty_line.patch
new file mode 100644
index 000000000000..70c7cffe7dc4
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.36_userid_empty_line.patch
@@ -0,0 +1,12 @@
+diff -r 2315bb7781c6 src/share/common
+--- a/src/share/common Thu Oct 10 19:25:10 2013 +0200
++++ b/src/share/common Thu Oct 10 19:25:50 2013 +0200
+@@ -917,7 +917,7 @@
+ IFS=$'\n'
+ while read line ; do
+ case "$line" in
+- ("#"*)
++ ("#"*|"")
+ continue
+ ;;
+ (" "*|$'\t'*)
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.37_default_shell.patch b/app-crypt/monkeysphere/files/monkeysphere-0.37_default_shell.patch
new file mode 100644
index 000000000000..f979114181d1
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.37_default_shell.patch
@@ -0,0 +1,12 @@
+diff -r d0c02fe6a949 src/share/common
+--- a/src/share/common Sun Oct 06 19:21:18 2013 +0200
++++ b/src/share/common Sun Oct 06 19:21:49 2013 +0200
+@@ -108,7 +108,7 @@
+ # if root, su command as monkeysphere user
+ 'root')
+ # requote arguments using bash builtin feature (see "help printf"):
+- su "$MONKEYSPHERE_USER" -c "$(printf "%q " "$@")"
++ su -s /bin/bash "$MONKEYSPHERE_USER" -c "$(printf "%q " "$@")"
+ ;;
+
+ # otherwise, fail
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.37_hd_od.patch b/app-crypt/monkeysphere/files/monkeysphere-0.37_hd_od.patch
new file mode 100644
index 000000000000..7cdaa74b5735
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.37_hd_od.patch
@@ -0,0 +1,14 @@
+diff -r 6150774ec7f4 tests/keytrans
+--- a/tests/keytrans Sun Feb 16 20:11:02 2014 +0100
++++ b/tests/keytrans Sun Feb 16 20:11:40 2014 +0100
+@@ -104,8 +104,8 @@
+ <(gpg --list-packets < "$TEMPDIR"/converted.secret.key)
+
+ diff -u \
+- <(hd "$TEMPDIR"/secret.key) \
+- <(hd "$TEMPDIR"/converted.secret.key)
++ <(od -xc "$TEMPDIR"/secret.key) \
++ <(od -xc "$TEMPDIR"/converted.secret.key)
+
+ KEYFPR=$(gpg --fingerprint --with-colons --list-keys | grep ^fpr | cut -f10 -d:)
+ KEYID=$(printf "%s" "$KEYFPR" | cut -b25-40)
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.38-asprintf.patch b/app-crypt/monkeysphere/files/monkeysphere-0.38-asprintf.patch
new file mode 100644
index 000000000000..dbf9d5f590ca
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.38-asprintf.patch
@@ -0,0 +1,45 @@
+From b756fd2e58ab013b5c9bfc2658ed9ad48868067c Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Date: Sun, 7 Aug 2016 18:24:47 -0400
+Subject: [PATCH] avoid warning about unused asprintf return value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+some versions of gcc produce this warning, which is treated as an
+error due to our conservative defaults in Makefile:
+
+src/agent-transfer/main.c: In function ‘main’:
+src/agent-transfer/main.c:676:5: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
+ asprintf (&alt_comment, "GnuPG keygrip %s", args.keygrip);
+ ^
+cc1: all warnings being treated as errors
+
+this patch avoids the warning.
+---
+ src/agent-transfer/main.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/agent-transfer/main.c b/src/agent-transfer/main.c
+index 406aaa3..3038f5c 100644
+--- a/src/agent-transfer/main.c
++++ b/src/agent-transfer/main.c
+@@ -672,8 +672,13 @@ int main (int argc, const char* argv[]) {
+ return 1;
+ }
+
+- if (!args.comment)
+- asprintf (&alt_comment, "GnuPG keygrip %s", args.keygrip);
++ if (!args.comment) {
++ err = asprintf (&alt_comment, "GnuPG keygrip %s", args.keygrip);
++ if (err < 0) {
++ fprintf (stderr, "failed to generate key comment\n");
++ return 1;
++ }
++ }
+
+ err = send_to_ssh_agent (&e, ssh_sock_fd, args.seconds, args.confirm,
+ args.comment ? args.comment : alt_comment);
+--
+2.7.3
+
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.38-revert-executable-patch.patch b/app-crypt/monkeysphere/files/monkeysphere-0.38-revert-executable-patch.patch
new file mode 100644
index 000000000000..4d98c0a7cf5b
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.38-revert-executable-patch.patch
@@ -0,0 +1,98 @@
+From c75c7553a88e387013e2b4310f4c4956adfd8a98 Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Date: Mon, 8 Aug 2016 20:45:07 -0400
+Subject: [PATCH 1/2] avoid treating src/share/common as an executable
+
+having src/share/common treated as an executable (commit
+ed10318d3760b56e57d5e1bef04ab57761ab8bd1) was actually a terrible
+idea.
+
+In addition to causing "monkeysphere version" to print the version
+number twice, it meant that any invocation of a monkeysphere command
+that sourced src/share/common and had a first argument that happened
+to be a function name would accidentally invoke that function.
+
+This commit reverts that idea.
+---
+ Makefile | 2 +-
+ src/share/common | 5 -----
+ src/share/ma/add_certifier | 2 +-
+ src/share/ma/update_users | 2 +-
+ src/share/mh/add_revoker | 2 +-
+ 5 files changed, 4 insertions(+), 9 deletions(-)
+ mode change 100755 => 100644 src/share/common
+
+diff --git a/Makefile b/Makefile
+index 608a317..768564a 100755
+--- a/Makefile
++++ b/Makefile
+@@ -55,7 +55,7 @@ install: all installman
+ install src/monkeysphere-authentication $(DESTDIR)$(PREFIX)/sbin
+ sed -i 's:__SYSSHAREDIR_PREFIX__:$(PREFIX):' $(DESTDIR)$(PREFIX)/sbin/monkeysphere-authentication
+ install src/monkeysphere-authentication-keys-for-user $(DESTDIR)$(PREFIX)/share/monkeysphere
+- install -m 0755 src/share/common $(DESTDIR)$(PREFIX)/share/monkeysphere
++ install -m 0644 src/share/common $(DESTDIR)$(PREFIX)/share/monkeysphere
+ install -m 0644 src/share/defaultenv $(DESTDIR)$(PREFIX)/share/monkeysphere
+ sed -i 's:__SYSCONFDIR_PREFIX__:$(ETCPREFIX):' $(DESTDIR)$(PREFIX)/share/monkeysphere/defaultenv
+ sed -i 's:__SYSDATADIR_PREFIX__:$(LOCALSTATEDIR):' $(DESTDIR)$(PREFIX)/share/monkeysphere/defaultenv
+diff --git a/src/share/common b/src/share/common
+old mode 100755
+new mode 100644
+index 66181a3..b10a040
+--- a/src/share/common
++++ b/src/share/common
+@@ -1,4 +1,3 @@
+-#!/usr/bin/env bash
+ # -*-shell-script-*-
+ # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
+
+@@ -1022,7 +1021,3 @@ report_cruft() {
+ printf "The directories above are backups left over from a monkeysphere transition.\nThey may contain copies of sensitive data (host keys, certifier lists), but\nthey are no longer needed by monkeysphere.\nYou may remove them at any time.\n\n" | log info
+ fi
+ }
+-
+-if [ -n "$1" ] && [ "$(type -t "$1" || true)" = "function" ]; then
+- "$@"
+-fi
+diff --git a/src/share/ma/add_certifier b/src/share/ma/add_certifier
+index 1d450e7..5416aa9 100644
+--- a/src/share/ma/add_certifier
++++ b/src/share/ma/add_certifier
+@@ -101,7 +101,7 @@ if [ -f "$keyID" -o "$keyID" = '-' ] ; then
+ # check the key is ok as monkeysphere user before loading
+ log debug "checking keys in file..."
+ fingerprint=$(su_monkeysphere_user \
+- "${SYSSHAREDIR}/common" list_primary_fingerprints < "$keyID")
++ bash -c ". ${SYSSHAREDIR}/common && list_primary_fingerprints" < "$keyID")
+
+ if [ $(printf "%s" "$fingerprint" | egrep -c '^[A-F0-9]{40}$') -ne 1 ] ; then
+ failure "There was not exactly one gpg key in the file."
+diff --git a/src/share/ma/update_users b/src/share/ma/update_users
+index d23c125..4f83e0c 100644
+--- a/src/share/ma/update_users
++++ b/src/share/ma/update_users
+@@ -79,7 +79,7 @@ for uname in $unames ; do
+
+ # process authorized_user_ids file, as monkeysphere user
+ su_monkeysphere_user \
+- /usr/bin/env "STRICT_MODES=$STRICT_MODES" "${SYSSHAREDIR}/common" process_authorized_user_ids - \
++ /usr/bin/env "STRICT_MODES=$STRICT_MODES" bash -c ". ${SYSSHAREDIR}/common && process_authorized_user_ids -" \
+ < "$authorizedUserIDs" \
+ > "$tmpAuthorizedKeys"
+
+diff --git a/src/share/mh/add_revoker b/src/share/mh/add_revoker
+index 28b11ac..e00ac4e 100644
+--- a/src/share/mh/add_revoker
++++ b/src/share/mh/add_revoker
+@@ -52,7 +52,7 @@ if [ -f "$revokerKeyID" -o "$revokerKeyID" = '-' ] ; then
+ # check the key is ok as monkeysphere user before loading
+ log debug "checking keys in file..."
+ fingerprint=$(su_monkeysphere_user \
+- "${SYSSHAREDIR}/common" list_primary_fingerprints < "$revokerKeyID")
++ bash -c ". ${SYSSHAREDIR}/common && list_primary_fingerprints" < "$revokerKeyID")
+
+ if [ $(printf "%s" "$fingerprint" | egrep -c '^[A-F0-9]{40}$') -ne 1 ] ; then
+ failure "There was not exactly one gpg key in the file."
+--
+2.7.3
+
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.38-syssharedir-whitespace.patch b/app-crypt/monkeysphere/files/monkeysphere-0.38-syssharedir-whitespace.patch
new file mode 100644
index 000000000000..65d3ba6a95aa
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.38-syssharedir-whitespace.patch
@@ -0,0 +1,53 @@
+From 0e339de4772b6de1849dc55790821c3dd5943be3 Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Date: Tue, 9 Aug 2016 09:39:45 -0400
+Subject: [PATCH 2/2] ensure that this works even if SYSSHAREDIR has whitespace
+
+---
+ src/share/ma/add_certifier | 2 +-
+ src/share/ma/update_users | 2 +-
+ src/share/mh/add_revoker | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/share/ma/add_certifier b/src/share/ma/add_certifier
+index 5416aa9..9488806 100644
+--- a/src/share/ma/add_certifier
++++ b/src/share/ma/add_certifier
+@@ -101,7 +101,7 @@ if [ -f "$keyID" -o "$keyID" = '-' ] ; then
+ # check the key is ok as monkeysphere user before loading
+ log debug "checking keys in file..."
+ fingerprint=$(su_monkeysphere_user \
+- bash -c ". ${SYSSHAREDIR}/common && list_primary_fingerprints" < "$keyID")
++ bash -c "$(printf ". %q && list_primary_fingerprints" "${SYSSHAREDIR}/common")" < "$keyID")
+
+ if [ $(printf "%s" "$fingerprint" | egrep -c '^[A-F0-9]{40}$') -ne 1 ] ; then
+ failure "There was not exactly one gpg key in the file."
+diff --git a/src/share/ma/update_users b/src/share/ma/update_users
+index 4f83e0c..a0ec21b 100644
+--- a/src/share/ma/update_users
++++ b/src/share/ma/update_users
+@@ -79,7 +79,7 @@ for uname in $unames ; do
+
+ # process authorized_user_ids file, as monkeysphere user
+ su_monkeysphere_user \
+- /usr/bin/env "STRICT_MODES=$STRICT_MODES" bash -c ". ${SYSSHAREDIR}/common && process_authorized_user_ids -" \
++ /usr/bin/env "STRICT_MODES=$STRICT_MODES" bash -c "$(printf ". %q && process_authorized_user_ids -" "${SYSSHAREDIR}/common")"\
+ < "$authorizedUserIDs" \
+ > "$tmpAuthorizedKeys"
+
+diff --git a/src/share/mh/add_revoker b/src/share/mh/add_revoker
+index e00ac4e..de08961 100644
+--- a/src/share/mh/add_revoker
++++ b/src/share/mh/add_revoker
+@@ -52,7 +52,7 @@ if [ -f "$revokerKeyID" -o "$revokerKeyID" = '-' ] ; then
+ # check the key is ok as monkeysphere user before loading
+ log debug "checking keys in file..."
+ fingerprint=$(su_monkeysphere_user \
+- bash -c ". ${SYSSHAREDIR}/common && list_primary_fingerprints" < "$revokerKeyID")
++ bash -c "$(printf ". %q && list_primary_fingerprints" "${SYSSHAREDIR}/common")" < "$revokerKeyID")
+
+ if [ $(printf "%s" "$fingerprint" | egrep -c '^[A-F0-9]{40}$') -ne 1 ] ; then
+ failure "There was not exactly one gpg key in the file."
+--
+2.7.3
+
diff --git a/app-crypt/monkeysphere/files/monkeysphere-0.39-make-tests-work-with-gnupg-2.1.15.patch b/app-crypt/monkeysphere/files/monkeysphere-0.39-make-tests-work-with-gnupg-2.1.15.patch
new file mode 100644
index 000000000000..776e633b3d73
--- /dev/null
+++ b/app-crypt/monkeysphere/files/monkeysphere-0.39-make-tests-work-with-gnupg-2.1.15.patch
@@ -0,0 +1,45 @@
+From b1dd8fb1b84c6eea25523c3ea746852b3dce6034 Mon Sep 17 00:00:00 2001
+From: Valo <valo@autoproduzioni.net>
+Date: Wed, 31 Aug 2016 14:00:05 -0400
+Subject: [PATCH] Make tests pass with GnuPG 2.1.15
+
+2.1.15 appears to always emit the fingerprint lines in these cases,
+while 2.1.14 did not.
+---
+ tests/keytrans | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/keytrans b/tests/keytrans
+index 3076e3f..5c7d2c8 100755
+--- a/tests/keytrans
++++ b/tests/keytrans
+@@ -140,7 +140,7 @@ uid:u::::$timestamp::8200BD0425CC70C7D698DF3FE412044EAAB83F94::testtest
+ sig:!::1:$KEYID:$timestamp::::monkeymonkey:13x:::::8
+ EOF
+
+-diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -v ^tru | sed 's/:*$//')
++diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -vE '^(tru|fpr):' | sed 's/:*$//')
+
+ echo "##################################################"
+ echo "### sleeping to avoid test suite breakage on fast"
+@@ -170,7 +170,7 @@ rev:!::1:$KEYID:$revtime::::monkeymonkey:30x:::::8
+ EOF
+
+
+-diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -v ^tru | sed 's/:*$//')
++diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -vE '^(tru|fpr):' | sed 's/:*$//')
+
+
+ echo "##################################################"
+@@ -206,7 +206,7 @@ sig:!::1:$NEWKEYID:$(($timestamp + 1))::::fubar:13x:::::8
+ EOF
+
+ echo "test: diff expected gpg list output"
+-diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -v ^tru | sed 's/:*$//')
++diff -u "$TEMPDIR"/expectedout <(gpg --check-sigs --with-colons | grep -vE '^(tru|fpr):' | sed 's/:*$//')
+
+ sort >"$TEMPDIR"/expectedout <<EOF
+ $KEYFPR
+--
+2.7.3
+
diff --git a/app-crypt/monkeysphere/metadata.xml b/app-crypt/monkeysphere/metadata.xml
new file mode 100644
index 000000000000..91439c59951d
--- /dev/null
+++ b/app-crypt/monkeysphere/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>k_f@gentoo.org</email>
+ <name>Kristian Fiskerstrand</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/app-crypt/monkeysphere/monkeysphere-0.36-r1.ebuild b/app-crypt/monkeysphere/monkeysphere-0.36-r1.ebuild
new file mode 100644
index 000000000000..953836fdace6
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.36-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+SRC_URI="http://archive.${PN}.info/debian/pool/${PN}/${PN::1}/${PN}/${PN}_${PV}.orig.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="test"
+
+# Tests do weird things with network and fail OOTB.
+RESTRICT="test"
+
+RDEPEND="
+ app-crypt/gnupg
+ app-misc/lockfile-progs
+ dev-perl/Crypt-OpenSSL-RSA
+ dev-perl/Digest-SHA1
+ || ( net-analyzer/netcat net-misc/socat )"
+DEPEND="${RDEPEND}
+ test? ( net-misc/socat )"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
+}
+
+src_prepare()
+{
+ epatch "${FILESDIR}/${P}_default_shell.patch" \
+ "${FILESDIR}/${P}_non_default_port.patch" \
+ "${FILESDIR}/${P}_userid_empty_line.patch"
+
+ sed -i "s#share/doc/${PN}#share/doc/${PF}#" Makefile || die
+}
+
+src_install()
+{
+ default
+
+ dodir /var/lib/${PN}
+ fowners root:${PN} /var/lib/${PN}
+ fperms 751 /var/lib/${PN}
+}
+
+pkg_postinst()
+{
+ ${PN}-authentication setup || die
+}
diff --git a/app-crypt/monkeysphere/monkeysphere-0.36-r2.ebuild b/app-crypt/monkeysphere/monkeysphere-0.36-r2.ebuild
new file mode 100644
index 000000000000..63a671e3e588
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.36-r2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE=""
+SRC_URI="mirror://debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz"
+KEYWORDS="~amd64 ~arm ~x86"
+
+DOCS=( README Changelog )
+
+# Tests fail upstream for SSH connection. Issue has been reported.
+RESTRICT="test"
+
+DEPEND="app-crypt/gnupg
+ net-misc/socat
+ dev-perl/Crypt-OpenSSL-RSA
+ dev-perl/Digest-SHA1
+ app-misc/lockfile-progs"
+
+RDEPEND="${DEPEND}"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup monkeysphere
+ enewuser monkeysphere -1 -1 /var/lib/monkeysphere monkeysphere
+ # Using fperms and fowner in src_install leave unusable config with error
+ # Authentication refused: bad ownership or modes for directory /var/lib/monkeysphere
+ chown root:monkeysphere /var/lib/monkeysphere
+ chmod 751 /var/lib/monkeysphere
+}
+
+src_prepare()
+{
+ epatch "${FILESDIR}/${P}_default_shell.patch"\
+ "${FILESDIR}/${P}_non_default_port.patch"\
+ "${FILESDIR}/${P}_userid_empty_line.patch"\
+ "${FILESDIR}/${P}_openpgp2ssh_sanity_check.patch"\
+ "${FILESDIR}/${P}_hd_od.patch"
+
+ sed -i "s#share/doc/monkeysphere#share/doc/${PF}#" Makefile || die
+
+ # Output format of gpg --check-sigs differ between 1.4 and 2.0 so test
+ # needs to be updated if 2.0 is used
+ if has_version '>=app-crypt/gnupg-2.0.0:0'; then
+ epatch "${FILESDIR}/${P}_tests_gnupg2.patch"
+ fi;
+}
+
+src_install()
+{
+ default
+ dodir /var/lib/monkeysphere
+}
+
+pkg_postinst()
+{
+ #This function is idempotent, make sure it is run at least once.
+ monkeysphere-authentication setup || die
+}
diff --git a/app-crypt/monkeysphere/monkeysphere-0.37.ebuild b/app-crypt/monkeysphere/monkeysphere-0.37.ebuild
new file mode 100644
index 000000000000..7276dff3dadb
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.37.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+
+LICENSE="GPL-3"
+SLOT="0/0"
+IUSE=""
+SRC_URI="mirror://debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz"
+KEYWORDS="amd64 ~arm x86"
+
+DOCS=( README Changelog )
+
+# Tests fail upstream for SSH connection. Issue has been reported.
+RESTRICT="test"
+
+DEPEND="app-crypt/gnupg:0=
+ net-misc/socat:0=
+ dev-perl/Crypt-OpenSSL-RSA:0=
+ dev-perl/Digest-SHA1:0=
+ app-misc/lockfile-progs:0="
+
+RDEPEND="${DEPEND}"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup monkeysphere
+ enewuser monkeysphere -1 -1 /var/lib/monkeysphere monkeysphere
+ # Using fperms and fowner in src_install leave unusable config with error
+ # Authentication refused: bad ownership or modes for directory /var/lib/monkeysphere
+ chown root:monkeysphere /var/lib/monkeysphere
+ chmod 751 /var/lib/monkeysphere
+}
+
+src_prepare()
+{
+ epatch "${FILESDIR}/${P}_default_shell.patch"\
+ "${FILESDIR}/${P}_hd_od.patch"
+
+ sed -i "s#share/doc/monkeysphere#share/doc/${PF}#" Makefile || die
+}
+
+src_install()
+{
+ default
+ dodir /var/lib/monkeysphere
+}
+
+pkg_postinst()
+{
+ monkeysphere-authentication setup || die
+}
diff --git a/app-crypt/monkeysphere/monkeysphere-0.38.ebuild b/app-crypt/monkeysphere/monkeysphere-0.38.ebuild
new file mode 100644
index 000000000000..2d718ae60cdc
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.38.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+
+LICENSE="GPL-3"
+SLOT="0/0"
+IUSE=""
+SRC_URI="mirror://debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz"
+KEYWORDS="~amd64 ~arm ~x86"
+
+DOCS=( README Changelog )
+
+# Tests fail upstream for SSH connection. Issue has been reported.
+RESTRICT="test"
+
+DEPEND="app-crypt/gnupg:0=
+ net-misc/socat:0=
+ dev-perl/Crypt-OpenSSL-RSA:0=
+ dev-perl/Digest-SHA1:0=
+ app-misc/lockfile-progs:0="
+
+RDEPEND="${DEPEND}"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup monkeysphere
+ enewuser monkeysphere -1 -1 /var/lib/monkeysphere monkeysphere
+ # Using fperms and fowner in src_install leave unusable config with error
+ # Authentication refused: bad ownership or modes for directory /var/lib/monkeysphere
+ chown root:monkeysphere /var/lib/monkeysphere
+ chmod 751 /var/lib/monkeysphere
+}
+
+src_prepare()
+{
+ epatch "${FILESDIR}/${P}-asprintf.patch" \
+ "${FILESDIR}/${P}-revert-executable-patch.patch"\
+ "${FILESDIR}/${P}-syssharedir-whitespace.patch"\
+ "${FILESDIR}/${PN}-0.37_default_shell.patch"\
+ "${FILESDIR}/${PN}-0.37_hd_od.patch"
+
+ sed -i "s#share/doc/monkeysphere#share/doc/${PF}#" Makefile || die
+}
+
+src_install()
+{
+ default
+ dodir /var/lib/monkeysphere
+}
+
+pkg_postinst()
+{
+ monkeysphere-authentication setup || die
+}
diff --git a/app-crypt/monkeysphere/monkeysphere-0.39.ebuild b/app-crypt/monkeysphere/monkeysphere-0.39.ebuild
new file mode 100644
index 000000000000..a7f0efd409b1
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.39.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+
+LICENSE="GPL-3"
+SLOT="0/0"
+IUSE=""
+SRC_URI="mirror://debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz"
+KEYWORDS="~amd64 ~arm ~x86"
+
+DOCS=( README Changelog )
+
+# Tests fail upstream for SSH connection. Issue has been reported.
+RESTRICT="test"
+
+DEPEND="app-crypt/gnupg:0=
+ net-misc/socat:0=
+ dev-perl/Crypt-OpenSSL-RSA:0=
+ dev-perl/Digest-SHA1:0=
+ app-misc/lockfile-progs:0="
+
+RDEPEND="${DEPEND}"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup monkeysphere
+ enewuser monkeysphere -1 -1 /var/lib/monkeysphere monkeysphere
+ # Using fperms and fowner in src_install leave unusable config with error
+ # Authentication refused: bad ownership or modes for directory /var/lib/monkeysphere
+ chown root:monkeysphere /var/lib/monkeysphere
+ chmod 751 /var/lib/monkeysphere
+}
+
+src_prepare()
+{
+ epatch "${FILESDIR}/${P}-make-tests-work-with-gnupg-2.1.15.patch"
+
+ sed -i "s#share/doc/monkeysphere#share/doc/${PF}#" Makefile || die
+}
+
+src_install()
+{
+ default
+ dodir /var/lib/monkeysphere
+}
+
+pkg_postinst()
+{
+ monkeysphere-authentication setup || die
+}
diff --git a/app-crypt/monkeysphere/monkeysphere-0.41.ebuild b/app-crypt/monkeysphere/monkeysphere-0.41.ebuild
new file mode 100644
index 000000000000..fc2a5255bbe5
--- /dev/null
+++ b/app-crypt/monkeysphere/monkeysphere-0.41.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils user
+
+DESCRIPTION="Leverage the OpenPGP web of trust for OpenSSH and Web authentication"
+HOMEPAGE="http://web.monkeysphere.info/"
+
+LICENSE="GPL-3"
+SLOT="0/0"
+IUSE=""
+SRC_URI="mirror://debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz http://archive.monkeysphere.info/debian/pool/monkeysphere/m/monkeysphere/monkeysphere_${PV}.orig.tar.gz"
+KEYWORDS="amd64 ~arm x86"
+
+DOCS=( README Changelog )
+
+## Tests fail upstream for SSH connection. Issue has been reported.
+RESTRICT="test"
+
+DEPEND="app-crypt/gnupg:0=
+ net-misc/socat:0=
+ dev-perl/Crypt-OpenSSL-RSA:0=
+ dev-perl/Digest-SHA1:0=
+ app-misc/lockfile-progs:0="
+
+RDEPEND="${DEPEND}"
+
+pkg_setup()
+{
+ einfo "Creating named group and user"
+ enewgroup monkeysphere
+ enewuser monkeysphere -1 -1 /var/lib/monkeysphere monkeysphere
+ # Using fperms and fowner in src_install leave unusable config with error
+ # Authentication refused: bad ownership or modes for directory /var/lib/monkeysphere
+ chown root:monkeysphere /var/lib/monkeysphere
+ chmod 751 /var/lib/monkeysphere
+}
+
+src_prepare()
+{
+ sed -i "s#share/doc/monkeysphere#share/doc/${PF}#" Makefile || die
+}
+
+src_install()
+{
+ default
+ dodir /var/lib/monkeysphere
+}
+
+pkg_postinst()
+{
+ monkeysphere-authentication setup || die
+}