stonemax / acme2

Another PHP client for acme protocal (version 2) implementation, used for generating letsencrypt's free ssl certificates.
MIT License
48 stars 27 forks source link

Throwing error while order is processing #13

Closed afagund closed 6 years ago

afagund commented 6 years ago

Hi,

Ive noticed the code is throwing an exception while the order is in processing state. Please, have a look below:

[php7:error] [pid 26473] [client 10.101.10.3:60616] PHP Fatal error: Uncaught afagund\dcert\vendor\stonemax\exceptions\OrderException: Finalize order failed, the url is: https://acme-v02.api.letsencrypt.org/acme/finalize/31918417/1239798, the domain list is: www.andrefagundes.com, the code is: 400, the header is: HTTP/1.1 100 Continue\r\nExpires: Mon, 26 Mar 2018 22:55:52 GMT\r\nCache-Control: max-age=0, no-cache, no-store\r\nPragma: no-cache\r\n\r\nHTTP/1.1 400 Bad Request\r\nServer: nginx\r\nContent-Type: application/problem+json\r\nContent-Length: 132\r\nBoulder-Requester: 31918417\r\nReplay-Nonce: 1HWxYKLrp6_fGLu_mctqOPJQCa6jL5x40LFD-WHum3k\r\nExpires: Mon, 26 Mar 2018 22:55:52 GMT\r\nCache-Control: max-age=0, no-cache, no-store\r\nPragma: no-cache\r\nDate: Mon, 26 Mar 2018 22:55:52 GMT\r\nConnection: close, the body is: Array\n(\n [type] => urn:ietf:params:acme:error:malformed\n [detail] => Order's status ("processing") was not pending\n [status] => 400\n)\n in /var/www/html/app/vendor/stonemax/OrderService.php:514\nStack trace:\n#0 /var/www/html/app/vendor/stonemax/OrderService.php(384): afagund\dce in /var/www/html/app/vendor/stonemax/OrderService.php on line 514

Even though, the order is being finalized. I was not able to understand this piece of code. How is the order being finalized if it is throwing an exception while trying to finalize?

Thanks, Andre

cpu commented 6 years ago

Even though, the order is being finalized. I was not able to understand this piece of code. How is the order being finalized if it is throwing an exception while trying to finalize?

This looks like an error that would occur if you POSTed a pending order's finalize URL twice. The first POST would transition the order from pending -> processing. The second would error because the status isn't pending anymore.

Unfortunately I can't help diagnose what would cause this client-side but that's my interpretation as an ACME server developer. Hope that helps!

stonemax commented 6 years ago

It seems that you had finalized the order before, and then you finalizedthe the same order again. Maybe you can check weather you had finalized the order twice.

afagund commented 6 years ago

This error was happening with the example.php you provided. The only thing I did was provide the parameters required. I will generate some more tests and will let you know.