Skip to content
New issue

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

New-TPPCertificate function does not add SubjectDN fields and created certs cannot be obtained via Get-TPPCertificate #110

Closed
MichalZyzakCS opened this issue May 9, 2022 · 1 comment · Fixed by #112
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@MichalZyzakCS
Copy link

Hello.
We want to use PowerShell to automate certificate provisioning via Venafi API during machine rebuild process (re-imaging). I run New-TPPCertificate with parameters Path and Name.
Command completes properly without error nor warning. I receive GUID and CertificateDN.
I can find the certificate using Find-TPPCertificate
I can successfully validate the certificate using Invoke-VenafiCertificateAction -Validate
However I cannot obtain that cert using Get-TPPCertificate as I'm getting error that SubjectDN is empty.

Exact error: "500 : {"Stage" : 0, "Status" : "Request DN is empty. Please configure the certificate properly"}

How is that a command that creates a certificate completes successfully but creates a bad cert?
How is that a command that validates a certificate claims that a bad cert is actually valid?

Environment:

Test lab, no internet access, only on-prem intranet.

Operating System: Windows 10 20H2
VenafiPS version: 4.2.4
PowerShell version: 5.1

Steps to reproduce

Import-Module VenafiPS
$Server = "https://test-server-domain.net"
$YID = Get-Credential -Credential "TestAccount"
New-VenafiSession -Server $Server -Verbose -Credential $YID
$PCName = $env:computername
$PCFQDN = ($PCName,$env:USERDNSDOMAIN) -join('.')
$PCType = "Desktops"
$CertPath = "\VED\Policy\Certs\v1\$PCType"
$CAPath = "\VED\Policy\Administration\CAs\TestTempalte1"
New-TppCertificate -Path $CertPath -Name $PCName -Verbose
Get-TppCertificate -CertificateID "$CertPath\$PCName" -Format "DER"

Expected behavior

I should get the cert

Actual behavior

"500 : {"Stage" : 0, "Status" : "Request DN is empty. Please configure the certificate properly"}

Screenshots

gdbarron added a commit that referenced this issue May 10, 2022
@gdbarron gdbarron self-assigned this May 10, 2022
@gdbarron gdbarron added bug Something isn't working wontfix This will not be worked on documentation Improvements or additions to documentation and removed wontfix This will not be worked on labels May 10, 2022
@gdbarron
Copy link
Collaborator

gdbarron commented May 10, 2022

Hi @MichalZyzakCS, thanks for reporting this. What you are seeing is a combination of a few things. As you pointed out, the SubjectDN is empty and it makes sense to default to using the name provided; this has been fixed with #112.

Prior to TPP 22.1, all certificate requests are asynchronous and immediately return. Beginning with 22.1, you can set a timeout to control this behavior and respond as you are expecting. A global timeout can be set, https://docs.venafi.com/Docs/currentSDK/TopNav/Content/SDK/WebSDK/r-SDK-Certificates-API-settings.php, or, you can provide it as a parameter to New-TppCertificate itself (also fixed with #112).

Also, validation is used for network and installation validation. If you are looking to validate the creation of a certificate, use Get-VenafiCertificate and look at ProcessingDetails.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants