yourivw / LEClient

An easy-to-use PHP ACME v2 client library, designed to be used with LetsEncrypt.
MIT License
204 stars 98 forks source link

Error on create LEAccount #95

Open Waruj opened 4 years ago

Waruj commented 4 years ago

I have run file dns_init.php, I already changed Email and domain but it show the following result.

13-07-2020 10:09:39, function getLEDirectory (function get): Array ( [request] => GET https://acme-v02.api.letsencrypt.org/directory [header] => HTTP/1.1 200 OK Server: nginx Date: Mon, 13 Jul 2020 10:09:39 GMT Content-Type: application/json Content-Length: 658 Connection: keep-alive Cache-Control: public, max-age=0, no-cache X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 [status] => 200 [body] => Array ( [3VH0RHvcM7g] => https://community.letsencrypt.org/t/adding-random-entries-to-the-directory/33417 [keyChange] => https://acme-v02.api.letsencrypt.org/acme/key-change [meta] => Array ( [caaIdentities] => Array ( [0] => letsencrypt.org ) [termsOfService] => https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf [website] => https://letsencrypt.org ) [newAccount] => https://acme-v02.api.letsencrypt.org/acme/new-acct [newNonce] => https://acme-v02.api.letsencrypt.org/acme/new-nonce [newOrder] => https://acme-v02.api.letsencrypt.org/acme/new-order [revokeCert] => https://acme-v02.api.letsencrypt.org/acme/revoke-cert ) )

13-07-2020 10:09:40, function getNewNonce (function head): Array ( [request] => HEAD https://acme-v02.api.letsencrypt.org/acme/new-nonce [header] => HTTP/1.1 200 OK Server: nginx Date: Mon, 13 Jul 2020 10:09:40 GMT Connection: keep-alive Cache-Control: public, max-age=0, no-cache Link: ;rel="index" Replay-Nonce: 0102VCHFPU4OvqzIsj-jAl5XdGEehk0bU0yfhqGUwhZtYVw X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 [status] => 200 [body] => )

13-07-2020 10:09:40, function LEAccount __construct: No account found, attempting to create account.

13-07-2020 10:09:42, function createLEAccount (function post): Array ( [request] => POST https://acme-v02.api.letsencrypt.org/acme/new-acct [header] => HTTP/1.1 400 Bad Request Server: nginx Date: Mon, 13 Jul 2020 10:09:42 GMT Content-Type: application/problem+json Content-Length: 108 Connection: keep-alive Cache-Control: public, max-age=0, no-cache Link: ;rel="index" Replay-Nonce: 0101xJQKYNUhPJ0vcvgSXXeuuejFCkWYCkRst26-tCrFoks [status] => 400 [body] => Array ( [type] => urn:ietf:params:acme:error:malformed [detail] => Parse error reading JWS [status] => 400 ) )

How to fix the problem ? Thank you very much.

yourivw commented 4 years ago

Are you sure your information is correctly formatted like in the example? Email address should be an array with one or more addresses in the array. Basename is supposed to be the highest domain level you're adding to the certificate. Then the domains is an array with one or multiple domains.

$email = array('info@example.org');
$basename = 'example.org';
$domains = array('example.org', 'test.example.org');

I cannot reproduce this, my test is creating an account as it should.

bilogic commented 4 years ago

i have the same issue of not being able to create an account

No account found, attempting to create account.

   LEClient\Exceptions\LEConnectorException  : Invalid response: 400

  at /media/sf_new/techbox/vendor/yourivw/leclient/src/Exceptions/LEConnectorException.php:69
    65|
    66|         public static function InvalidResponseException(array $response)
    67|         {
    68|                 $statusCode = array_key_exists('status', $response) ? $response['status'] : 'unknown';
  > 69|                 return new static(sprintf('Invalid response: %s', $statusCode), self::INVALIDRESPONSEEXCEPTION, null, $response);
    70|         }
    71| }
    72|

  Exception trace:

  1   LEClient\Exceptions\LEConnectorException::InvalidResponseException(["POST https://acme-staging-v02.api.letsencrypt.org/acme/new-acct", "HTTP/1.1 100 Continue

HTTP/1.1 400 Bad Request
Server: nginx
Date: Sat, 08 Aug 2020 15:17:29 GMT
Content-Type: application/problem+json
Content-Length: 183
Connection: keep-alive
Cache-Control: public, max-age=0, no-cache
Link: <https://acme-staging-v02.api.letsencrypt.org/directory>;rel="index"
Replay-Nonce: 0002rsonaeRQuql3LEXlhxtVuADpCF8slIYVZQQWhFm5FgE

"])
      /media/sf_new/techbox/vendor/yourivw/leclient/src/LEConnector.php:167

  2   LEClient\LEConnector::request("POST", "https://acme-staging-v02.api.letsencrypt.org/acme/new-acct", "{"protected":"eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdH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YXBpLmxldHNlbmNyeXB0Lm9yZ1wvYWNtZVwvbmV3LWFjY3QifQ","payload":"eyJjb250YWN0IjpbIm1haWx0bzppbmZvQGV4YW1wbGUub3JnIl0sInRlcm1zT2ZTZXJ2aWNlQWdyZWVkIjp0cnVlfQ","signature":"uzrf9uDg9BxzLSiqAxOkzYqt_aWQw2TRizM43RZh28wW8w9NNJdRD26Df8zlm6Xww_wH0UJ4duWhW42kae_mU1NcSTJyjZntaiO0sTMmzIcylAKVFEyvWW1gnUqUPrGOHwlfnUWiFjoFqJ7Jt70GZa9lYNFix9qHxL8DNnph3-5iVVkTxQTwwGogVhEigjF_HxepT1iXwdv2E4eBJ83ZwshJOA5R99dsXp547DDdrOxNFEBPMjJK0Hjfcf-4V5wuxsfn7zaQhJmSkBWGwKIr1CN205B0Ow-kqT5OumA9ss7fpHfkynhmH60yClwldmFUjdB8EY1G3W0Pf4Nth9sXkVHWwqnzV31OpVOihH7z4499iCRDXWQqMOnZOdxhWADMVT1pDXLRAR_wQfYAHwDPaj5w3PpHf9svyfFqRvIR8VONjPrWHcjMJMOSuP7cxx_N3snAAtDhEajF26GIHTUtmT1mTaKDLRtcBKM5GO3SZhxZR4C1WYF4URKgaixYYFiTu2ULVIDRt9AqnB8gnA3ZB9FlBa4_UYmfR235gX5yJxf4tOUzcSTWmgOgit-qSAWSNulyudrfypMHAS-e9EwqAADC-llYK9WlHKReM8SxPHe5LLMW3NokKCQ2E_dLu-3x3597_SHKt6UqlNoay71xA3gb0bGXdHw1q_qpNOsTwqw"}")
      /media/sf_new/techbox/vendor/yourivw/leclient/src/LEConnector.php:195

  Please use the argument -v to see more details.
bilogic commented 4 years ago

I see this has been recurring on several issues. It seems that once the keys folder is deleted, it works correctly.

May I suggest you modify the example to either comment out $email = ['info@example.org']; or have its email as $email = ['info-at-example.org']; for those of us who don't read instructions before running :)