chocolatey-community / simple-server

The Chocolatey Simple Server - https://community.chocolatey.org/packages/chocolatey.server
Apache License 2.0
44 stars 17 forks source link

Basic Auth doesn't allow installing Chocolatey.nupkg from local installation #43

Closed ferventcoder closed 6 years ago

ferventcoder commented 6 years ago

Once you've locked things down, it is not easy to install Chocolatey itself.

ferventcoder commented 6 years ago

A workaround would be to add the path and not restrict the permissions.

Note that this is not correct, but it would look something like this (and you might need 3 paths to cover all the parts):

<location path="install.ps1" inheritInChildApplications="false">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
<location path="api/v2/package/chocolatey" inheritInChildApplications="false">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
ferventcoder commented 6 years ago

Workaround:

Add the following above the starting tag for <appSettings>:

  <location path="install.ps1" inheritInChildApplications="false">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>
  <location path="7za.exe" inheritInChildApplications="false">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>
  <location path="chocolatey/Packages(Id='chocolatey')/Download" inheritInChildApplications="false">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>

Add the following key into <appSettings> section:

    <!--
      Force using a locally deployed Chocolatey package instead of performing a check.
      This must be set to true if you turn on basic authentication and use the local install script.
    -->
    <add key="forceLocalChocolateyPackage" value="true"/>

You will also need some beta bits at https://chocolatey.box.com/shared/static/wslxduenkhqcqf3sotg2kn9dqcb2zpgu.nupkg currently.

To install, use choco upgrade chocolatey.server --pre -y -s c:\<path to folder of nupkg> and then make the additional adjustments above.

ferventcoder commented 6 years ago

Fixed the above comment - I copied the wrong section in.

ferventcoder commented 6 years ago

A beta with the XDT changes to automatically adjust the web.config file is being deployed to the community repository.

ferventcoder commented 6 years ago

This will be released in 0.2.5