Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renv behind a corporate Proxy. Improve documentation? #146

Closed
ugzvot opened this issue Aug 15, 2019 · 3 comments
Closed

renv behind a corporate Proxy. Improve documentation? #146

ugzvot opened this issue Aug 15, 2019 · 3 comments

Comments

@ugzvot
Copy link

@ugzvot ugzvot commented Aug 15, 2019

Like in #64 we have an awful man in the middle Proxy using Windows logins (SSPI) and the ntlm authentication protocol. A good explanation is found in this stackoverflow answer. To make matter worse, the bundled curl is removed from our windows image.

renv::install() fails:

> renv::install("xtable")
Retrieving 'https://cran.rstudio.com/bin/windows/contrib/3.5/xtable_1.8-4.zip' ...
Warning message:
In (function (url, destfile, method, quiet = FALSE, mode = "w",  :
  URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/xtable_1.8-4.zip': status was 'HTTP response code said error'

I found a simple solution in the end, but it was cumbersome to find all the pieces of information:

• Install curl with renv::equip()
• Create following _curlrc in Sys.getenv("HOME") or Sys.getenv("R_USER")

--proxy "your.proxy.dns:port"
--proxy-ntlm
--proxy-user ":"
--insecure

The double quotes are important. : is interpreted as separator. See curl/curl#3738 (comment)

> renv::install("xtable")
Retrieving 'https://cran.rstudio.com/bin/windows/contrib/3.5/xtable_1.8-4.zip' ...
	OK [downloaded 688.3 Kb in 1.9 secs]
Installing xtable [1.8-4] from CRAN ...
	OK (installed binary)
* Copying 'xtable' into the cache ... Done!

edit: Added console output for successful install

kevinushey added a commit that referenced this issue Aug 15, 2019
@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Aug 15, 2019

I'm going to consider it a success that renv was able to work in this configuration without any extra changes from me :-)

I've added some documentation to the Getting Started vignette to give some hints as to how to configure renv + curl to use proxy servers, though. Let me know if you think that's sufficient.

@kevinushey kevinushey closed this Aug 15, 2019
@ugzvot
Copy link
Author

@ugzvot ugzvot commented Aug 16, 2019

Seems good. Perhaps change the last paragraph to:

See the curl documentation on [proxies](https://ec.haxx.se/usingcurl-proxies.html) and [config files](https://ec.haxx.se/cmdline-configfile.html) for more details.

And perhaps add the example _curlrc and drop the keywords ntlm and sspi, something along the lines:

This config file works with a common proxy setup in a windows environment (authentication with ntlm and sspi):

```
--proxy "your.proxy.dns:port"
--proxy-ntlm
--proxy-user ":"
--insecure
```

In the best case it works for the user, else he has some keywords to start googling or asking his IT support.

The curl packages has the helper function curl::ie_get_proxy_for_url() to find the proxy address. Don't know if this should be included.

I struggled mostly with the following points:

  • location of _curlrc. For me sys.getenv("APPDATA") and 'sys.getenv("USERPROFILE")\Application Data' doesn't work. In the end I had to take a look at the renv source code to get a working location. This is resolved with the added sections

  • The --proxy-user ":" switch. i really disliked to store my password in text file. And i asked me how gets RStudio my credentials to download files and packages from cran / github? Found the answer on stackoverflow. I configured the proxy in a .renviron file in Sys.getenv("HOME").

-Then the _curlrc format first i had proxy-user = : and ran into curl/curl#3738 (comment).

As an after thought:
yeah it is definitely a success. And the problems I had, was with the missing curl, the correct curl configuration and missing knowledge about proxy authentication not in renv. renv has even the tools to help me with the missing curl. On the other side, i had a working setup for install.packages() and remotes::install_*.

Yesterday i was just a bit frustrated about how simple the solution is, but i wasted a lot of time to get the configuration right.

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Aug 16, 2019

Thank you for the feedback -- it is hugely appreciated. I've updated the documentation with that example, and also altered how renv looks for _curlrc (since the documentation makes it clear that curl would normally look in %APPDATA% and the other folder as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.