Skip to content

Support the Cert:/ PSDrive on non-Windows platforms #1865

Closed

Description

Steps to reproduce

Switch to Cert:/ Drive and run Get-ChildItem

Expected behavior

PS Cert:/> get-childitem

Location : CurrentUser
StoreNames :

Location : LocalMachine
StoreNames :

Actual behavior

PS Cert:/> get-childitem
get-childitem : Cannot find path '/Cert:/' because it does not exist.
At line:1 char:1

  • get-childitem
  • - CategoryInfo          : ObjectNotFound: (/Cert:/:String) [Get-ChildItem], ItemNotFoundException
    - FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
    

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.8
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Activity

  1. TravisEz13 commented on Aug 18, 2016

    @TravisEz13
    Member

    What OS was this on?

  2. DexterPOSH commented on Aug 19, 2016

    @DexterPOSH
    Author

    This was on an Ubuntu box.

    vagrant@vagrant:/vagrant_data$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 14.04.1 LTS
    Release:        14.04
    Codename:       trusty
    vagrant@vagrant:/vagrant_dat
    
  3. TravisEz13 commented on Aug 19, 2016

    @TravisEz13
    Member

    I don't think the Cert provider is currently supported on Ubuntu, but the drive probably shouldn't show up in that case.

  4. DexterPOSH commented on Aug 19, 2016

    @DexterPOSH
    Author

    The Cert provider yields expected result in the below case on my Ubuntu host.

    PS /vagrant_data> Get-ChildItem -path Cert:/
    
    
    Location   : CurrentUser
    StoreNames :
    
    Location   : LocalMachine
    StoreNames :
    
    

    But it fails when the Get-ChildItem is run from the PSDrive itself.

  5. added this to the milestone on Sep 29, 2016
  6. removed this from the milestone on May 24, 2017
  7. joeyaiello commented on May 24, 2017

    @joeyaiello
    Contributor

    The Certificate store is not currently supported on non-Windows platforms, and isn't in scope in the near future.

  8. changed the title [-]Get-ChildItem from Cert:/ PSDrive[/-] [+]Support the Cert:/ PSDrive on non-Windows platforms[/+] on May 24, 2017
  9. TravisEz13 commented on May 24, 2017

    @TravisEz13
    Member

    Joey Aiello (@joeyaiello) What would an x509 cert provider do on a Linux machine?
    Well, it could enumerate the certs in /etc/ssl, /etc/pki/tls , /system/etc/security/cacerts, but the semantics would need to be quite different than on windows to be useful.

  10. markekraus commented on Dec 8, 2017

    @markekraus
    Contributor

    In researching supported and unsupported features in .NET core's Web Cmdlets I discovered that the certificate stores are working in .NET on both Linux and macOS. they can be directly manipulated via the .NET APIs through pwsh. On Linux, the current user my store gets created in ~/.dotnet/corefx/cryptography/x509stores/my. on macOS it is using Apple's Security.Framework API.

    Using the ClientCert.pfx in the WebListener, I can initialize the Linux CurrentUser\My store like so:

    # Do some prep work
    $StoreName = [System.Security.Cryptography.X509Certificates.StoreName]
    $StoreLocation = [System.Security.Cryptography.X509Certificates.StoreLocation]
    $OpenFlags = [System.Security.Cryptography.X509Certificates.OpenFlags]
    $Store = [System.Security.Cryptography.X509Certificates.X509Store]::new(
        $StoreName::My, $StoreLocation::CurrentUser)
    
    # Get a certificate
    $X509Certificate2 = [System.Security.Cryptography.X509Certificates.X509Certificate2]
    $CertPath = (Resolve-Path 'ClientCert.pfx').Path
    $Cert = $X509Certificate2::New($CertPath, 'password')
    
    # Open the store, Add the cert, Close the store.
    $Store.Open($OpenFlags::ReadWrite)
    $Store.Add($Cert)
    $Store.Close()

    After doing that on Linux, I am able to use cert auth via thumbprint:

    $Thumbprint = '2DECF1348FF21B780F45D316A039B5EB4C6312F7'
    $Uri = 'https://prod.idrix.eu/secure/'
    Invoke-RestMethod -Uri $Uri -CertificateThumbprint $Thumbprint

    Cert auth doesn't work at all on macOS, but, I can still manipulate and search the CurrentUser\My store using the .NET APIs.

    I think this support should be readded for x-plat in 6.1.0.

  11. 6 remaining items

  12. SidShaytay commented on Jun 30, 2018

    @SidShaytay

    Related to *nix certificate activities, we need Import-PfxCertificate. Added as a ticket @ #7213

  13. andreesteve commented on Jul 21, 2019

    @andreesteve

    Steve Lee (@SteveL-MSFT) - do you know if this feature is planed for a future release or just in the backlog for now? Thanks!

  14. SteveL-MSFT commented on Jul 23, 2019

    @SteveL-MSFT
    Member

    Andre Esteve (@andreesteve) this feature is not currently in any active plan and is just in the backlog. Since the provider currently relies on Win32 APIs and not .NET APIs, it's not a small work item. A PR would be gladly accepted :)

  15. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  16. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  17. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  18. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-LinuxOS-macOSResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtimeWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions