From c727083e6565293c0e38f033fc1db07b187bddb0 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 30 Jun 2019 14:04:22 +0000 Subject: [PATCH 1/2] gnupg: change default keyserver to non-SKS See https://gist.github.com/rjhansen/67ab921ffb4084c865b3618d6955275f. The SKS network is vulnerable to certificate poisoning, which can destroy GnuPG installations. keys.openpgp.org is a new non-SKS keyserver that is resistant to this type of attack. With such an attack being possible, it is unsafe to use SKS keyservers for almost anything, and so we should protect our users from a now unsafe default. keys.openpgp.org offers some (but not all) functionality of SKS, and is better than nothing. This default is only present in gnupg22. gnupg20 and gnupg1orig are not affected. --- pkgs/tools/security/gnupg/22.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/security/gnupg/22.nix b/pkgs/tools/security/gnupg/22.nix index b360992c6bef..978bf1d4e4b5 100644 --- a/pkgs/tools/security/gnupg/22.nix +++ b/pkgs/tools/security/gnupg/22.nix @@ -33,7 +33,10 @@ stdenv.mkDerivation rec { patches = [ ./fix-libusb-include-path.patch ]; - postPatch = stdenv.lib.optionalString stdenv.isLinux '' + postPatch = '' + sed -i 's,hkps://hkps.pool.sks-keyservers.net,hkps://keys.openpgp.org,g' \ + configure doc/dirmngr.texi doc/gnupg.info-1 + '' + stdenv.lib.optionalString stdenv.isLinux '' sed -i 's,"libpcsclite\.so[^"]*","${stdenv.lib.getLib pcsclite}/lib/libpcsclite.so",g' scd/scdaemon.c ''; #" fix Emacs syntax highlighting :-( From ba23c14b842e50cb9d8a228a6007207f2c28c1fe Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 30 Jun 2019 19:05:31 +0000 Subject: [PATCH 2/2] gnupg: apply default server CA verification patch See discussion at https://github.com/NixOS/nixpkgs/pull/63952#issuecomment-507048690. Upstream commit: commit 1c9cc97e9d47d73763810dcb4a36b6cdf31a2254 Author: Daniel Kahn Gillmor Date: Sun Jun 30 11:54:35 2019 -0400 dirmngr: Only use SKS pool CA for SKS pool * dirmngr/http.c (http_session_new): when checking whether the keyserver is the HKPS pool, check specifically against the pool name, as ./configure might have been used to select a different default keyserver. It makes no sense to apply Kristian's certificate authority to anything other than the literal host hkps.pool.sks-keyservers.net. Signed-off-by: Daniel Kahn Gillmor GnuPG-Bug-Id: 4593 --- pkgs/tools/security/gnupg/22.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/security/gnupg/22.nix b/pkgs/tools/security/gnupg/22.nix index 978bf1d4e4b5..359432791b7f 100644 --- a/pkgs/tools/security/gnupg/22.nix +++ b/pkgs/tools/security/gnupg/22.nix @@ -1,5 +1,5 @@ -{ fetchurl, stdenv, pkgconfig, libgcrypt, libassuan, libksba, libgpgerror -, libiconv, npth, gettext, texinfo, pcsclite, sqlite +{ fetchurl, fetchpatch, stdenv, pkgconfig, libgcrypt, libassuan, libksba +, libgpgerror, libiconv, npth, gettext, texinfo, pcsclite, sqlite , buildPackages # Each of the dependencies below are optional. @@ -32,6 +32,10 @@ stdenv.mkDerivation rec { patches = [ ./fix-libusb-include-path.patch + (fetchpatch { + url = https://files.gnupg.net/file/data/qmxjhc6kuja3orybj7st/PHID-FILE-vvzlnw36427pdnug2amc/file; + sha256 = "13snxkmlgmvn0rgxh5k2sgxkp5mbxqiznzm45sw649nvs3ccghq8"; + }) ]; postPatch = '' sed -i 's,hkps://hkps.pool.sks-keyservers.net,hkps://keys.openpgp.org,g' \