devtools::install_github fails with CA cert error

Jonathan Gilligan picture Jonathan Gilligan · Jul 27, 2015 · Viewed 9.7k times · Source

When I try to call install_github, I get the following error (not just for this package, but for all github packages):

> install_github('ramnathv/slidify')
Downloading github repo ramnathv/slidify@master
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the SSL CA cert (path? access rights?)

But if I use RCurl directly to access github with ssl, I don't get any problem:

>  x <- getBinaryURL(
          url='https://github.com/ramnathv/slidify/archive/master.zip',
          followlocation=1L
          )

works with no errors, so RCurl can verify the SSL certificate properly and download the archive file.

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8    
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
 [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RCurl_1.95-4.7 bitops_1.0-6   devtools_1.8.0

loaded via a namespace (and not attached):
 [1] httr_1.0.0      R6_2.1.0        magrittr_1.5    rversions_1.0.2
 [5] tools_3.2.1     curl_0.9.1      Rcpp_0.12.0     memoise_0.2.1  
 [9] xml2_0.1.1      stringi_0.5-5   git2r_0.10.1    stringr_1.0.0  
 [13] digest_0.6.8   

And

> curlVersion()

$age
[1] 3

$version
[1] "7.38.0"

$vesion_num
[1] 468480

$host
[1] "x86_64-pc-linux-gnu"

$features
   ipv6         ssl        libz        ntlm   asynchdns      spnego 
      1           4           8          16         128         256 
   largefile         idn tlsauth_srp     ntlm_wb 
    512        1024       16384       32768 

$ssl_version
[1] "OpenSSL/1.0.1k"

$ssl_version_num
[1] 0

$libz_version
[1] "1.2.8"

$protocols
[1] "dict"   "file"   "ftp"    "ftps"   "gopher" "http"   "https"  "imap"  
[9] "imaps"  "ldap"   "ldaps"  "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp"   
[17] "sftp"   "smtp"   "smtps"  "telnet" "tftp"  

$ares
[1] ""

$ares_num
[1] 0

$libidn
[1] "1.29"

If I use httr::set_config( httr::config( ssl_verifypeer = 0L ) ) then I can successfully run install_github but I would prefer to actually check ssl certificates.

Can anyone offer a solution?

Answer

Jonathan Gilligan picture Jonathan Gilligan · Aug 13, 2015

Finally figured this out.

I had two different ssl libraries installed and for some reason, the RCurl package built against libcurl4-openssl-dev and the curl package built against libcurl4-nss-dev, but I had only installed CA keys for openssl, not for nss.

I solved my problem with remove.packages('curl') in R and then quitting R and from the shell apt-get remove libcurl4-nss-dev starting R and install.packages('curl')

My mistake, which led to my question, was to test the SSL CA handling using RCurl instead of httr or curl, which would have led me quickly to the fact that my curl package was linked to the wrong SSL library.