Using deprec behind an HTTP Proxy

Yesterday I had a fair bit of difficulty because the app server I was setting up with deprec lives behind an http proxy.

Normally, you’d hope to just set an HTTP_PROXY environment variable and be done, but it’s a little tricky to figure out where, since (1) commands run over ssh receive a somewhat limited set of environment variables, and (2) deprec runs wget inside the even more limited environment of sh -c.

Here’s what I did:

Set Up ssh Environment

Create ~/.ssh/environment on the server, chmod 600, with the line

HTTP_PROXY=http://proxy:8080

And in /etc/ssh/sshd_config, set

PermitUserEnvironment yes

This’ll take care of apt-get and gem’s proxy needs, but then you’ll still need to:

Configure wget

Modify /etc/wgetrc so that it contains

http_proxy = http://proxy:8080

Done!

It seems like everything is easy, once you find the right 3 lines of code…