PSPKIAudit icon indicating copy to clipboard operation
PSPKIAudit copied to clipboard

Error retreiving certificate templates as part of running audit

Open ssparkgit opened this issue 4 years ago • 4 comments

When invoking PKIAudit it pulls back my CA information but after the misconfiguration section I get this error.

New-Object : Exception calling ".ctor" with "1" argument(s): "An invalid dn syntax has been specified.
"
At C:\temp\PSPKIAudit-main\PSPKI\3.7.2\Server\Get-CertificateTemplate.ps1:67 char:48
+ ... ach-Object {New-Object PKI.CertificateTemplates.CertificateTemplate $ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

I have made sure that 'Get-CertificateTemplate' pulls results within powershell. I have the AD and CS tools installed and imported running this on a Windows 2016 server.

ssparkgit avatar Nov 16 '21 13:11 ssparkgit

I'm seeing the same thing... did you ever get it figured out?

KStieers avatar Nov 09 '22 15:11 KStieers

Same issue

devonbowers avatar Jan 10 '23 16:01 devonbowers

Pinging @Crypt32 since it appears to be an issue in PSPKI dependency. Can easily be reproduced by creating a template with a slash in the name. PSPKI is failing on this line:

https://github.com/PKISolutions/PSPKI/blob/5f8ba9e0b195857294dd8bde4e2da6e716cbd956/PSPKI/Server/Get-CertificateTemplate.ps1#L67

I'm wondering too if LDAP escaping (e.g., for commas, slashes) in the CN may be the issue with #9 and #21 as well. See section 2.4 here for the situations where LDAP escaping may occur in the DNs

leechristensen avatar Jun 22 '23 00:06 leechristensen

@leechristensen can you log a bug in PSPKI repo?

Crypt32 avatar Jun 22 '23 06:06 Crypt32