Skip to content

renv behind a corporate Proxy. Improve documentation? #146

Closed

Description

@tva-lks

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

Activity

  1. kevinushey commented on Aug 15, 2019

    @kevinushey
    Collaborator

    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.

  2. tva-lks commented on Aug 16, 2019

    @tva-lks
    Author

    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.

  3. kevinushey commented on Aug 16, 2019

    @kevinushey
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions