We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I need to allow a machine certificate's private key to be read by certain users in a development environment.
Since Certificates are a PowerShell path, and have access rules, I thought this resource would work.
Currently I am using:
Import-Module GuardedFabricTools $certificate = Get-ChildItem "Cert:\LocalMachine\${CertStoreLocation}\${CertFingerprint}" #$certificate.Acl = $certificate.Acl | Add-AccessRule "${UserName}" Read Allow $acl = $certificate.Acl $newFileSystemAccessRuleParameters = @{ TypeName = 'System.Security.AccessControl.FileSystemAccessRule' ArgumentList = @( "${UserName}", [System.Security.AccessControl.FileSystemRights] @('Read'), 'None', 'None', 'Allow' ) } $fileSystemAccessRule = New-Object @newFileSystemAccessRuleParameters $acl.SetAccessRule($fileSystemAccessRule)
Method invocation failed because [System.Security.Cryptography.X509Certificates.X509Certificate2] does not contain a method named 'GetAccessControl'. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : MethodNotFound + PSComputerName : localhost
Get-ACLAccess
.Acl
.GetAccessControl('Access')
System.Security.AccessControl.InheritanceFlags
$certificate.Acl is a "System.Security.AccessControl.FileSystemSecurity". Which is the same type as returned by .GetAccessControl('Access').
$certificate.Acl
FileSystemAccessRule Cert { Identity = $ConfigurationData.Credentials.UserName Path = "Cert:\LocalMachine\${CertStoreLocation}\${CertFingerprint}" Rights = "Read" Ensure = [Ensure]::Present }
OsName : Microsoft Windows 10 Enterprise LTSC OsOperatingSystemSKU : 125 OsArchitecture : 64-bit WindowsVersion : 2009 WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406 OsLanguage : en-US OsMuiLanguages : {en-US}
Name Value
PSVersion 5.1.19041.5129 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.5129 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
1.1.1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Details of the scenario you tried and the problem that is occurring
I need to allow a machine certificate's private key to be read by certain users in a development environment.
Since Certificates are a PowerShell path, and have access rules, I thought this resource would work.
Currently I am using:
Verbose logs showing the problem
Suggested solution to the issue
Get-ACLAccess
function to also check if.Acl
is available if.GetAccessControl('Access')
fails, and use that instead.System.Security.AccessControl.InheritanceFlags
are not valid for an object.$certificate.Acl
is a "System.Security.AccessControl.FileSystemSecurity". Which is the same type as returned by.GetAccessControl('Access')
.The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows 10 Enterprise LTSC
OsOperatingSystemSKU : 125
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.19041.5129
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.5129
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
1.1.1
The text was updated successfully, but these errors were encountered: