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

Get challenge info automaticaly #97

Closed
Alaanor opened this issue Feb 15, 2016 · 5 comments
Closed

Get challenge info automaticaly #97

Alaanor opened this issue Feb 15, 2016 · 5 comments

Comments

@Alaanor
Copy link

Alaanor commented Feb 15, 2016

Hi, I'm not a master with powershell, I want to build a ps script for auto-renew the certificate.

There is only one thing that block me: get the fileContent from the Complete-ACMEChallenge output.

See this:

PS C:\www\myTests\letsEncrypt> $outputChallenge = Complete-ACMEChallenge myAlias -ChallengeType http-01 -Handler manual
== Manual Challenge Handler - HTTP ==
  * Handle Time:      [15.02.2016 13:57:37]
  * Challenge Token:  [###########################################]
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:     [############################################################################################]
  * File Path:    [######################################################################]
  * File Content: [#######################################################################################]
  * MIME Type:    [text/plain]
------------------------------------
PS C:\www\myTests\letsEncrypt>

Note: All information has been replaced by #

I though when you do something like that $outputChallenge = Complete-ACMEChallenge myAlias -ChallengeType http-01 -Handler manual You get all the output into the $ouputChallenge variable.

Now the variable contains only a part of the output... which is:

PS C:\www\myTests\letsEncrypt> echo $outputChallenge
IdentifierPart : ACMESharp.Messages.IdentifierPart
IdentifierType : dns
Identifier     : #########
Uri            : #####################################
Status         : pending
Expires        : 22.02.2016 12:57:28
Challenges     : {manual, , }
Combinations   : {0, 1, 2}
PS C:\www\myTests\letsEncrypt>

How to get the * File Content: content ? I'm not able to catch him.

Thank for any help, and, of course, if there isn't the place for asking this, sorry :/

Alaanor.

@bseddon
Copy link
Contributor

bseddon commented Feb 15, 2016

I created a script to create/renew certificates in one command. You can find it in issue 76

You can either use it or compare what you are doing with what it does to see how to make progress.

@Alaanor
Copy link
Author

Alaanor commented Feb 15, 2016

Yeah, but the problem of your script is that work only with IIS (local certificate), I'm running apache on Windows (What a strange configuration !)

Maybe I am wrong, say me in this case. But in any case, I will inspect one more time your script :)

@bseddon
Copy link
Contributor

bseddon commented Feb 15, 2016

You are right, it will not work for you. However, it will show you how to resolve your problem because it successfully completes the certificate generation step and saves the certificate to a file. It uses the ExportPKcs12 option but you can use the option to export a .pem file instead.

@ComDAC
Copy link

ComDAC commented Feb 19, 2016

Just today I figured this out. Here is the code I used:

$chalProps = (Complete-ACMEChallenge $alias -ChallengeType http-01 -Handler manual)
$chal = $chalProps.Challenges | Where { $_.Type -eq 'http-01' }

Then you can get the File Contents and Token with the following:

$chal.Challenge.FileContent
$chal.Challenge.Token

Remember to specifiy the appropriate challenge type in the where statement.

Wish I had fully read the issue 76 mentioned above as it would have saved me a lot of time figuring this out.

@ebekker
Copy link
Owner

ebekker commented Feb 22, 2016

Hopefully, everyone's questions have been answered so I'm closing. If not, please reopen or continue the discussion.

@ebekker ebekker closed this as completed Feb 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants