<p>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?</p>

<p>... or am I just being lazy?</p>

<p>Note: rubysspi-1.2.4 does not work.</p>

<p>This also works for "igem", part of the IronRuby project</p>

[{'answer_id': 4420, 'author': 'Jarin Udom', 'author_id': 574, 'author_profile': 'https://Stackoverflow.com/users/574', 'pm_score': 3, 'selected': False, 'text': '<p>A workaround is to install <a href="http://web.archive.org/web/20060913093359/http://apserver.sourceforge.net:80/" rel="nofollow noreferrer">http://web.archive.org/web/20060913093359/http://apserver.sourceforge.net:80/</a> on your local machine, configure it and run gems through this proxy.</p>\n\n<ul>\n<li>Install: Just download apserver 097 (and not the experimental 098!) and unpack.</li>\n<li>Configure: Edit the server.cfg file and put the values for your MS proxy in <code>PARENT_PROXY</code> and <code>PARENT_PROXY_PORT</code>. Enter the values for DOMAIN and USER. Leave PASSWORD blank (nothing after the colon) – you will be prompted when launching it.</li>\n<li>Run apserver: <code>cd aps097; python main.py</code></li>\n<li>Run Gems: <code>gem install—http-proxy http://localhost:5865/ library</code></li>\n</ul>\n'}, {'answer_id': 4431, 'author': 'Mike Minutillo', 'author_id': 358, 'author_profile': 'https://Stackoverflow.com/users/358', 'pm_score': 9, 'selected': True, 'text': '<p>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 <code>HTTP_PROXY</code> environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:</p>\n\n<pre><code>SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT%\n</code></pre>\n\n<p>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:</p>\n\n<pre><code>SET HTTP_PROXY=http://wolfbyte:secret@pigsy:8080\n</code></pre>\n\n<p>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.</p>\n'}, {'answer_id': 37161, 'author': 'Jason Navarrete', 'author_id': 3920, 'author_profile': 'https://Stackoverflow.com/users/3920', 'pm_score': 6, 'selected': False, 'text': '<p>I\'ve been using cntlm (<a href="http://cntlm.sourceforge.net/" rel="noreferrer">http://cntlm.sourceforge.net/</a>) at work.  Configuration is very similar to ntlmaps.</p>\n\n<ul>\n<li>gem install --http-proxy <a href="http://localhost:3128" rel="noreferrer">http://localhost:3128</a> _name_of_gem_</li>\n</ul>\n\n<p>Works great, and also allows me to connect my Ubuntu box to the ISA proxy.</p>\n\n<p>Check out <a href="http://cntlm.wiki.sourceforge.net/" rel="noreferrer">http://cntlm.wiki.sourceforge.net/</a> for more information</p>\n'}, {'answer_id': 629605, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>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.</p>\n\n<p>The three solutions around the internet at the moment are:\nrubysspi\napserver\ncntlm</p>\n\n<p>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.</p>\n\n<p>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.</p>\n\n<p>The sourceforge link for cntlm that I\'ve seen redirects to <a href="http://cntlm.awk.cz/" rel="noreferrer">http://cntlm.awk.cz/</a>, but that times out.  A search on sourceforge turns up this link, which does work: <a href="http://sourceforge.net/projects/cntlm/" rel="noreferrer">http://sourceforge.net/projects/cntlm/</a></p>\n\n<p>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.</p>\n'}, {'answer_id': 4187271, 'author': 'Peter Moresi', 'author_id': 426602, 'author_profile': 'https://Stackoverflow.com/users/426602', 'pm_score': 8, 'selected': False, 'text': '<p>For the Windows OS, I used Fiddler to work around the issue.</p>\n\n<ol>\n<li>Install/Run Fiddler from www.fiddler2.com</li>\n<li><p>Run gem:</p>\n\n<pre><code>$ gem install --http-proxy http://localhost:8888 $gem_name\n</code></pre></li>\n</ol>\n'}, {'answer_id': 7315150, 'author': 'Christian F', 'author_id': 722711, 'author_profile': 'https://Stackoverflow.com/users/722711', 'pm_score': 3, 'selected': False, 'text': '<p>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. </p>\n\n<p>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:</p>\n\n<pre><code>tsocks gem install ...\n</code></pre>\n\n<p>or to account for rails 3.0:</p>\n\n<pre><code>tsocks bundle install\n</code></pre>\n\n<p>A more detailed guide can be found under:</p>\n\n<p><a href="http://blog.byscripts.info/2011/04/bypass-a-proxy-with-ssh-tunnel-and-tsocks-under-ubuntu/">http://blog.byscripts.info/2011/04/bypass-a-proxy-with-ssh-tunnel-and-tsocks-under-ubuntu/</a></p>\n\n<p>Despite being written for Ubuntu the procedure should be applicable for all Unix based machines. An alternative to tsocks for Windows is FreeCap (<a href="http://www.freecap.ru/eng/">http://www.freecap.ru/eng/</a>). A viable SSH client on windows is called putty.</p>\n'}, {'answer_id': 8006225, 'author': 'moonpatrol', 'author_id': 465598, 'author_profile': 'https://Stackoverflow.com/users/465598', 'pm_score': 2, 'selected': False, 'text': '<p>rubysspi-1.3.1 worked for me on Windows 7, using the instructions from this page:</p>\n\n<p><a href="http://www.stuartellis.eu/articles/installing-ruby/" rel="nofollow">http://www.stuartellis.eu/articles/installing-ruby/</a></p>\n'}, {'answer_id': 9382152, 'author': 'Benjamin Wootton', 'author_id': 247573, 'author_profile': 'https://Stackoverflow.com/users/247573', 'pm_score': 4, 'selected': False, 'text': "<p>If you are having problems getting authenticated through your proxy, be sure to set the environment variables in exactly the format below:  </p>\n\n<pre><code>set HTTP_PROXY=some.proxy.com\nset HTTP_PROXY_USER=user\nset HTTP_PROXY_PASS=password\n</code></pre>\n\n<p>The <code>user:password@</code> syntax doesn't seem to work and there are also some badly named environment variables floating around on Stack Overflow and various forum posts.  </p>\n\n<p>Also be aware that it can take a while for your gems to start downloading.  At first I thought it wasn't working but with a bit of patience they started downloading as expected.</p>\n"}, {'answer_id': 9866308, 'author': 'SethRocker', 'author_id': 439133, 'author_profile': 'https://Stackoverflow.com/users/439133', 'pm_score': 7, 'selected': False, 'text': '<p>This totally worked:</p>\n\n<pre><code>gem install --http-proxy http://COMPANY.PROXY.ADDRESS $gem_name\n</code></pre>\n'}, {'answer_id': 11769049, 'author': 'kfox', 'author_id': 575027, 'author_profile': 'https://Stackoverflow.com/users/575027', 'pm_score': 5, 'selected': False, 'text': "<p>I tried some of these solutions, and none of them worked. I finally found a solution that works for me:</p>\n\n<pre><code>gem install -p http://proxy_ip:proxy_port rails\n</code></pre>\n\n<p>using the <code>-p</code> parameter to pass the proxy.  I'm using Gem version 1.9.1.</p>\n"}, {'answer_id': 13563827, 'author': 'Zander', 'author_id': 91359, 'author_profile': 'https://Stackoverflow.com/users/91359', 'pm_score': 2, 'selected': False, 'text': '<p>I am working behind a proxy and just installed SASS by downloading directly from <a href="http://rubygems.org" rel="nofollow">http://rubygems.org</a>.</p>\n\n<p>I then ran <code>sudo gem install [path/to/downloaded/gem/file]</code>. I cannot say this will work for all gems, but it may help some people.</p>\n'}, {'answer_id': 19596410, 'author': 'Saikrishna Rao', 'author_id': 1128212, 'author_profile': 'https://Stackoverflow.com/users/1128212', 'pm_score': 2, 'selected': False, 'text': '<p>If you are on a *nix system, use this:</p>\n\n<pre><code>export http_proxy=http://${proxy.host}:${port}\nexport https_proxy=http://${proxy.host}:${port}\n</code></pre>\n\n<p>and then try:</p>\n\n<pre><code>gem install ${gem_name}\n</code></pre>\n'}, {'answer_id': 22957276, 'author': 'HomTom', 'author_id': 2931433, 'author_profile': 'https://Stackoverflow.com/users/2931433', 'pm_score': 4, 'selected': False, 'text': '<p>This solved my problem perfectly:</p>\n\n<pre><code>gem install -p http://proxy_ip:proxy_port compass\n</code></pre>\n\n<p>You might need to add your user name and password to it:</p>\n\n<pre><code>gem install -p http://[username]:[password]@proxy_ip:proxy_port compass\n</code></pre>\n'}, {'answer_id': 23693898, 'author': 'testworks', 'author_id': 3509508, 'author_profile': 'https://Stackoverflow.com/users/3509508', 'pm_score': 1, 'selected': False, 'text': '<p>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.</p>\n\n<p>On Windows, behind my corporate proxy, all I had to do was add the <code>HTTP_PROXY</code> environment variable to my system.</p>\n\n<ol>\n<li>Start -> right click Computer -> Properties</li>\n<li>Choose "Advanced System Settings"</li>\n<li>Click Advanced -> Environment Variables</li>\n<li>Create a new System variable named "<code>HTTP_PROXY</code>", and set the Value to your proxy server</li>\n<li>Reboot or log out and back in again</li>\n</ol>\n\n<p>Depending on your authentication requirements, the <code>HTTP_PROXY</code> value can be as simple as:</p>\n\n<pre><code>http://proxy-server-name\n</code></pre>\n\n<p>Or more complex as others have pointed out</p>\n\n<pre><code>http://username:password@proxy-server-name:port-number\n</code></pre>\n'}, {'answer_id': 24087006, 'author': 'Qi Luo', 'author_id': 2514803, 'author_profile': 'https://Stackoverflow.com/users/2514803', 'pm_score': 1, 'selected': False, 'text': '<p>If you want to use SOCKS5 proxy, you may try rubygems-socksproxy <a href="https://github.com/gussan/rubygems-socksproxy" rel="nofollow">https://github.com/gussan/rubygems-socksproxy</a>.</p>\n\n<p>It works for me on OSX 10.9.3.</p>\n'}, {'answer_id': 25244434, 'author': 'ArNumb', 'author_id': 2818659, 'author_profile': 'https://Stackoverflow.com/users/2818659', 'pm_score': 1, 'selected': False, 'text': '<p>If behind a proxy, you can navigate to <a href="http://rubygems.org/gems/rubygems-update" rel="nofollow">Ruby downloads</a>, click on Download, which will download the specified update ( or Gem ) to a desired location.</p>\n\n<p>Next, via Ruby command line, navigate to the downloaded location by using : <code>pushd [directory]</code> </p>\n\n<p>eg : <code>pushd D:\\Setups</code> </p>\n\n<p>then run the following command: <code>gem install [update name] --local</code></p>\n\n<p>eg: <code>gem install rubygems-update --local</code>.</p>\n\n<p>Tested on Windows 7 with Ruby update version 2.4.1.</p>\n\n<p>To check use following command : <code>ruby -v</code> </p>\n'}, {'answer_id': 27921249, 'author': 'Pedro García Vigil', 'author_id': 4449057, 'author_profile': 'https://Stackoverflow.com/users/4449057', 'pm_score': 2, 'selected': False, 'text': '<p>This worked for me in a Windows box:</p>\n\n<pre><code>set HTTP_PROXY=http://server:port\nset HTTP_PROXY_USER=username\nset HTTP_PROXY_PASS=userparssword\nset HTTPS_PROXY=http://server:port\nset HTTPS_PROXY_USER=username\nset HTTPS_PROXY_PASS=userpassword\n</code></pre>\n\n<p>I have a batch file with these lines that I use to set environment values when I need it.</p>\n\n<p>The trick, in my case, was <code>HTTPS_PROXY</code> sets. Without them, I always got a 407 proxy authentication error.</p>\n'}, {'answer_id': 34412185, 'author': 'lukapiske', 'author_id': 511366, 'author_profile': 'https://Stackoverflow.com/users/511366', 'pm_score': 4, 'selected': False, 'text': '<p>Create a .gemrc file (either in /etc/gemrc or ~/.gemrc or for example with chef gem in /opt/chef/embedded/etc/gemrc) containing:</p>\n\n<pre><code>http_proxy: http://proxy:3128\n</code></pre>\n\n<p>Then you can <code>gem install</code> as usual. </p>\n'}, {'answer_id': 56637216, 'author': 'Shantonu', 'author_id': 1564801, 'author_profile': 'https://Stackoverflow.com/users/1564801', 'pm_score': 3, 'selected': False, 'text': '<p>Quick answer : Add proxy configuration with parameter for both install/update</p>\n\n<pre><code>gem install --http-proxy http://host:port/ package_name\n\ngem update --http-proxy http://host:port/ package_name\n</code></pre>\n'}, {'answer_id': 61013775, 'author': 'Mike Campbell', 'author_id': 1520714, 'author_profile': 'https://Stackoverflow.com/users/1520714', 'pm_score': 0, 'selected': False, 'text': "<p>for anyone tunnelling with SSH; you can create a version of the <code>gem</code> command that uses SOCKS proxy:</p>\n\n<ol>\n<li>Install <code>socksify</code> with <code>gem install socksify</code> (you'll need to be able to do this step without proxy, at least)</li>\n<li><p>Copy your existing gem exe</p>\n\n<pre><code>cp $(command which gem) /usr/local/bin/proxy_gem\n</code></pre></li>\n<li><p>Open it in your favourite editor and add this at the top (after the shebang)</p>\n\n<pre><code>require 'socksify'\n\nif ENV['SOCKS_PROXY']\n  require 'socksify'\n  host, port = ENV['SOCKS_PROXY'].split(':')\n  TCPSocket.socks_server = host || 'localhost'\n  TCPSocket.socks_port = port.to_i || 1080\nend\n</code></pre></li>\n<li><p>Set up your tunnel</p>\n\n<pre><code>ssh -D 8123 -f -C -q -N user@proxy\n</code></pre></li>\n<li><p>Run your gem command with proxy_gem</p>\n\n<pre><code>SOCKS_PROXY=localhost:8123 proxy_gem push mygem\n</code></pre></li>\n</ol>\n"}]
['https://Stackoverflow.com/questions/4418', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/307/']