devtools::install_github error: SEC_E_UNTRUSTED_ROOT - The certification chain was issued by an entity that is unreliable

2

I am trying to install an package from behind a corporate (fire)wall using devtools:

library(devtools)
devtools::install_github("aryoda/tryCatchLog")

I get an error message:

Error: Failed to install 'unknown package' from GitHub:   schannel:
next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325)
- The certification chain was issued by an entity that is unreliable.

The reason seems to be the used curl package which produces the same error with:

library(curl)
curl::curl_fetch_memory("https://httpbin.org/get")

How can I fix this?

PS: I am using MS Windows 10

r
curl
certificate
devtools
asked on Stack Overflow Sep 5, 2019 by R Yoda • edited Sep 7, 2019 by R Yoda

1 Answer

1

I have found the solution:

The internet connection does only work within curl if you set the correct HTTPS_PROXY:

# insert your correct domain name and IP port here
Sys.setenv(https_proxy = "http://httpproxy.mycompany.com:1234")

This devtools issue comment did help me: https://github.com/r-lib/devtools/issues/1610#issuecomment-333344548

Update 1:

This is a generic solution to set the HTTP(S)_PROXY in R:

requires(curl)
requires(devtools)

proxy <- curl::ie_get_proxy_for_url("https://www.qwant.com/")

Sys.setenv(https_proxy=proxy)
# Sys.setenv(http_proxy=proxy)  # you could also set an HTTP proxy

devtools::install_github("aryoda/tryCatchLog") # should work now

You could add this line to your Rprofile.site file (in R/etc folder)

answered on Stack Overflow Sep 7, 2019 by R Yoda • edited Sep 9, 2019 by R Yoda

User contributions licensed under CC BY-SA 3.0