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

Access denied error when building from source #17534

Closed
OdeToCode opened this issue Dec 3, 2019 · 2 comments
Closed

Access denied error when building from source #17534

OdeToCode opened this issue Dec 3, 2019 · 2 comments
Labels
area-infrastructure External

Comments

@OdeToCode
Copy link

@OdeToCode OdeToCode commented Dec 3, 2019

Following the instructions in the build from source WIki on a Win10 machine. Running restore completes with no errors. Running build generates the following 4 errors.

Build FAILED.

ALINK : error AL1078: Error signing assembly -- Access is denied. [C:\Users\scott\repos\AspNetCore\src\Middleware\Localization\sample\LocalizationSample.csproj]
ALINK : error AL1078: Error signing assembly -- Access is denied. [C:\Users\scott\repos\AspNetCore\src\Middleware\Localization\testassets\LocalizationWebsite\LocalizationWebsite.csproj]
ALINK : error AL1078: Error signing assembly -- Access is denied. [C:\Users\scott\repos\AspNetCore\src\Mvc\test\WebSites\RazorPagesWebSite\RazorPagesWebSite.csproj]
ALINK : error AL1078: Error signing assembly -- Access is denied. [C:\Users\scott\repos\AspNetCore\src\Components\test\testassets\BasicTestApp\BasicTestApp.csproj]
    0 Warning(s)
    4 Error(s)

Digging into the logs, I can see al.exe running with the following command line for the first error:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\al.exe 
  /culture:es-ES /delaysign- 
  /keyfile:C:\Users\scott\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.19574.1\tools\snk/AspNetCore.snk
  /out:C:\Users\scott\repos\AspNetCore\artifacts\obj\LocalizationSample\Debug\netcoreapp5.0\es-ES\LocalizationSample.resources.dll 
 /template:C:\Users\scott\repos\AspNetCore\artifacts\obj\LocalizationSample\Debug\netcoreapp5.0\LocalizationSample.dll
 /embed:C:\Users\scott\repos\AspNetCore\artifacts\obj\LocalizationSample\Debug\netcoreapp5.0\LocalizationSample.My.Resources.Startup.es-ES.resources

With the sysinternals tools, I can see the ACCESS DENIED error popping up when al.exe tries to create a file: C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\eecbfdd95d7ed9110d5942eb026463f1_7990d07d-81f1-4e2e-a733-048b6f7c81bc.

@javiercn javiercn added the area-infrastructure label Dec 3, 2019
@pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Dec 5, 2019

There's a workaround listed here: https://github.com/dotnet/corefx/issues/3784#issuecomment-404795417. Since this issue isn't specific to AspNetCore, we'll use the other issue to track addressing it.

@pranavkm pranavkm closed this as completed Dec 5, 2019
@pranavkm pranavkm added the External label Dec 5, 2019
@OdeToCode
Copy link
Author

@OdeToCode OdeToCode commented Dec 10, 2019

The proposed workaround is to give yourself Full Control over the MachineKeys folder. MachineKeys is the folder where private keys from all users and system processes appear, so the proposed work around is dangerously wrong and opens a vulnerability.

The MachineKeys folder requires special permissions as I have documented here: https://odetocode.com/blogs/scott/archive/2020/01/12/solving-access-denied-in-crypto-machine-keys.aspx

@msftbot msftbot bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure External
Projects
None yet
Development

No branches or pull requests

4 participants