Powershell Complete-ACMEChallenge - Output!

192 views
Skip to first unread message

dam...@gmail.com

unread,
Aug 23, 2016, 8:34:28 AM8/23/16
to ACMESharp
Hello Guys,
Thanks for the great product.

Just found a problem automating all the certificate issuing
It seems that there is no Output from Complete-ACMEChallenge CMDlet

This particular output can't be mapped to any variable or something.
The idea was to automate the whole process but it seems that I can't "catch" the output.
Any ideas ? Windows 10 powershell

== Manual Challenge Handler - DNS ==
  * Handle Time:      [23.8.2016 г. 15:08:09]
  * Challenge Token:  [CDz6n8XR618MOj0j2nUJCp49sCz3om9NvoZLCEP9V2I]
To complete this Challenge please create a new Resource
Record (RR) with the following characteristics:
  * RR Type:  [TXT]
  * RR Name:  [_acme-challenge.ad1321312adas.dddddddd.com]
  * RR Value: [Gy9dTCW4RLkOJxJzybBa83vz8XSxLNgbtQYggKpKYKY]

eube...@gmail.com

unread,
Oct 22, 2016, 7:33:03 AM10/22/16
to ACMESharp
You're using the manual challenge handler so it just outputs instructions to the console on how to complete the challenge manually.  If you want to automate it based on this information you can "pull" the details of the challenge using the "Get-Identifier" cmdlet right after the Complete-Challenge call.  This will provide all the same details in a structured response.

If your situation is unique, this is pby the best way to go about it.  However, if this is something that others can benefit from, you can also consider creating a challenge-handling provider.

blackd...@gmail.com

unread,
Jan 16, 2018, 11:08:03 AM1/16/18
to ACMESharp
function GetPublicKey{$FQDN = $args[0]
   New-ACMEIdentifier -Dns $FQDN -Alias $FQDN #| select status, Expires
   $challenge = Complete-ACMEChallenge $FQDN -ChallengeType dns-01 -Handler manual
   Write-Output ( "_acme-challenge." + "$FQDN :" + " " + ( $challenge.Challenges | Where-Object {$_.Type -eq "dns-01"} ).Challenge.RecordValue )
      }

      $CN = "mail.contoso.com"
      $PublicKey1 = GetPublicKey $CN
      "Public Key " + ( $PublicKey1 | Select-String "$CN" ) + " copy to clipboard"; ( ( $PublicKey1 | Select-String "$CN" ) -replace(' ')  -split(':') )[1] | clip
Reply all
Reply to author
Forward
0 new messages