]>
Raphaƫl G. Git Repositories - acme/blob - letsconf
9f3d9f1afd0dd7d0eb65e6c3d1399a4c40cf0e0a
5 if (count($argv) != 2) {
6 echo 'Usage: genconfig /etc/acmepl/config'."\n";
10 # Directory do not exists
11 if (!is_dir(dirname($argv[1]))) {
12 echo 'Directory '.dirname($argv[1]).' do not exists'."\n";
16 # Directory do not exists
17 if (file_exists($argv[1]) && !in_array(filetype($argv[1]), array('file','link'))) {
18 echo 'File '.$argv[1].' exists and is not a file'."\n";
22 # Symlink target do not exists
23 if (is_link($argv[1]) && !file_exists($argv[1])) {
29 $target = readlink($target);
30 } while (is_link($target));
31 echo 'Symlink '.$argv[1].' target '.$target.' do not exists'."\n";
37 (is_file($argv[1]) && !is_writable($argv[1])) ||
38 (!file_exists($argv[1]) && !is_writable(dirname($argv[1])))
40 echo 'Unable to open '.$argv[1].' for writing'."\n";
45 $config = json_encode(
52 'cert' => '/etc/pki/tls/certs/httpd.pem',
55 'key' => '/etc/pki/tls/private/httpd.pem',
58 'mail' => 'example@example.com',
65 // Production certificate
67 //XXX: set to 1 for production
72 'cert' => '/etc/ssl/certs/apache.crt',
73 'key' => '/etc/ssl/private/apache.key',
74 'mail' => 'example@example.com',
86 if ($argv[1] == '-') {
90 file_put_contents($argv[1], $config);