diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-12-09T12·15+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-12-09T12·16+0100 |
commit | d44d923be971a9f9a05b156e20fe2b26151826a9 (patch) | |
tree | 67ddc20d7403aad9247b172bad50b1e2203ac472 /scripts/download-from-binary-cache.pl.in | |
parent | 5510d21193e84067230beb5f755e899180f963a2 (diff) |
Add option to disable binary cache certificate checking
Diffstat (limited to 'scripts/download-from-binary-cache.pl.in')
-rw-r--r-- | scripts/download-from-binary-cache.pl.in | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/download-from-binary-cache.pl.in b/scripts/download-from-binary-cache.pl.in index db030c1dbcaf..0e640ee34757 100644 --- a/scripts/download-from-binary-cache.pl.in +++ b/scripts/download-from-binary-cache.pl.in @@ -47,7 +47,12 @@ $caBundle = "/etc/ssl/certs/ca-certificates.crt" if !$caBundle && -f "/etc/ssl/c my $userName = getpwuid($<) || $ENV{"USER"} or die "cannot figure out user name"; -my $requireSignedBinaryCaches = ($Nix::Config::config{"signed-binary-caches"} // "0") ne "0"; +sub isTrue { + my ($x) = @_; + return $x eq "true" || $x eq "1"; +} + +my $requireSignedBinaryCaches = isTrue($Nix::Config::config{"signed-binary-caches"} // "0"); my $curlConnectTimeout = int( $Nix::Config::config{"untrusted-connect-timeout"} // @@ -69,6 +74,7 @@ sub addRequest { $curl->setopt(CURLOPT_WRITEDATA, $fh); $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); $curl->setopt(CURLOPT_CAINFO, $caBundle) if defined $caBundle; + $curl->setopt(CURLOPT_SSL_VERIFYPEER, 0) unless isTrue($Nix::Config::config{"verify-https-binary-caches"} // "1"); $curl->setopt(CURLOPT_USERAGENT, "Nix/$Nix::Config::version"); $curl->setopt(CURLOPT_NOBODY, 1) if $head; $curl->setopt(CURLOPT_FAILONERROR, 1); |