Bug 23015 - Machine trust store is ignored
Summary: Machine trust store is ignored
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Security ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-15 12:36 UTC by Jo Shields
Modified: 2014-09-19 10:14 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jo Shields 2014-09-15 12:36:17 UTC
Let's say I start with empty Trust stores, both personal and machine:

directhex@marceline:~$ certmgr -list -c Trust
Mono Certificate Manager - version 3.8.0.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

directhex@marceline:~$ certmgr -list -c -m Trust
Mono Certificate Manager - version 3.8.0.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

I import the system CA store, to the machine trust store

directhex@marceline:~$ sudo mono Projects/cert-sync/cert-sync/bin/Debug/cert-sync.exe /etc/ssl/certs/ca-certificates.crt 

directhex@marceline:~$ ls -l .config/.mono/certs/Trust/
total 0
directhex@marceline:~$ ls -l /usr/share/.mono/certs/Trust/ | wc -l
163

Then I try to use NuGet. As my own user (with empty user cert store), it fails.

directhex@marceline:~$ mono /tmp/nuget.exe list
Error: SendFailure (Error writing headers)

strace implies /usr/share/.mono/certs/Trust/ is never even looked at.
Comment 1 Jo Shields 2014-09-18 10:33:42 UTC
The problem is a lack of *WRITE* access to the machine cert store.

directhex@marceline:~/Projects/SSLtest/SSLtest/bin/Debug$ mono SSLtest.exe
Number of certs in machine store: 0
directhex@marceline:~/Projects/SSLtest/SSLtest/bin/Debug$ sudo chmod -R a+w /usr/share/.mono/
directhex@marceline:~/Projects/SSLtest/SSLtest/bin/Debug$ mono SSLtest.exe
Number of certs in machine store: 140
Comment 2 Jo Shields 2014-09-18 11:36:25 UTC
The problem is the lack of /usr/share/.mono/keypairs folder.

Cert importing does not create it - cert enumeration creates it. Not root = cannot create it = no machine certs
Comment 4 Miguel de Icaza [MSFT] 2014-09-19 10:14:17 UTC
Applied patch provided