From 599d73b54549d808e3d05c3a98c4729d942edd5f Mon Sep 17 00:00:00 2001 From: Alexandre Alouit Date: Fri, 4 Dec 2015 09:47:54 +0100 Subject: bugfix & improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- install.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'install.php') 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"); -- cgit v1.2.3