mirror of
https://github.com/anikeen-com/yaac.git
synced 2026-03-19 16:46:07 +00:00
Merge branch 'lordelph-master'
# Conflicts: # src/Data/Authorization.php
This commit is contained in:
47
README.md
47
README.md
@@ -117,6 +117,53 @@ foreach ($authorizations as $authorization) {
|
||||
The code above will first perform a self test and, if successful, will do 15 attempts to ask LetsEncrypt to validate the challenge (with 1 second intervals) and
|
||||
retrieve an updated status (it might take Lets Encrypt a few seconds to validate the challenge).
|
||||
|
||||
### Alternative ownership validation via DNS
|
||||
|
||||
You can also use DNS validation - to do this, you will need access to an API for your DNS
|
||||
provider to create TXT records for the target domains.
|
||||
|
||||
```php
|
||||
|
||||
//store a map of domain=>TXT record we can use to wait with
|
||||
$dnsRecords[];
|
||||
|
||||
foreach ($authorizations as $authorization) {
|
||||
$challenge = $authorization->getDnsChallenge();
|
||||
|
||||
$txtRecord = $authorization->getTxtRecord($challenge);
|
||||
|
||||
$domain=$authorization->getDomain();
|
||||
$validationDomain='_acme-challenge.'.$domain;
|
||||
|
||||
//remember the record we're about to set
|
||||
$dnsRecords[$validationDomain] = $txtRecord;
|
||||
|
||||
//set TXT record for $validationDomain to $txtRecord value
|
||||
//--
|
||||
//-- you need to add code for your DNS provider here
|
||||
//--
|
||||
}
|
||||
```
|
||||
|
||||
A helper is included which will allow you to wait until you can see the
|
||||
DNS changes before asking Let's Encrypt to validate it, e.g.
|
||||
|
||||
```php
|
||||
//wait up to 60 seconds for all our DNS updates to propagate
|
||||
if (!Helper::waitForDNS($dnsRecords, 60)) {
|
||||
throw new \Exception('Unable to verify TXT record update');
|
||||
}
|
||||
```
|
||||
|
||||
Once this passes we can ask Let's Encrypt to do the same...
|
||||
|
||||
```php
|
||||
foreach ($authorizations as $authorization) {
|
||||
$ok = $client->validate($authorization->getDnsChallenge(), 15);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Get the certificate
|
||||
|
||||
Now to know if we can request a certificate for the order, test if the order is ready as follows:
|
||||
|
||||
Reference in New Issue
Block a user