stonemax / acme2

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

Handling wildcard + base domain #11

Closed GXTX closed 6 years ago

GXTX commented 6 years ago

Anytime I try to auth my domain with an alt name such as the base domain itself it causes the script to fail. I took the example and piped it into my DNS API. Am I missing something?

['*.example.com', 'example.com']

> wutno@box:~/Programs/CFLetsAutomate# php test.php
> Created _acme-challenge.example.com : 000000-liVj3YRs-EtEfzA-YXNz3YGnmP3pon-00000
> PHP Fatal error:  Uncaught stonemax\acme2\exceptions\AuthorizationException: Verify example.com failed, the authorization status becomes invalid. in /home/wutno/Programs/CFLetsAutomate/vendor/stonemax/acme2/src/services/AuthorizationService.php:166
> Stack trace:
> #0 /home/wutno/Programs/CFLetsAutomate/vendor/stonemax/acme2/src/services/ChallengeService.php(94): stonemax\acme2\services\AuthorizationService->verify('dns-01')
> #1 /home/wutno/Programs/CFLetsAutomate/test.php(57): stonemax\acme2\services\ChallengeService->verify()
> #2 {main}
>   thrown in /home/wutno/Programs/CFLetsAutomate/vendor/stonemax/acme2/src/services/AuthorizationService.php on line 166
> 
stonemax commented 6 years ago

Can you show me your complete code in test.php?

It is noteworthy that both the two domains's dns records names are _acme-challenge.example.com, and the dns record values are different.

GXTX commented 6 years ago

Sure. It dies on the first loop of the foreach.

https://gist.github.com/GXTX/fb8f99bd8adbe69fe10eb30cf41fb7bc