lua-resty-letsencrypt
lua-resty-letsencrypt copied to clipboard
new-authz request incorrect.
As discovered in #2 we are incorrectly handling the new-authz request - we get an HTTP 405 response back right now - but possibly only in some circumstances - https://github.com/torhve/lua-resty-letsencrypt/blob/29a0a8511e50397b0c4df33e0302ca4ec154bee9/letsencrypt.lua#L670 this code path in particular.
So I'm not sure what state it seemed to end up in but this diff "fixed" it but I'm far from certain it's right or really all that happy with the change:
if authz then
while authz.body.status == "pending" do
if authz.need_update then
- log("Updating authz...")
- local updated, err = account.unsigned_request(authz.head.location or authz.url)
+ local url, updated, err
+ url = authz.head.Location or authz.url
+ if url == account.get_directory()["new-authz"] then
+ log("Restarting as a new authz...")
+ updated, err = account.new_dns_authz(host)
+ else
+ log("Updating authz...")
+ updated, err = account.unsigned_request(url)
+ end
if not updated then
log("Failed to update authz: %s", tostring(err))
break
Note the authz.head.location
vs authz.head.Location
too.
I think you are onto something here. Do you want to play with it a bit more before you send a pull request?
Sure. I'll see if there's a better way of telling if we need to do a get vs a new post rather than comparing URLs.
@ashb ping? have you any news about your potential PR? :D
Never got around to it and moved on to other things, sorry :(