Search code examples
proxychef-infracookbook

chef remote file fails behind proxy


I am running the following remote file command in on of my chef recipes. I am unable to get it to use the proxy. git commands will use the proxy and so will anything else, but it fails when using remote file

remote_file "Fetch the latest ca-bundle" do
  source "http://curl.haxx.se/ca/cacert.pem"
  path "/opt/local/etc/certs/cacert.pem"
  owner "git"
  group "git"
  mode 0755
  action :create
end

the error:

Error connecting to http://curl.haxx.se/ca/cacert.pem - getaddrinfo: Name or service not known

I have the following env vars set with my proxy

HTTP_PROXY

HTTPS_PROXY

http_proxy

https_proxy

is there a way to define the proxy in the command?


Solution

  • You need to set the proxy settings in your client.rb:

    # HTTP for environment behind firewall
    # http://docs.opscode.com/config.html
    # solo.rb and client.rb can use the same http_proxy settings
    http_proxy "http://proxy.company.com:3128"
    http_proxy_user "username"
    http_proxy_pass "password"