Turning SSL verification off inside download.file

Viewed 1007

Is there a way to disable SSL verification by default inside download.file?

The situation is that we have an internal CRAN mirror in my company, but it uses a self-signed SSL cert. As far as I can tell, this causes download.file to fail, and since install.packages makes use of download.file, this means installing packages also fails. I'd like to turn the verification check off to see if this fixes the problem.

OS is Ubuntu 20.04 (actually running inside a container), R is 4.1.1.

2 Answers

It's possible to get download.file to ignore SSL issues by setting the download method to curl and specifying the appropriate flags:

# -k means don't verify cert, -L means follow redirects (important for some servers)
options(download.file.method="curl", download.file.extra="-k -L")
download.file("https://internal.server/file", "destfile")

However, this requires that the curl commandline tool is installed. This isn't the case for the Docker image I'm using, but that's another problem.

R Studio

Access menu Tools -> Global and click in Packages.

You can disable unchecking "use secure download method for HTTP".

Related