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
Posts abound regarding this topic, and to help others save hours of trying different solutions, here is the final result of my hours of tinkering.
The three solutions around the internet at the moment are: rubysspi apserver cntlm
rubysspi only works from a Windows machine, AFAIK, as it relies on the Win32Api library. So if you are on a Windows box trying to run through a proxy, this is the solution for you. If you are on a Linux distro, you're out of luck.
apserver seems to be a dead project. The link listed in the posts I've seen lead to 404 page on sourceforge. I search for "apserver" on sourceforge returns nothing.
The sourceforge link for cntlm that I've seen redirects to http://cntlm.awk.cz/, but that times out. A search on sourceforge turns up this link, which does work: http://sourceforge.net/projects/cntlm/
After downloading and configuring cntlm I have managed to install a gem through the proxy, so this seems to be the best solution for Linux distros.
I tried some of these solutions, and none of them worked. I finally found a solution that works for me:
using the
-p
parameter to pass the proxy. I'm using Gem version 1.9.1.If behind a proxy, you can navigate to Ruby downloads, click on Download, which will download the specified update ( or Gem ) to a desired location.
Next, via Ruby command line, navigate to the downloaded location by using :
pushd [directory]
eg :
pushd D:\Setups
then run the following command:
gem install [update name] --local
eg:
gem install rubygems-update --local
.Tested on Windows 7 with Ruby update version 2.4.1.
To check use following command :
ruby -v
Rather than editing batch files (which you may have to do for other Ruby gems, e.g. Bundler), it's probably better to do this once, and do it properly.
On Windows, behind my corporate proxy, all I had to do was add the
HTTP_PROXY
environment variable to my system.HTTP_PROXY
", and set the Value to your proxy serverDepending on your authentication requirements, the
HTTP_PROXY
value can be as simple as:Or more complex as others have pointed out
This worked for me in a Windows box:
I have a batch file with these lines that I use to set environment values when I need it.
The trick, in my case, was
HTTPS_PROXY
sets. Without them, I always got a 407 proxy authentication error.This solved my problem perfectly:
You might need to add your user name and password to it: