Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choco proxy support #243

Closed
JonCubed opened this issue Apr 15, 2015 · 16 comments
Closed

choco proxy support #243

JonCubed opened this issue Apr 15, 2015 · 16 comments

Comments

@JonCubed
Copy link

I'm using chocolatey in automated builds to install some stuff and the http_proxy and https_proxy environment variables do not work in 0.9.9.

The documentation https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey appears to be wrong.

I have solved this by adding

  <system.net>
    <defaultProxy>
      <proxy proxyaddress="<proxyserver>" />
    </defaultProxy>
  </system.net>

to chocolatey.config and also updating Get-WebFile.ps1 & Get-WebHeaders.ps1 in /helpers/functions to setup the proxy even if $webclient.Proxy.IsBypassed($url) returns true

Would be nice if the environment variables where supported again.

@antonyfrancis
Copy link

Yes. Have the same issue. Would be great is environment variables are supported.

Many thanks.

@ferventcoder
Copy link
Member

Thanks for creating this with things that can be done to fix this as well!

@ferventcoder ferventcoder modified the milestones: 0.9.9.5, 0.9.9.6 Apr 20, 2015
@ferventcoder
Copy link
Member

Found more information on this. Has to do with the config needing not to be blank. We'll likely need to override the defaults, which don't find the chocolatey.config and don't find the nuget.config unless it exists (but that is not an optimal way to go about it).

For now a workaround is to create the Nuget.Config file like before with the right settings, see https://docs.nuget.org/consume/nuget-config-file for location and reference.

@ferventcoder ferventcoder changed the title 0.9.9.4 doesn't work with proxy when not setup in IE choco doesn't work with proxy when not setup in IE May 10, 2015
@ferventcoder ferventcoder modified the milestones: 0.9.9.6, 0.9.9.7 May 15, 2015
@ferventcoder
Copy link
Member

This is issue chocolatey-archive/chocolatey#404 from the old repo.

@ghost
Copy link

ghost commented May 28, 2015

There also seems to be a problem even if the proxy is configured in IE. I have the proxy set up in IE and have it set in the environment variables http_proxy and https_proxy. I installed choco by manually downloading and then running the installer in powershell. But when I try to intstall ag for example, I get this error (proxy address edited), v0.9.9.6:

 Using this proxyserver: my.proxy.server
 Using this proxyserver: my.proxy.server
 WARNUNG: Write-ChocolateyFailure is deprecated. If you are the package maintainer, please use 'throw $_.Exception' instead.
 Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
 Bei C:\ProgramData\chocolatey\helpers\functions\Write-ChocolateyFailure.ps1:24

 Zeichen:8
 +   throw <<<<  "$failureMessage"
     + CategoryInfo          : OperationStopped: (Exception calli...tion Required.":String) [], RuntimeException
     + FullyQualifiedErrorId : Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
The install of ag was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\ag\tools\chocolateyInstall.ps1'.
 See log for details.

The proxy requires username and password authentication.

Before I had set up the http_proxy and https_proxy variables choco asked me for proxy credentials, but not the address. It also seems to have verified those credentials, as when I tried it with false credentials I got an error. Still, even then it trew the 407 error.

@ferventcoder
Copy link
Member

Thanks for the information. I may have something for testing over the next couple of weeks if you are interested. This one is a bit harder for me as I don't have a proxy myself. I know that nuget.core will accept those proxy credentials in the config, which I think we need to ensure the download will also look at those values.

@ghost
Copy link

ghost commented May 28, 2015

Sure, I can help you test.
Thanks for looking into this.

@JonCubed
Copy link
Author

Happy to test as well when a fix is available

@ferventcoder ferventcoder modified the milestones: 0.9.9.8, 0.9.9.9 Jun 26, 2015
@ferventcoder ferventcoder removed this from the 0.9.9.8 milestone Jun 26, 2015
@ifunky
Copy link

ifunky commented Aug 5, 2015

Hi,

I can help test this when the fix is ready. The nuget config workaround doesn't seem to work so unfortunately we can't use chocolatey at the moment :-(

Thanks

Dan

@ferventcoder
Copy link
Member

@ifunky You can use 0.9.8.x series. You may also want to try to set a file next to choco.exe named choco.exe.config with the xml configuration settings in it (untested).

Create a file at C:\ProgramData\Chocolatey\choco.exe.config (based on the default install location, make sure it sits next to $env:ChocolateyInstall\choco.exe) with the following contents:

<?xml version="1.0"?>
<configuration>
  <appSettings />
  <system.net>
    <defaultProxy>
      <proxy proxyaddress="<proxyserver>" />
    </defaultProxy>
  </system.net>
</configuration>

@ifunky
Copy link

ifunky commented Aug 6, 2015

Thanks for the quick response - the choco.exe.config didn't work but putting the proxy settings as above in machine.config did the trick!

Cheers
Dan

@GuillaumeBonamy
Copy link

@ifunky What do you mean by machine.config?

@ferventcoder
Copy link
Member

@GuillaumeBonamy the one for .net framework. Only do that if you want it to affect ALL .net applications.

@ferventcoder ferventcoder changed the title choco doesn't work with proxy when not setup in IE choco proxy support Sep 17, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 21, 2015
NuGet originally set the ProxyCache internal which did not make it a
good candidate to use to set a custom proxy. Update NuGet.Core to one
that will allow that (our internal chocolatey-nuget)
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 21, 2015
@ferventcoder ferventcoder self-assigned this Sep 21, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 23, 2015
NuGet originally set the ProxyCache internal which did not make it a
good candidate to use to set a custom proxy. Update NuGet.Core to one
that will allow that (our internal chocolatey-nuget). Add a method for
adding an override proxy server that will force NuGet to use the
override proxy if it exists.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 23, 2015
- Add proxy configuration settings (`proxy`, `proxyUser`, `proxyPassword`),
  ensuring that proxyPassword is encrypted.
- Ensure the proxy is configured with Nuget Core for downloading the package.
- Pass proxy environment variables to PowerShell service.
- Get-WebHeaders and Get-WebFile look at an explicitly specified proxy before
  falling back to a system proxy and then falling back to no proxy.
@ferventcoder
Copy link
Member

This is pretty much complete. Take a look at https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey#explicit-proxy-settings for information on how to set this up once 0.9.9.9 rolls out the door.

ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 23, 2015
- Add proxy configuration settings (`proxy`, `proxyUser`, `proxyPassword`),
  ensuring that proxyPassword is encrypted.
- Ensure the proxy is configured with Nuget Core for downloading the package.
- Pass proxy environment variables to PowerShell service.
- Get-WebHeaders and Get-WebFile look at an explicitly specified proxy before
  falling back to a system proxy and then falling back to no proxy.
ferventcoder added a commit that referenced this issue Sep 23, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 23, 2015
* stable:
  (chocolateyGH-405) Cache downloads by name and version
  (chocolateyGH-243) Add Proxy Support
  (chocolateyGH-243) Ensure NuGet Proxy Override
@ferventcoder
Copy link
Member

Merged into stable at bfa8ccf - will be released in 0.9.9.9.

@JonCubed
Copy link
Author

JonCubed commented Oct 7, 2015

thanks a lot @ferventcoder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants