]> Raphaƫl G. Git Repositories - acme/blob - www/acme-challenge.php
Add letscron script
[acme] / www / acme-challenge.php
1 <?php
2 //Config file to read
3 $conf = '/etc/acmepl/config';
4
5 //Unable to show key.thumbprint couple
6 if (
7 //Handle config parsing
8 !is_readable($conf) || ($config = file_get_contents($conf)) === false || ($config = json_decode($config)) === null ||
9 //Handle thumbprint file read
10 !is_readable($config->thumbprint) || ($thumbprint = file_get_contents($config->thumbprint)) === false ||
11 //Handle get key parsing
12 empty($_GET['key']) || !preg_match('/^[-_a-zA-Z0-9]+$/', $_GET['key'])
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;