|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cloudflare\Zone; |
|
4
|
|
|
|
|
5
|
|
|
use Cloudflare\Api; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* CloudFlare API wrapper |
|
9
|
|
|
* |
|
10
|
|
|
* Keyless SSL for a Zone |
|
11
|
|
|
* |
|
12
|
|
|
* @author James Bell <[email protected]> |
|
13
|
|
|
* |
|
14
|
|
|
* @version 1 |
|
15
|
|
|
*/ |
|
16
|
|
|
class KeylessSSL extends Api |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Create a Keyless SSL configuration (permission needed: #ssl:edit) |
|
20
|
|
|
* |
|
21
|
|
|
* @param string $zone_identifier API item identifier tag |
|
22
|
|
|
* @param string $host The keyless SSL host |
|
23
|
|
|
* @param int $port The keyless SSL port used to commmunicate between CloudFlare and the client's Keyless SSL server |
|
24
|
|
|
* @param string $name The keyless SSL name |
|
25
|
|
|
* @param string $certificate The zone's SSL certificate or SSL certificate and intermediate(s) |
|
26
|
|
|
* @param string|null $bundle_method A ubiquitous bundle is a bundle that has a higher probability of being verified everywhere, even by clients using outdated or unusual trust stores. |
|
27
|
|
|
* An optimal bundle is a bundle with the shortest chain and newest intermediates. A forced method attempt to use the certificate/chain as defined by the input |
|
28
|
|
|
*/ |
|
29
|
|
|
public function create($zone_identifier, $host, $port, $name, $certificate, $bundle_method = null) |
|
30
|
|
|
{ |
|
31
|
|
|
$data = [ |
|
32
|
|
|
'host' => $host, |
|
33
|
|
|
'port' => $port, |
|
34
|
|
|
'name' => $name, |
|
35
|
|
|
'certificate' => $certificate, |
|
36
|
|
|
'bundle_method' => $bundle_method, |
|
37
|
|
|
]; |
|
38
|
|
|
|
|
39
|
|
|
return $this->post('zones/'.$zone_identifier.'/keyless_certificates', $data); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* List Keyless SSLs (permission needed: #ssl:read) |
|
44
|
|
|
* |
|
45
|
|
|
* @param string $zone_identifier API item identifier tag |
|
46
|
|
|
*/ |
|
47
|
|
|
public function certificates($zone_identifier) |
|
48
|
|
|
{ |
|
49
|
|
|
return $this->get('zones/'.$zone_identifier.'/keyless_certificates'); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Keyless SSL details (permission needed: #ssl:read) |
|
54
|
|
|
* |
|
55
|
|
|
* @param string $zone_identifier API item identifier tag |
|
56
|
|
|
* @param string $identifier |
|
57
|
|
|
*/ |
|
58
|
|
|
public function details($zone_identifier, $identifier) |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->get('zones/'.$zone_identifier.'/keyless_certificates/'.$identifier); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Update SSL configuration (permission needed: #ssl:edit) |
|
65
|
|
|
* |
|
66
|
|
|
* @param string $zone_identifier API item identifier tag |
|
67
|
|
|
* @param string $identifier |
|
68
|
|
|
* @param string $host The keyless SSL hostname |
|
69
|
|
|
* @param string $name The keyless SSL name |
|
70
|
|
|
* @param int $port The keyless SSL port used to commmunicate between CloudFlare and the client's Keyless SSL server |
|
71
|
|
|
* @param bool|null $enabled Whether or not the Keyless SSL is on or off |
|
72
|
|
|
*/ |
|
73
|
|
|
public function update($zone_identifier, $identifier, $host, $name, $port, $enabled = null) |
|
74
|
|
|
{ |
|
75
|
|
|
$data = [ |
|
76
|
|
|
'host' => $host, |
|
77
|
|
|
'port' => $port, |
|
78
|
|
|
'name' => $name, |
|
79
|
|
|
'enabled' => $enabled, |
|
80
|
|
|
]; |
|
81
|
|
|
|
|
82
|
|
|
return $this->patch('zones/'.$zone_identifier.'/keyless_certificates/'.$identifier, $data); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Delete an SSL certificate (permission needed: #ssl:edit) |
|
87
|
|
|
* |
|
88
|
|
|
* @param string $zone_identifier API item identifier tag |
|
89
|
|
|
* @param string $identifier |
|
90
|
|
|
*/ |
|
91
|
|
|
public function delete_ssl($zone_identifier, $identifier) |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->delete('zones/'.$zone_identifier.'/keyless_certificates/'.$identifier); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|