Having got myself a running installation of Mono built from source and a KRE environment, I then attempted that magical “hello world” first program and once again I cribbed from http://graemechristie.github.io/graemechristie/blog/2014/05/26/asp-dot-net-vnext-on-osx-and-linux/ and the section “Okay, so I’ve got a Shiny New KRE ….”
Writing the project.json and Progam.cs were all very simple, my next problem came when trying to restore the dependencies the program required using kpm:
kpm restore -s https://www.myget.org/F/aspnetvnext/
kpm failed to download System.Console with a huge stacktrace, which implied an issue with trust certificates:
(Unfortunately I no longer have a recor d of that stacktrace, if/when I manage to recreate that problem I will post a sample here.)
Looking at http://graemechristie.github.io/graemechristie/blog/2014/05/26/asp-dot-net-vnext-on-osx-and-linux/ I realised I’d skipped some of the instructions in the “Building Mono” section, namely the fact that after a source build Mono does not contain any trusted certificates.
So I successfully imported the certificates onto my workstation:
sudo certmgr -ssl -m https://go.microsoft.com sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net sudo certmgr -ssl -m https://nuget.org
However running mozroots to import certificates into Mon’s trust store quietly failed:
$ mozroots --import --sync Mozilla Roots Importer - version 184.108.40.206 Download and import trusted root certificates from Mozilla's MXR. Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed. Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'... Couldn't retrieve the file using the supplied information.
Googling didn’t reveal any answers, but poking around in the Mono source did. It turned out that the mozroots tool was quietly timing out when attempting to retrieve the certdata.txt from Mozilla.
My first Mono bug raised and patch submitted, see https://bugzilla.xamarin.com/show_bug.cgi?id=20356.
After this change, rebuilding and installing:
$ mono ./mozroots.exe --import --sync Mozilla Roots Importer - version 220.127.116.11 Download and import trusted root certificates from Mozilla's MXR. Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed. Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'... Importing certificates into user store... 139 new root certificates were added to your trust store. Import process completed.
Back to kpm…
Carolyn Van Slyck said:
Thank you for this! In case it helps anyone else, below is the error received, installing the extra certs fixed it.
System.AggregateException: One or more errors occurred —> System.Net.WebException: Error: SendFailure (Error writing headers) —> System.Net.WebException: Error writing headers —> System.IO.IOException: The authentication or decryption has failed. —> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
Pingback: ASP.NET vNext + Raspberry Pi - Keraxel's Binary Thoughts