]>
Raphaƫl G. Git Repositories - acme/blob - letsconf
   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( 
  49                 'thumbprint' => '/etc/acmepl/thumbprint', 
  51                 'certificates' => array( 
  56                                 'cert' => '/etc/pki/tls/certs/httpd.pem', 
  59                                 'key' => '/etc/pki/tls/private/httpd.pem', 
  62                                 'mail' => 'webmaster@example.com', 
  65                                 'domain' => 'www.example.com', 
  72                                 // Production certificate 
  74                                 //XXX: set to 1 for production 
  79                                 'cert' => '/etc/ssl/certs/apache.crt', 
  80                                 'key' => '/etc/ssl/private/apache.key', 
  81                                 'mail' => 'postmaster@example.com', 
  82                                 'domain' => 'mail.example.com', 
  92         // Product a nice result 
  93         JSON_PRETTY_PRINT
|JSON_UNESCAPED_SLASHES
 
  97 if ($argv[1] == '-') { 
 101         file_put_contents($argv[1], $config);