Skip to content

Commit 3971a21

Browse files
authored
ACMECert v3.7.0
- added support for IP address certificates - added option to disable grouping of dns-01 challenges
2 parents d951095 + 0145b79 commit 3971a21

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ACMECert v3.6.0
1+
# ACMECert v3.7.0
22

33
PHP client library for [Let's Encrypt](https://letsencrypt.org/) and other [ACME v2 - RFC 8555](https://tools.ietf.org/html/rfc8555) compatible Certificate Authorities.
44

@@ -23,6 +23,7 @@ It is self contained and contains a set of functions allowing you to:
2323
- [parse certificates](#acmecertparsecertificate) / get the [remaining days](#acmecertgetremainingdays) or [percentage](#acmecertgetremainingpercent) a certificate is still valid
2424
- get/use [ACME Renewal Information](#acmecertgetari) (ARI)
2525
- get/use [ACME certificate profiles](#acmecertgetprofiles)
26+
- issue IP address certificates
2627
- and more..
2728
> see [Function Reference](#function-reference) for a full list
2829
@@ -268,6 +269,7 @@ $handler=function($opts) use ($ac){
268269
// Stop ALPN Responder
269270
fclose($pipes[0]);
270271
fclose($pipes[1]);
272+
proc_terminate($resource);
271273
proc_close($resource);
272274
shell_exec('/etc/init.d/apache2 start');
273275
};
@@ -733,22 +735,34 @@ public string ACMECert::getCertificateChain ( mixed $pem, array $domain_config,
733735
>> ```php
734736
>> array( 'notAfter' => '1970-01-01T01:22:17+01:00' )
735737
>> ```
736-
>>
738+
>
737739
>> **`replaces`** (string)
738740
>>
739741
>> The ARI CertID uniquely identifying a previously-issued certificate which this order is intended to replace.
740742
>>
741743
>> Use: [getARI](#acmecertgetari) to get the ARI CertID for a certificate.
742744
>>
743745
>> Example: [Get/Use ACME Renewal Information](#getuse-acme-renewal-information)
744-
>>
746+
>
745747
>> **`profile`** (string)
746748
>>
747749
>> The name of the profile to use.
748750
>>
749751
>> Use: [getProfiles](#acmecertgetprofiles) to get a list of available profiles.
750752
>>
751753
>> Example: [ACME certificate profiles](#acme-certificate-profiles)
754+
>
755+
>> **`group`** (boolean / default: `TRUE`)
756+
>>
757+
>> When issuing certificates using the `dns-01` challenge for multiple domains that share the same `_acme-challenge` subdomain, such as:
758+
>> - example.com
759+
>> - *.example.com (wildcard)
760+
>>
761+
>> two distinct TXT records must be created under the same DNS name `_acme-challenge.example.com`
762+
>>
763+
>> By default, ACMECert groups these challenges together. This means all required TXT records for `_acme-challenge.example.com` are set simultaneously, and validation is triggered only after all records are in place. This approach prevents validation failures due to DNS caching delays.
764+
>>
765+
>> If set to `FALSE` challenges are handled independently. Each TXT record gets set and validated one at a time.
752766
753767
754768

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "skoerfgen/acmecert",
3-
"version": "3.6.0",
3+
"version": "3.7.0",
44
"description": "PHP client library for Let's Encrypt and other ACME v2 - RFC 8555 compatible Certificate Authorities",
55
"license": "MIT",
66
"authors": [

src/ACMECert.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function getCertificateChain($pem,$domain_config,$callback,$settings=arra
205205
$groups[
206206
$domain_config[$domain]['challenge'].
207207
'|'.
208-
ltrim($domain,'*.')
208+
(($settings['group'])?ltrim($domain,'*.'):$domain)
209209
][$domain]=array($auth_url,$authorization);
210210
}
211211

@@ -335,7 +335,7 @@ public function generateCSR($domain_key_pem,$domains){
335335
$fn=$this->tmp_ssl_cnf($domains);
336336
$cn=reset($domains);
337337
$dn=array();
338-
if (strlen($cn)<=64){
338+
if (!filter_var($cn,FILTER_VALIDATE_IP) && strlen($cn)<=64){
339339
$dn['commonName']=$cn;
340340
}
341341
$csr=openssl_csr_new($dn,$domain_key,array(
@@ -536,10 +536,11 @@ private function parseSettings($opts){
536536
// authz_reuse: backwards compatibility to ACMECert v3.1.2 or older
537537
if (!is_array($opts)) $opts=array('authz_reuse'=>(bool)$opts);
538538
if (!isset($opts['authz_reuse'])) $opts['authz_reuse']=true;
539+
if (!isset($opts['group'])) $opts['group']=true;
539540

540541
$diff=array_diff_key(
541542
$opts,
542-
array_flip(array('authz_reuse','notAfter','notBefore','replaces','profile'))
543+
array_flip(array('authz_reuse','notAfter','notBefore','replaces','profile','group'))
543544
);
544545

545546
if (!empty($diff)){
@@ -561,7 +562,11 @@ private function makeOrder($domains,$opts){
561562
$order=array(
562563
'identifiers'=>array_map(
563564
function($domain){
564-
return array('type'=>'dns','value'=>$domain);
565+
if (filter_var($domain,FILTER_VALIDATE_IP)){
566+
return array('type'=>'ip','value'=>$domain);
567+
}else{
568+
return array('type'=>'dns','value'=>$domain);
569+
}
565570
},
566571
$domains
567572
)
@@ -681,7 +686,12 @@ private function tmp_ssl_cnf($domains=null,$extension=''){
681686
'[SAN]'."\n".
682687
'subjectAltName='.
683688
implode(',',array_map(function($domain){
684-
return 'DNS:'.$domain;
689+
if (filter_var($domain,FILTER_VALIDATE_IP)){
690+
return 'IP:'.$domain;
691+
}else{
692+
return 'DNS:'.$domain;
693+
}
694+
685695
},$domains))."\n"
686696
:
687697
''

src/ACMEv2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ protected function http_request($url,$data=null){
308308
}
309309

310310
$method=$data===false?'HEAD':($data===null?'GET':'POST');
311-
$user_agent='ACMECert v3.6.0 (+https://github.com/skoerfgen/ACMECert)';
311+
$user_agent='ACMECert v3.7.0 (+https://github.com/skoerfgen/ACMECert)';
312312
$header=($data===null||$data===false)?array():array('Content-Type: application/jose+json');
313313
if ($this->ch) {
314314
$headers=array();

0 commit comments

Comments
 (0)