How do I update Ruby Gems from behind a Proxy (ISA

2019-01-01 12:00发布

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?

... or am I just being lazy?

Note: rubysspi-1.2.4 does not work.

This also works for "igem", part of the IronRuby project

18条回答
千与千寻千般痛.
2楼-- · 2019-01-01 12:31

A workaround is to install http://apserver.sourceforge.net on your local machine, configure it and run gems through this proxy.

  • Install: Just download apserver 097 (and not the experimental 098!) and unpack.
  • Configure: Edit the server.cfg file and put the values for your MS proxy in PARENT_PROXY and PARENT_PROXY_PORT. Enter the values for DOMAIN and USER. Leave PASSWORD blank (nothing after the colon) – you will be prompted when launching it.
  • Run apserver: cd aps097; python main.py
  • Run Gems: gem install—http-proxy http://localhost:5865/ library
查看更多
怪性笑人.
3楼-- · 2019-01-01 12:33

I tried all the above solutions, however none of them worked. If you're on linux/macOS i highly suggest using tsocks over an ssh tunnel. What you need in order to get this setup working is a machine where you can log in via ssh, and in addition to that a programm called tsocks installed.

The idea here is to create a dynamic tunnel via SSH (a socks5 proxy). We then configure tsocks to use this tunnel and to start our applications, in this case:

tsocks gem install ...

or to account for rails 3.0:

tsocks bundle install

A more detailed guide can be found under:

http://blog.byscripts.info/2011/04/bypass-a-proxy-with-ssh-tunnel-and-tsocks-under-ubuntu/

Despite being written for Ubuntu the procedure should be applicable for all Unix based machines. An alternative to tsocks for Windows is FreeCap (http://www.freecap.ru/eng/). A viable SSH client on windows is called putty.

查看更多
忆尘夕之涩
4楼-- · 2019-01-01 12:33

rubysspi-1.3.1 worked for me on Windows 7, using the instructions from this page:

http://www.stuartellis.eu/articles/installing-ruby/

查看更多
情到深处是孤独
5楼-- · 2019-01-01 12:35

I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my HTTP_PROXY environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:

SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT%

I set the four referenced variables before I get to this line obviously. As an example if my username is "wolfbyte", my password is "secret" and my proxy is called "pigsy" and operates on port 8080:

SET HTTP_PROXY=http://wolfbyte:secret@pigsy:8080

You might want to be careful how you manage that because it stores your password in plain text in the machine's session but I don't think it should be too much of an issue.

查看更多
余生无你
6楼-- · 2019-01-01 12:35

If you are on a *nix system, use this:

export http_proxy=http://${proxy.host}:${port}
export https_proxy=http://${proxy.host}:${port}

and then try:

gem install ${gem_name}
查看更多
明月照影归
7楼-- · 2019-01-01 12:37

I've been using cntlm (http://cntlm.sourceforge.net/) at work. Configuration is very similar to ntlmaps.

Works great, and also allows me to connect my Ubuntu box to the ISA proxy.

Check out http://cntlm.wiki.sourceforge.net/ for more information

查看更多
登录 后发表回答