Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkgs/development/libraries/gnutls/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Version dependent args
, version, src, patches ? [], postPatch ? "", nativeBuildInputs ? []
, buildInputs ? []
, ...}:
, ... }:

assert guileBindings -> guile != null;
let
Expand All @@ -15,10 +15,12 @@ let
doCheck = !stdenv.isFreeBSD && !stdenv.isDarwin && lib.versionAtLeast version "3.4"
&& stdenv.buildPlatform == stdenv.hostPlatform;
in

stdenv.mkDerivation {
name = "gnutls-${version}";
inherit src version;

inherit src patches;
patches = patches ++ [ ./ssl-cert-file.patch ];

outputs = [ "bin" "dev" "out" "man" "devdoc" ];
outputInfo = "devdoc";
Expand Down
36 changes: 36 additions & 0 deletions pkgs/development/libraries/gnutls/ssl-cert-file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 53091092876e668a4c43a4944d1b821015dea7a3 Mon Sep 17 00:00:00 2001
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
Date: Wed, 17 Oct 2018 07:48:34 +0000
Subject: [PATCH] Handle SSL_CERT_FILE environment variable

---
lib/system/certs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/lib/system/certs.c b/lib/system/certs.c
index 53eb561d0..6adb960e3 100644
--- a/lib/system/certs.c
+++ b/lib/system/certs.c
@@ -137,6 +137,19 @@ add_system_trust(gnutls_x509_trust_list_t list,
r += ret;
#endif

+ char *env = secure_getenv("SSL_CERT_FILE");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you ask upstream to incorporate this patch? Even if they refuse to merge it, we still get a code review from them.

Copy link
Member Author

@lukateras lukateras Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sure, I'll try. However, to make it upstreamable it should probably be under a configure option.

The patch is trivial though, this chunk looks exactly like DEFAULT_TRUST_STORE_FILE above it, other than secure_getenv call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it need to be behind a configure option?

Copy link
Member Author

@lukateras lukateras Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I gather, upstream has been hostile to including this previously. So I have little faith for it to be included without it being explicitly enabled by a configure flag, if at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where was this proposed before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual upstream thread where the guix developers talked to gnutls. The gnutls people don't really argue against the patch, they just mention that they think using pkcs11 is a better idea. Not sure if that is applicable for us, if I understand that correctly that needs a central service (hard on non-nixos). But upstream never really said "no that patch is a no-go because...".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes having a service would defeat the motivation we had in the first place.

+
+ if (env != NULL) {
+ ret =
+ gnutls_x509_trust_list_add_trust_file(list,
+ env,
+ crl_file,
+ GNUTLS_X509_FMT_PEM,
+ tl_flags, tl_vflags);
+ if (ret > 0)
+ r += ret;
+ }
+
#ifdef DEFAULT_BLACKLIST_FILE
ret = gnutls_x509_trust_list_remove_trust_file(list, DEFAULT_BLACKLIST_FILE, GNUTLS_X509_FMT_PEM);
if (ret < 0) {
--
2.19.0