Newb questions

13 views
Skip to first unread message

Joseph Flynn

unread,
Jan 5, 2018, 11:58:15 AM1/5/18
to ACMESharp
Newb here, maybe some of my questions can help other newbs...

Starting with some code I found here to help automate the process.

if (!(Get-Module "ACMESharp")) {
   
# module is not loaded
   
Install-Module -Name ACMESharp -AllowClobber -Scope CurrentUser
}

If (!(Get-module ACMESharp )) {
   
Import-Module ACMESharp
}

## I already had my-vault defines

Register-FQDN("video.mydomain.com")

function Register-FQDN
{
 $FQDN
= $args[0]



19  echo "`n Creating a new identifier for $FQDN ..."
20     echo "`n $FQDN"
21  New-ACMEIdentifier -VaultProfile my-vault -Dns $FQDN -Alias $FQDN | select status, Expires
22  Get-ACMEIdentifier -VaultProfile my-vault -IdentifierRef $FQDN


 echo
"`n Completing the challenge for the new identifier for $FQDN ..."
    $challenge
= Complete-ACMEChallenge $FQDN -Verbose -Regenerate -ChallengeType http-01 -Handler manual -HandlerParameters @{WriteOutPath = 'c:\Users\me\inst.txt'} #| select Identifier, status, Expires *>&1 >> $acmelog
 
    $rec
= ($challenge.Challenges | Where-Object {$_.type -eq "dns-01"}).challenge.recordname
    $data
= ($challenge.Challenges | Where-Object {$_.type -eq "dns-01"}).challenge.recordvalue
.
.


I have a breakpoint set on line 22 and when I execute the line I am getting an error on the "Get-ACMEIdentifier -VaultProfile my-vault -IdentifierRef $FQDN" line with the following error

Get-DnsServerZone : The term 'Get-DnsServerZone' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\me\Documents\LetsEncrypt2.ps1:52 char:14
+      while ((Get-DnsServerZone -ComputerName $dnsserver |  Where-Obje ...
+              ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-DnsServerZone:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

What is troubling me is that I don't even know why the script is executing down in line 52 which was from the previous author who was using dns records for verification.  I'm trying to use http-01 method.   Where is the execution call to the erroneous "Get-DnsServerZone" coming from.  I don't even see that???

Thanks
Joe

Joseph Flynn

unread,
Jan 5, 2018, 1:21:42 PM1/5/18
to ACMESharp
I got the code to execute without error through the
 echo "`n Completing the challenge for the new identifier for $FQDN ..."

    $challenge
= Complete-ACMEChallenge $FQDN -Verbose -Regenerate -ChallengeType http-01 -Handler manual #| select Identifier, status, Expires *>&1 >> $acmelog
   
# $challenge = Complete-ACMEChallenge $FQDN -Verbose -Regenerate -ChallengeType http-01 -Handler manual -HandlerParameters @{WriteOutPath = 'c:\Users\me\inst.txt'} #| select Identifier, status, Expires *>&1 >> $acmelog

    $rec
= ($challenge.Challenges | Where-Object {$_.type -eq "http-01"}).challenge.recordname
    $data
= ($challenge.Challenges | Where-Object {$_.type -eq "http-01"}).challenge.recordvalue

But the $rec and $data variables are blank.

The $challenge variable looks like
[DBG]: PS C:\Users\flynn>> echo $challenge


IdentifierPart : ACMESharp.Messages.IdentifierPart
IdentifierType : dns
Identifier     : video.agileimo.com
Uri            : https://acme-v01.api.letsencrypt.org/acme/authz/IjPXHTm-mXHzLVR3gmGxzmDDlIlJUuZfkFSUJmznYSE
Status         : pending
Expires        : 1/12/2018 4:29:36 PM
Challenges     : {manual, , manual}
Combinations   : {1, 0, 2}

And the instruction file (from when I had that line uncommented out) looks like
== Manual Challenge Handler - HTTP ==
 
* Handle Time:      [1/5/2018 12:44:26 PM]
 
* Challenge Token:  [zq2ZxdoK4MHWrEh5nAfC5_CpgjBZW6Dsw21rm4i7HqU]

To complete this Challenge please create a new file
under the server that
is responding to the hostname
and path given with the following characteristics:
 
* HTTP URL:     [http://video.mine.com/.well-known/acme-challenge/zq2ZxdoK4MHWrEh5nAfC5_CpgjBZW6Dsw21rm4i7HqU]
 
* File Path:    [.well-known/acme-challenge/zq2ZxdoK4MHWrEh5nAfC5_CpgjBZW6Dsw21rm4i7HqU]
 
* File Content: [zq2ZxdoK4MHWrEh5nAfC5_CpgjBZW6Dsw21rm4i7HqU.oznW42J6S264psl_eaRFfaq4F0YxpZUAD7-yxXF4XlE]
 
* MIME Type:    [text/plain]
------------------------------------                                        



Reply all
Reply to author
Forward
0 new messages