Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Error message: SSL certificate expired #28

Closed
thatslifescience opened this issue Jun 2, 2020 · 8 comments
Closed

Error message: SSL certificate expired #28

thatslifescience opened this issue Jun 2, 2020 · 8 comments

Comments

@thatslifescience
Copy link

When trying to conduct searches using the rbhl package, I'm getting the following error message:
Error in curl::curl_fetch_memory(x$url$url, handle = x$url$handle) :
SSL certificate problem: certificate has expired

I've set my API key in .Renviron. This error message came up after using bhl_namesearch(). Is this a problem on my end? Thanks!

Session Info
Session info ────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.0 (2020-04-24)
 os       macOS Mojave 10.14.6        
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2020-06-02Packages ────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
 backports     1.1.6   2020-04-05 [1] CRAN (R 4.0.0)
 callr         3.4.3   2020-03-28 [1] CRAN (R 4.0.0)
 cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.0)
 colorspace    1.4-1   2019-03-18 [1] CRAN (R 4.0.0)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
 crul          0.9.0   2019-11-06 [1] CRAN (R 4.0.0)
 curl        * 4.3     2019-12-02 [1] CRAN (R 4.0.0)
 desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.0)
 devtools      2.3.0   2020-04-10 [1] CRAN (R 4.0.0)
 digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.0)
 dplyr         0.8.5   2020-03-07 [1] CRAN (R 4.0.0)
 ellipsis      0.3.0   2019-09-20 [1] CRAN (R 4.0.0)
 fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
 fs            1.4.1   2020-04-04 [1] CRAN (R 4.0.0)
 ggplot2       3.3.0   2020-03-05 [1] CRAN (R 4.0.0)
 glue          1.4.1   2020-05-13 [1] CRAN (R 4.0.0)
 gtable        0.3.0   2019-03-25 [1] CRAN (R 4.0.0)
 httpcode      0.3.0   2020-04-10 [1] CRAN (R 4.0.0)
 jsonlite      1.6.1   2020-02-02 [1] CRAN (R 4.0.0)
 lattice       0.20-41 2020-04-02 [1] CRAN (R 4.0.0)
 lifecycle     0.2.0   2020-03-06 [1] CRAN (R 4.0.0)
 magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.0)
 Matrix        1.2-18  2019-11-27 [1] CRAN (R 4.0.0)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.0)
 munsell       0.5.0   2018-06-12 [1] CRAN (R 4.0.0)
 pillar        1.4.4   2020-05-05 [1] CRAN (R 4.0.0)
 pkgbuild      1.0.8   2020-05-07 [1] CRAN (R 4.0.0)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.0)
 pkgload       1.0.2   2018-10-29 [1] CRAN (R 4.0.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.0)
 processx      3.4.2   2020-02-09 [1] CRAN (R 4.0.0)
 ps            1.3.3   2020-05-08 [1] CRAN (R 4.0.0)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.0)
 R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.0)
 rbhl        * 0.9.0   2020-01-29 [1] CRAN (R 4.0.0)
 Rcpp          1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0)
 remotes       2.1.1   2020-02-15 [1] CRAN (R 4.0.0)
 rlang         0.4.6   2020-05-02 [1] CRAN (R 4.0.0)
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.0)
 rstudioapi    0.11    2020-02-07 [1] CRAN (R 4.0.0)
 scales        1.1.1   2020-05-11 [1] CRAN (R 4.0.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.0)
 testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.0)
 tibble        3.0.1   2020-04-20 [1] CRAN (R 4.0.0)
 tidyselect    1.1.0   2020-05-11 [1] CRAN (R 4.0.0)
 triebeard     0.3.0   2016-08-04 [1] CRAN (R 4.0.0)
 urltools      1.7.3   2019-04-14 [1] CRAN (R 4.0.0)
 usethis       1.6.1   2020-04-29 [1] CRAN (R 4.0.0)
 vctrs         0.3.0   2020-05-11 [1] CRAN (R 4.0.0)
 withr         2.2.0   2020-04-20 [1] CRAN (R 4.0.0)
 xml2          1.3.2   2020-04-23 [1] CRAN (R 4.0.0)

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
@sckott
Copy link
Contributor

sckott commented Jun 2, 2020

Thanks @thatslifescience I've just noticed this yesterday. I've reached out to BHL

@jeroen
Copy link

jeroen commented Jun 3, 2020

This is a global problem with many servers right now due to a major CA root cert being expired that turned out to be still used on many servers.

See details e.g. here https://calnetweb.berkeley.edu/calnet-technologists/incommon-sectigo-certificate-service/addtrust-external-root-expiration-may-2020

or here: https://support.sectigo.com/articles/Knowledge/Sectigo-AddTrust-External-CA-Root-Expiring-May-30-2020

Recent browsers and TLS libraries already have a workaround for this problem, so they are not affected, but some older versions are. As a workaround until the server has updated their certs, you can build the R curl package from source against libcurl from homebrew:

brew install curl
export PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig"
R

And then in R:

install.packages("curl", type = "source")

And then it should work.

@sckott
Copy link
Contributor

sckott commented Jun 3, 2020

worked for me, @thatslifescience let us know if the solution above works

@thatslifescience
Copy link
Author

It's still not working, but it could be that I'm not following the code correctly in my Mac terminal. I successfully downloaded homebrew, installed curl through brew, and ran the command line for the PKG_CONFIG_PATH. When opening R in terminal, I get the following error message:

install.packages("curl", type = "source")
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object r'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libfontconfig.1.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: Incompatible library version: libtk8.6.dylib requires version 11.0.0 or later, but libfontconfig.1.dylib provides version 10.0.0.

I've tried installing the package in RStudio after running the command lines in terminal, still doesn't work. I also tried directly in R console and I get a new error message:

install.packages("curl", type="source")
--- Please select a CRAN mirror for use in this session --- # I select the closest USA
Warning: unable to access index for repository https://cran.case.edu/src/contrib:
cannot open URL 'https://cran.case.edu/src/contrib/PACKAGES'
Warning message:
package ‘curl’ is not available (for R version 4.0.0).

Is there a way to download the package using homebrew in RStudio?

@jeroen
Copy link

jeroen commented Jun 7, 2020

@thatslifescience are you using the official R from cran ? Also make sure you install xquartz as described on that page.

@thatslifescience
Copy link
Author

Whoops, I was using terminal. I downloaded xquartz and I'm using official R from CRAN. In xquartz I followed jeroen's steps, but when I try to install curl I'm now getting this message:

Warning: unable to access index for repository https://cran.case.edu/src/contrib:
  cannot open URL 'https://cran.case.edu/src/contrib/PACKAGES'
Warning message:
package 'curl' is not available (for R version 4.0.0) 

I then tried the code below, which worked, but I'm assuming this did the opposite of building the package locally (and it the bhl search still didn't work):
install.packages("curl", type = "source", repos = "http://cran.rstudio.com/")

Just to be clear, once the package is installed, I'm doing the following to check if it worked:

library(curl)
library(rbhl)
Sys.setenv(BHL_KEY = "my_key")
bhl_authorsearch(name='dimmock')

@sckott
Copy link
Contributor

sckott commented Jun 24, 2020

@thatslifescience still having the problem?

@Lithobius
Copy link

This is a global problem with many servers right now due to a major CA root cert being expired that turned out to be still used on many servers.

See details e.g. here https://calnetweb.berkeley.edu/calnet-technologists/incommon-sectigo-certificate-service/addtrust-external-root-expiration-may-2020

or here: https://support.sectigo.com/articles/Knowledge/Sectigo-AddTrust-External-CA-Root-Expiring-May-30-2020

Recent browsers and TLS libraries already have a workaround for this problem, so they are not affected, but some older versions are. As a workaround until the server has updated their certs, you can build the R curl package from source against libcurl from homebrew:

brew install curl
export PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig"
R

And then in R:

install.packages("curl", type = "source")

And then it should work.

I have used this solution four times now, several months apart, on three different computers running different OSX versions and it works every time.

I just want to say thanks for posting it!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants