]> Raphaƫl G. Git Repositories - acme/blob - www/acme-challenge.php
Version 2.0.4
[acme] / www / acme-challenge.php
1 <?php
2 //Config file to read
3 $conf = '/etc/acme/config';
4
5 //Unable to show key.thumbprint couple
6 if (
7 //Handle get key parsing
8 empty($_GET['key']) || !preg_match('/^[-_a-zA-Z0-9]+$/', $_GET['key']) ||
9 //Handle config parsing
10 !is_readable($conf) || ($config = file_get_contents($conf)) === false || ($config = json_decode($config)) === null ||
11 //Handle thumbprint file read
12 !is_readable($config->thumbprint) || empty($thumbprint = file_get_contents($config->thumbprint))
13 ) {
14 header((!empty($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:'HTTP/1.0').' 404 Not Found');
15 exit;
16 }
17
18 //Send plain text header
19 header('Content-Type: text/plain');
20
21 //Display key.thumbprint couple
22 echo $_GET['key'].'.'.$thumbprint;