Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

It's a fatal mistake. #67

Closed
wuknet opened this issue Jun 16, 2019 · 7 comments
Closed

It's a fatal mistake. #67

wuknet opened this issue Jun 16, 2019 · 7 comments

Comments

@wuknet
Copy link

wuknet commented Jun 16, 2019

I run and upload an example, running the website as follows:
https://wuknet.net/ssl/LEClient/examples/dns_init.php

PHP is version 7.1

Error:
Fatal error: Uncaught RuntimeException: Invalid response, header: HTTP/1.1 100 Continue Expires: Sun, 16 Jun 2019 02:21:41 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache HTTP/1.1 400 Bad Request Server: nginx Content-Type: application/problem+json Content-Length: 134 Link: https://acme-staging-v02.api.letsencrypt.org/directory;rel="index" Replay-Nonce: PO0tJRYghpbFjLxRJu5pSky7czYmDo4O0KZyi7bLkd8 Expires: Sun, 16 Jun 2019 02:21:41 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sun, 16 Jun 2019 02:21:41 GMT Connection: close in /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php:150 Stack trace: #0 /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php(187): LEClient\LEConnector->request('POST', 'https://acme-st...', '{"protected":"e...') #1 /home/jcc/wuknet/ssl/LEClient/src/LEAccount.php(114): LEClient\LEConnector->post('https://acme-st...', '{"protected":"e...') #2 /home/jcc/wuknet/ssl/LEClient/src/LEAccount.php(80): LEClient\LEAccount->getLEAccount() #3 /home/jcc in /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php on line 150

@yourivw
Copy link
Owner

yourivw commented Jun 21, 2019

Have you inserted your (email) information in the example script? If not, it's the same issue as #59.
If this is not the case, run the script with the LOG_DEBUG logging level and you will get more information about the error itself.

@wuknet
Copy link
Author

wuknet commented Jun 22, 2019

I didn't modify anything in the example at first, so I made the mistake above.

Now I've changed the example to LOG_DEBUG, changed the domain name to 887d.com, and changed the email address. Please check the following error.

Https://wuknet.net/ssl/LEClient/examples/dns_init.php

22-06-2019 00:59:28, function getLEDirectory (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/directory [header] => HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 724 X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 00:59:28 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 00:59:28 GMT Connection: keep-alive [body] => Array ( [aQhWiFIIM_M] => https://community.letsencrypt.org/t/adding-random-entries-to-the-directory/33417 [keyChange] => https://acme-staging-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/docs/staging-environment/ ) [newAccount] => https://acme-staging-v02.api.letsencrypt.org/acme/new-acct [newNonce] => https://acme-staging-v02.api.letsencrypt.org/acme/new-nonce [newOrder] => https://acme-staging-v02.api.letsencrypt.org/acme/new-order [revokeCert] => https://acme-staging-v02.api.letsencrypt.org/acme/revoke-cert ) )

22-06-2019 00:59:29, function getNewNonce (function head):
Array ( [request] => HEAD https://acme-staging-v02.api.letsencrypt.org/acme/new-nonce [header] => HTTP/1.1 200 OK Server: nginx Link: ;rel="index" Replay-Nonce: aL3w694kQBp3O7rX43L88HrMkdVYVxMTHZDgbj5wI_w X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Content-Length: 0 Expires: Sat, 22 Jun 2019 00:59:29 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 00:59:29 GMT Connection: keep-alive [body] => )

22-06-2019 00:59:31, function getLEAccount (function post):
Array ( [request] => POST https://acme-staging-v02.api.letsencrypt.org/acme/new-acct [header] => HTTP/1.1 100 Continue Expires: Sat, 22 Jun 2019 00:59:30 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache HTTP/1.1 400 Bad Request Server: nginx Content-Type: application/problem+json Content-Length: 134 Link: ;rel="index" Replay-Nonce: _rBMRISmuXhtffw_bu0W9SVDgbWnxFpXRrFKMqr1lGY Expires: Sat, 22 Jun 2019 00:59:31 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 00:59:31 GMT Connection: close [body] => Array ( [type] => urn:ietf:params:acme:error:accountDoesNotExist [detail] => No account exists with the provided key [status] => 400 ) )

Fatal error: Uncaught RuntimeException: Invalid response, header: HTTP/1.1 100 Continue Expires: Sat, 22 Jun 2019 00:59:30 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache HTTP/1.1 400 Bad Request Server: nginx Content-Type: application/problem+json Content-Length: 134 Link: https://acme-staging-v02.api.letsencrypt.org/directory;rel="index" Replay-Nonce: _rBMRISmuXhtffw_bu0W9SVDgbWnxFpXRrFKMqr1lGY Expires: Sat, 22 Jun 2019 00:59:31 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 00:59:31 GMT Connection: close in /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php:150 Stack trace: #0 /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php(187): LEClient\LEConnector->request('POST', 'https://acme-st...', '{"protected":"e...') #1 /home/jcc/wuknet/ssl/LEClient/src/LEAccount.php(114): LEClient\LEConnector->post('https://acme-st...', '{"protected":"e...') #2 /home/jcc/wuknet/ssl/LEClient/src/LEAccount.php(80): LEClient\LEAccount->getLEAccount() #3 /home/jcc in /home/jcc/wuknet/ssl/LEClient/src/LEConnector.php on line 150

@wuknet
Copy link
Author

wuknet commented Jun 22, 2019

Here is my code

`<?php
// Sets the maximum execution time to two minutes, to be sure.
ini_set('max_execution_time', 120);
// Including the autoloader.
include DIR.'/../vendor/autoload.php';

// Importing the classes.
use LEClient\LEClient;
use LEClient\LEOrder;

// Listing the contact information in case a new account has to be created.
$email = array('38958768@qq.com');
// Defining the base name for this order
$basename = '887d.com';
// Listing the domains to be included on the certificate
$domains = array('887d.com', 'www.887d.com');

// Initiating the client instance. In this case using the staging server (argument 2) and outputting all status and debug information (argument 3).
$client = new LEClient($email, true, LECLient::LOG_DEBUG);
// Initiating the order instance. The keys and certificate will be stored in /example.org/ (argument 1) and the domains in the array (argument 2) will be on the certificate.
$order = $client->getOrCreateOrder($basename, $domains);
// Check whether there are any authorizations pending. If that is the case, try to verify the pending authorizations.
if(!$order->allAuthorizationsValid())
{
// Get the DNS challenges from the pending authorizations.
$pending = $order->getPendingAuthorizations(LEOrder::CHALLENGE_TYPE_DNS);
// Walk the list of pending authorization DNS challenges.
if(!empty($pending))
{
foreach($pending as $challenge)
{
// For the purpose of this example, a fictitious functions creates or updates the ACME challenge DNS record for this domain.
setDNSRecord($challenge['identifier'], $challenge['DNSDigest']);
}
}
}
?>`

@yourivw
Copy link
Owner

yourivw commented Jun 22, 2019

My best guess is that the attempt to run the script with the example data created account keys (or at least the account key directory). This gives it away:

Array ( [type] => urn:ietf:params:acme:error:accountDoesNotExist [detail] => No account exists with the provided key [status] => 400 )

Try deleting the account key directory and run it again.

@wuknet
Copy link
Author

wuknet commented Jun 22, 2019

My best guess is that the attempt to run the script with the example data created account keys (or at least the account key directory). This gives it away:

Array ( [type] => urn:ietf:params:acme:error:accountDoesNotExist [detail] => No account exists with the provided key [status] => 400 )

Try deleting the account key directory and run it again.

Errors still exist. Is there any way to solve them?

@yourivw
Copy link
Owner

yourivw commented Jun 22, 2019

I just ran the script again on the link you posted. It doesn't give me the same error as before, instead it gives an error because you try to use the dummy function 'setDNSRecord'. The implementation to set a DNS record should be made by you, since it fully depends on the system/hosting etc.

22-06-2019 15:25:49, function getLEDirectory (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/directory [header] => HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 724 X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:25:49 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:49 GMT Connection: keep-alive [body] => Array ( [IHXKAvzwAks] => https://community.letsencrypt.org/t/adding-random-entries-to-the-directory/33417 [keyChange] => https://acme-staging-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/docs/staging-environment/ ) [newAccount] => https://acme-staging-v02.api.letsencrypt.org/acme/new-acct [newNonce] => https://acme-staging-v02.api.letsencrypt.org/acme/new-nonce [newOrder] => https://acme-staging-v02.api.letsencrypt.org/acme/new-order [revokeCert] => https://acme-staging-v02.api.letsencrypt.org/acme/revoke-cert ) )

22-06-2019 15:25:50, function getNewNonce (function head):
Array ( [request] => HEAD https://acme-staging-v02.api.letsencrypt.org/acme/new-nonce [header] => HTTP/1.1 200 OK Server: nginx Link: ;rel="index" Replay-Nonce: 4d9noYidZWkCeSNvaNixF57Bcehps4TlgQGIourXkeQ X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Content-Length: 0 Expires: Sat, 22 Jun 2019 15:25:50 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:50 GMT Connection: keep-alive [body] => )

22-06-2019 15:25:53, function getLEAccount (function post):
Array ( [request] => POST https://acme-staging-v02.api.letsencrypt.org/acme/new-acct [header] => HTTP/1.1 100 Continue Expires: Sat, 22 Jun 2019 15:25:52 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 972 Link: ;rel="index" Location: https://acme-staging-v02.api.letsencrypt.org/acme/acct/9688215 Replay-Nonce: Ap7yNTy8JsKzYF7CVgYa7qokswC6E3DpLma9ZYKb-Ns X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:25:52 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:52 GMT Connection: keep-alive [body] => Array ( [key] => Array ( [kty] => RSA [n] => uOpn1ct8Y4sXqw1adWPOfLGDxvmxxoIJ3DtBLdlvp2KDcSkyXblvn5bxG1epeWM_YfczpJ1wVyT8dCHURI-H2i0bXNvC2_wOveafZaD9nyY9vcEJ5LCHBfaZmz3DnRF90NOhfZ8Hn-iVl305v9ddvtqjTaZNhFXMJGdOIu9Wzqi8YolHjsPtiACPeR6YYG3rFZfUY5fVjV3GIXRICRUBca2pfmRj0j6uz7gvfEZcYdaFmtqqaJNPXI5DuIuyMOO9q1hDQWHTPjOcWxGgx_SJkYpIVtYsLivrVvOEMk6cYQo9BlAd2MyUb9SjJTdwSLd3GSx2fLNq35aZfi5p5WTJE4-olKi99Icgp8e0nZgLmoImtY8AnllCk5jvqTL61h78kFNFWwgqeHIMEO6Di1GP4-dBVPRtfXijg8TM2tnyvECfZqzTMJDKGQwVRGRMPArMRjgoN7ENLySSfSLUL7qQisV8yqJPW0r_0jUemQF4Hpw0d_TtcgXTgmohQ-23WKMnOnwUGh-FMdn8AHJlpEdkKAYmp4tPkuvVWDD4t_au-HAvuZw6U61leNVQdsOTEDtWQDhvExRdw5FH09iwTyMHKWn37-W4OT_x17E2zK5YEQ8qa8NXTSkVDQYGzQ_xOTFxtTQdPaTZ3cQ8cJzFDWJHX8-9MBk4lYeuXgjzb2Qce8s [e] => AQAB ) [contact] => Array ( [0] => mailto:38958768@qq.com ) [agreement] => https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf [initialIp] => 122.224.5.36 [createdAt] => 2019-06-22T15:04:00Z [status] => valid ) )

22-06-2019 15:25:56, function getLEAccountData (function post):
Array ( [request] => POST https://acme-staging-v02.api.letsencrypt.org/acme/acct/9688215 [header] => HTTP/1.1 100 Continue Expires: Sat, 22 Jun 2019 15:25:55 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 905 Boulder-Requester: 9688215 Link: ;rel="index" Link: ;rel="terms-of-service" Replay-Nonce: tBAQXoXpNaq7fd5dun01BLDVlipgeHRmuH56vbfPLAg X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:25:55 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:55 GMT Connection: keep-alive [body] => Array ( [id] => 9688215 [key] => Array ( [kty] => RSA [n] => uOpn1ct8Y4sXqw1adWPOfLGDxvmxxoIJ3DtBLdlvp2KDcSkyXblvn5bxG1epeWM_YfczpJ1wVyT8dCHURI-H2i0bXNvC2_wOveafZaD9nyY9vcEJ5LCHBfaZmz3DnRF90NOhfZ8Hn-iVl305v9ddvtqjTaZNhFXMJGdOIu9Wzqi8YolHjsPtiACPeR6YYG3rFZfUY5fVjV3GIXRICRUBca2pfmRj0j6uz7gvfEZcYdaFmtqqaJNPXI5DuIuyMOO9q1hDQWHTPjOcWxGgx_SJkYpIVtYsLivrVvOEMk6cYQo9BlAd2MyUb9SjJTdwSLd3GSx2fLNq35aZfi5p5WTJE4-olKi99Icgp8e0nZgLmoImtY8AnllCk5jvqTL61h78kFNFWwgqeHIMEO6Di1GP4-dBVPRtfXijg8TM2tnyvECfZqzTMJDKGQwVRGRMPArMRjgoN7ENLySSfSLUL7qQisV8yqJPW0r_0jUemQF4Hpw0d_TtcgXTgmohQ-23WKMnOnwUGh-FMdn8AHJlpEdkKAYmp4tPkuvVWDD4t_au-HAvuZw6U61leNVQdsOTEDtWQDhvExRdw5FH09iwTyMHKWn37-W4OT_x17E2zK5YEQ8qa8NXTSkVDQYGzQ_xOTFxtTQdPaTZ3cQ8cJzFDWJHX8-9MBk4lYeuXgjzb2Qce8s [e] => AQAB ) [contact] => Array ( [0] => mailto:38958768@qq.com ) [initialIp] => 122.224.5.36 [createdAt] => 2019-06-22T15:04:00Z [status] => valid ) )

22-06-2019 15:25:56, function LEClient __construct:
LEClient finished constructing

22-06-2019 15:25:57, function __construct (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/acme/order/9688215/38075438 [header] => HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 542 Link: ;rel="index" X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:25:56 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:56 GMT Connection: keep-alive [body] => Array ( [status] => pending [expires] => 2019-06-29T15:04:09Z [identifiers] => Array ( [0] => Array ( [type] => dns [value] => 887d.com ) [1] => Array ( [type] => dns [value] => www.887d.com ) ) [authorizations] => Array ( [0] => https://acme-staging-v02.api.letsencrypt.org/acme/authz/7EIrRVRH5o49iSBSD5U_a36wd-rKdVCc3OZ2uE5zJ_4 [1] => https://acme-staging-v02.api.letsencrypt.org/acme/authz/fdVDeeFUpBq6lAd1n_rGem9Sx46SUTVr7-gNAniWHtU ) [finalize] => https://acme-staging-v02.api.letsencrypt.org/acme/finalize/9688215/38075438 ) )

22-06-2019 15:25:58, function __construct (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/acme/authz/7EIrRVRH5o49iSBSD5U_a36wd-rKdVCc3OZ2uE5zJ_4 [header] => HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 925 Link: ;rel="index" X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:25:58 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:25:58 GMT Connection: keep-alive [body] => Array ( [identifier] => Array ( [type] => dns [value] => www.887d.com ) [status] => pending [expires] => 2019-06-29T15:04:09Z [challenges] => Array ( [0] => Array ( [type] => http-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/7EIrRVRH5o49iSBSD5U_a36wd-rKdVCc3OZ2uE5zJ_4/324355241 [token] => 22lFj3IhqtWzVddQ47i5t0RSnpZU0rjovl8r5BjxIyE ) [1] => Array ( [type] => tls-alpn-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/7EIrRVRH5o49iSBSD5U_a36wd-rKdVCc3OZ2uE5zJ_4/324355242 [token] => SwMYvmqsWONSQyDSVEey900ELs33NiZZggvMuwm88tE ) [2] => Array ( [type] => dns-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/7EIrRVRH5o49iSBSD5U_a36wd-rKdVCc3OZ2uE5zJ_4/324355243 [token] => 2kr_LAZk7vmCLLgLimkor3IbtY7pUnAnrfjTap_Nhvc ) ) ) )

22-06-2019 15:26:00, function __construct (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/acme/authz/fdVDeeFUpBq6lAd1n_rGem9Sx46SUTVr7-gNAniWHtU [header] => HTTP/1.1 200 OK Server: nginx Content-Type: application/json Content-Length: 921 Link: ;rel="index" X-Frame-Options: DENY Strict-Transport-Security: max-age=604800 Expires: Sat, 22 Jun 2019 15:26:00 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: no-cache Date: Sat, 22 Jun 2019 15:26:00 GMT Connection: keep-alive [body] => Array ( [identifier] => Array ( [type] => dns [value] => 887d.com ) [status] => pending [expires] => 2019-06-29T15:04:09Z [challenges] => Array ( [0] => Array ( [type] => dns-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/fdVDeeFUpBq6lAd1n_rGem9Sx46SUTVr7-gNAniWHtU/324355238 [token] => 9UIjEcfPK-na5xOjuxGFxpwySlprG7cztndHm6qWRtY ) [1] => Array ( [type] => http-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/fdVDeeFUpBq6lAd1n_rGem9Sx46SUTVr7-gNAniWHtU/324355239 [token] => 4uVpG7U8np3MBQ0KFmhIGms0PGAja5H_XlaVpcCAKGM ) [2] => Array ( [type] => tls-alpn-01 [status] => pending [url] => https://acme-staging-v02.api.letsencrypt.org/acme/challenge/fdVDeeFUpBq6lAd1n_rGem9Sx46SUTVr7-gNAniWHtU/324355240 [token] => r0vBaPCDJ-wtFjDhthdFly21Q7R40H2iCt1-FVNTwYY ) ) ) )

Fatal error: Uncaught Error: Call to undefined function setDNSRecord() in /home/jcc/wuknet/ssl/LEClient/examples/dns_init.php:33 Stack trace: #0 {main} thrown in /home/jcc/wuknet/ssl/LEClient/examples/dns_init.php on line 33

Caution: I strongly recommend you disable this account (see documentation) after you finished testing the script, since the link and output (including keys) have been online, for everyone to see, now.

@wuknet
Copy link
Author

wuknet commented Jun 23, 2019

Thank you, yourivw. This problem has been solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants