diff options
author | Alexandre Alouit <alexandre.alouit@gmail.com> | 2015-12-04 09:47:54 +0100 |
---|---|---|
committer | Alexandre Alouit <alexandre.alouit@gmail.com> | 2015-12-04 09:47:54 +0100 |
commit | 599d73b54549d808e3d05c3a98c4729d942edd5f (patch) | |
tree | 6a35115fa53dc553196510b32caf3e24f2af155f /install.php | |
parent | 876dc671ef09e855eea7714c519977462e90f30c (diff) |
bugfix & improvements
prevent apache with conf.d directory instead conf-available
create challenge directory (prevent Let’s Encrypt create file with bad
permission)
use debug ispconfig function
use fullchain for apache
Diffstat (limited to '')
-rw-r--r-- | install.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/install.php b/install.php index 4fac9d8..c1417c7 100644 --- a/install.php +++ b/install.php @@ -84,13 +84,14 @@ if(!is_file("/root/.local/share/letsencrypt/bin/letsencrypt-renewer")) { exit; } -if(!is_file("/etc/letsencrypt/cli.ini")) { - echo "Let's Encrypt configuration file don't exist, create it.\n"; - exec("cp ./cli.ini /etc/letsencrypt/cli.ini"); -} else { - echo "Let's Encrypt configuration file exist, patch it.\n"; - exec("patch /etc/letsencrypt/cli.ini < ./cli.ini.patch"); +if(is_file("/etc/letsencrypt/cli.ini")) { + echo "Let's Encrypt configuration file exist, backup up and remove.\n"; + exec("cp /etc/letsencrypt/cli.ini " . $backup_dir . date("Ymdhis") . "-letsencrypt.cli.ini"); + exec("rm /etc/letsencrypt/cli.ini"); + } +echo "Copy Let's Encrypt configuration.\n"; +exec("cp ./cli.ini /etc/letsencrypt/cli.ini"); if(!$buffer = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password)) { echo "ERROR: There was a problem with the MySQL connection.\n"; @@ -102,10 +103,18 @@ mysql_db_query($conf['db_database'], "ALTER TABLE `web_domain` ADD `ssl_letsencr if(is_file("/etc/apache2/apache2.conf")) { echo "Configure Apache and reload it.\n"; - if(is_file("/etc/apache2/conf-available/letsencrypt.conf")) { - exec("rm /etc/apache2/conf-available/letsencrypt.conf"); + if(is_dir("/etc/apache2/conf-available")) { + if(is_file("/etc/apache2/conf-available/letsencrypt.conf")) { + exec("rm /etc/apache2/conf-available/letsencrypt.conf"); + } + exec("cp ./apache.letsencrypt.conf /etc/apache2/conf-available/letsencrypt.conf"); + } + if(is_dir("/etc/apache2/conf.d")) { + if(is_file("/etc/apache2/conf.d/letsencrypt.conf")) { + exec("rm /etc/apache2/conf.d/letsencrypt.conf"); + } + exec("cp ./apache.letsencrypt.conf /etc/apache2/conf.d/letsencrypt.conf"); } - exec("cp ./apache.letsencrypt.conf /etc/apache2/conf-available/letsencrypt.conf"); exec("a2enmod headers"); exec("a2enconf letsencrypt"); exec("service apache2 reload"); |