我对如何进一步研究这一点感到有些不知所措,因此我们将非常感谢指针。
我正在运行Ubuntu 17.04,我大致相信我的升级时间(之前运行的是16.10)我无法再更新(或使用任何“来自互联网”)R内的任何内容 - 它在SSL上失败为了一切。 R之外的所有“正常”SSL流量都可以正常工作。
例如,在执行install.packages("curl")
时,我收到以下错误消息:
Warning in install.packages :
URL 'https://cran.rstudio.com/src/contrib/PACKAGES.rds': status was 'SSL connect error'
Warning in install.packages :
URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz': status was 'SSL connect error'
Warning in install.packages :
URL 'https://cran.rstudio.com/src/contrib/PACKAGES': status was 'SSL connect error'
Warning in install.packages :
... [etc] ...
但是,如果我在命令行上运行curl -v "https://cran.rstudio.com/src/contrib/PACKAGES.rds" -o test.curl
,一切正常。
* Trying 10.26.0.19...
* TCP_NODELAY set
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to (nil) (10.26.0.19) port 3128 (#0)
* Establish HTTP proxy tunnel to cran.rstudio.com:443
* Proxy auth using Basic with user '[redacted]'
> CONNECT cran.rstudio.com:443 HTTP/1.1
> Host: cran.rstudio.com:443
> Proxy-Authorization: Basic [redacted]
> User-Agent: curl/7.52.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* Proxy replied OK to CONNECT request
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /home/csafferling/programs/anaconda3/ssl/cacert.pem
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):{ [76 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):{ [4787 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: OU=Domain Control Validated; CN=cran.rstudio.com
* start date: Jun 30 19:59:41 2015 GMT
* expire date: Jun 30 19:59:41 2018 GMT
* subjectAltName: host "cran.rstudio.com" matched cert's "cran.rstudio.com"
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify ok.} [5 bytes data]
> GET /src/contrib/PACKAGES.rds HTTP/1.1
> Host: cran.rstudio.com
> User-Agent: curl/7.52.1
> Accept: */*
> { [5 bytes data]
< HTTP/1.1 200 OK
< Content-Length: 251020
< Connection: keep-alive
< Date: Wed, 12 Jul 2017 14:11:48 GMT
< Server: Apache/2.2.22 (Ubuntu)
< Last-Modified: Wed, 12 Jul 2017 13:02:43 GMT
< ETag: "d78fc54-3d48c-5541e6e7d22c0"
< Accept-Ranges: bytes
< Cache-Control: max-age=1800
< Expires: Wed, 12 Jul 2017 14:41:48 GMT
< Age: 1045
< X-Cache: Hit from cloudfront
< Via: 1.1 67284fcf464f6f1529cc1e521669622c.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: CqpfjeemEcxkxFYJueqzwUEu8Yh-qSenHJJiR2BdmqmAYLpu2_54dA==
< { [15891 bytes data]
* Curl_http_done: called premature == 0 100 245k 100 245k 0 0 583k 0 --:--:-- --:--:-- --:--:-- 589k
* Connection #0 to host (nil) left intact
我注意到的一件事是命令行curl
使用我的anaconda
安装的CA,这确实非常奇怪。也许R使用默认CA,它们不起作用?就像我说的,只有R无法使用SSL,其他一切都有效。
非常感谢任何帮助!
答案 0 :(得分:1)
亲爱的Christoph Saffering,
我的感觉是您已经使用RStudio / R来解决CRAN ssh by default
问题。
将以下内容添加到目标计算机.Rprofile
options(download.file.method = "wget")
local({
r<- getOption("repos");
r["CRAN"] <-"https://cran.rstudio.com/"
options(repos=r)
})
当R通过HTTP传输文件时(例如,使用install.packages或download.file函数),将根据download.file.method选项选择下载方法。有几种方法可用,如果没有明确指定选项,则默认行为是使用R的内部HTTP实现。在许多情况下,此内部方法不支持HTTPS连接,因此您需要覆盖默认值。
R 3.2包括两个支持HTTPS连接的新下载方法(“libcurl”和“wininet”)。我们建议您在R 3.2下运行时使用这些新方法。添加到.Rprofile或Rprofile.site的必备代码如下:
options(download.file.method = "wininet")
请注意,在即将推出的R 3.2.2版本中,这将不再需要,因为默认方法相当于“wininet”。
options(download.file.method = "libcurl")
请注意,如果您从源代码构建R,则“libcurl”方法可能已编译或未编译。如果不是(即功能(&#34; libcurl&#34;)== FALSE) ,您可以按照下面R的早期版本的说明来配置备用安全方法。
窗
utils::setInternet2(TRUE)
options(download.file.method = "internal")
请注意,setInternet2(TRUE)是RStudio中的默认值,但不适用于R GUI。如果您不想在Windows上使用setInternet2(TRUE),则配置安全下载的唯一其他方法是在PATH上使用“wget”或“curl”实用程序,如下面针对OS X和Linux所述。
OS X
options(download.file.method = "curl")
Linux的
options(download.file.method = "wget")
请注意,只要必需的二进制文件位于系统PATH中,“curl”和“wget”方法就可以在任何平台上运行。上述建议基于以下事实:“curl”包含在OS X中,“wget”包含在大多数Linux发行版中。
参考:https://support.rstudio.com/hc/en-us/articles/206827897-Secure-Package-Downloads-for-R