diff --git a/debian/alternc-ssl.postinst b/debian/alternc-ssl.postinst
index 763c4b76..f2eb00d5 100755
--- a/debian/alternc-ssl.postinst
+++ b/debian/alternc-ssl.postinst
@@ -14,9 +14,6 @@ case "$1" in
echo "Installing mysql table"
mysql --defaults-file=/etc/alternc/my.cnf -f < /usr/share/alternc/install/ssl.sql || true
- # Create default quota "ssl" with value 0
- mysql --defaults-file=/etc/alternc/my.cnf -fBse "INSERT INTO defquotas VALUES ('ssl', 0, 'default')" || true
-
echo "installing required apache modules"
a2enmod ssl
diff --git a/debian/alternc-ssl.postrm b/debian/alternc-ssl.postrm
index 3a8bf899..f12f38e0 100755
--- a/debian/alternc-ssl.postrm
+++ b/debian/alternc-ssl.postrm
@@ -5,19 +5,28 @@ MENUFILE="/etc/alternc/menulist.txt"
case "$1" in
remove)
- alternc.install || true # don't fail removal if alternc.install bails out
# TODO : we don't purge *-ssl vhosts or *-ssl templates, they may break the hosting ...
if [ -e "$CONFIGFILE" -a -x "/usr/bin/mysql" ]; then
mysql --defaults-file=${CONFIGFILE} -f -e "DELETE FROM domaines_type WHERE name IN ('vhost-ssl','vhost-mixssl','roundcube-ssl','squirrelmail-ssl','panel-ssl','php52-ssl','php52-mixssl');"
mysql --defaults-file=${CONFIGFILE} -f -e "UPDATE sub_domaines SET web_action='DELETE' WHERE type IN ('vhost-ssl','vhost-mixssl','roundcube-ssl','squirrelmail-ssl','panel-ssl','php52-ssl','php52-mixssl');"
fi
+ echo -e "\033[31m**********************************************"
+ echo "* *"
+ echo "* ALTERNC-SSL ACTION REQUESTED *"
+ echo "* *"
+ echo "* Please run alternc.install to fully remove *"
+ echo "* *"
+ echo "**********************************************"
+ echo -e "\033[0m"
+
;;
purge)
# Purge the certificate and alias table:
if [ -e "$CONFIGFILE" -a -x "/usr/bin/mysql" ]; then
mysql --defaults-file=${CONFIGFILE} -f -e "DROP TABLE IF EXISTS certificate;"
mysql --defaults-file=${CONFIGFILE} -f -e "DROP TABLE IF EXISTS certif_alias;"
+ mysql --defaults-file=${CONFIGFILE} -f -e "DROP TABLE IF EXISTS certif_hosts;"
fi
;;
esac
diff --git a/ssl/Makefile b/ssl/Makefile
index aa8a8cc9..45a3883b 100755
--- a/ssl/Makefile
+++ b/ssl/Makefile
@@ -19,6 +19,7 @@
install:
install -m 0644 -g root -o root ssl.sql $(DESTDIR)/usr/share/alternc/install/
install -m 0755 -g root -o root alternc-ssl.install.php $(DESTDIR)/usr/lib/alternc/install.d/alternc-ssl
+ install -m 0644 -g root -o root README.txt $(DESTDIR)/var/lib/alternc/ssl/private/
# incron
install -m 0755 -g root -o root ssl_alias_manager.sh $(DESTDIR)/usr/lib/alternc/
diff --git a/ssl/README.txt b/ssl/README.txt
new file mode 100644
index 00000000..fdcd94bb
--- /dev/null
+++ b/ssl/README.txt
@@ -0,0 +1,4 @@
+
+This folder will contains the SSL certificates,
+chained certificates and private keys of VHOSTS
+used by Apache to serve HTTPS pages.
diff --git a/ssl/alternc-ssl.install.php b/ssl/alternc-ssl.install.php
index f43c6cca..cde0ae8b 100644
--- a/ssl/alternc-ssl.install.php
+++ b/ssl/alternc-ssl.install.php
@@ -63,7 +63,7 @@ if ($argv[1] == "before-reload") {
} else {
$found = false;
while ($s = fgets($f, 1024)) {
- if (preg_match("#NameVirtualHost.*443#", $s)) {
+ if (preg_match(":[^#]*NameVirtualHost.*443:", $s)) {
$found = true;
break;
}
diff --git a/ssl/hosting_vhost-ssl.sh b/ssl/hosting_vhost-ssl.sh
index 29e0562a..9680d90d 100755
--- a/ssl/hosting_vhost-ssl.sh
+++ b/ssl/hosting_vhost-ssl.sh
@@ -20,6 +20,11 @@
// Bootstrap
require_once("/usr/share/alternc/panel/class/config_nochk.php");
+if (!isset($ssl)) {
+ echo "OUPS: hosting_vhost-ssl.sh launched, but ssl module not installed, exiting\n";
+ exit();
+}
+
if (!isset($argv[1])) {
echo "FATAL: must be launched from functions_hosting.sh !\n";
exit();
diff --git a/ssl/panel/admin/ssl_delete.php b/ssl/panel/admin/ssl_delete.php
new file mode 100644
index 00000000..5a040ab3
--- /dev/null
+++ b/ssl/panel/admin/ssl_delete.php
@@ -0,0 +1,48 @@
+ array("post", "integer", ""),
+ "delete" => array("post", "string", ""),
+ "confirm" => array("post", "string", ""),
+);
+getFields($fields);
+
+if (!isset($delete)) {
+ require_once("ssl_list.php");
+ exit();
+}
+
+$ok = $ssl->del_certificate($id);
+
+if ($ok) $info=_("Your SSL Certificate has been deleted");
+
+$error = $err->errstr();
+
+require_once("ssl_list.php");
+
diff --git a/ssl/panel/admin/ssl_finalize.php b/ssl/panel/admin/ssl_finalize.php
index 8683577e..33471983 100644
--- a/ssl/panel/admin/ssl_finalize.php
+++ b/ssl/panel/admin/ssl_finalize.php
@@ -30,9 +30,15 @@ $fields = array(
"id" => array("post", "integer", ""),
"crt" => array("post", "string", ""),
"chain" => array("post", "string", ""),
+ "delete" => array("post","string",""),
);
getFields($fields);
+if ($delete!="") {
+ require_once("ssl_delete.php");
+ exit();
+}
+
$cert = $ssl->finalize($id, $crt, $chain);
$error = $err->errstr();
diff --git a/ssl/panel/admin/ssl_list.php b/ssl/panel/admin/ssl_list.php
index f0d97bda..b88f736a 100644
--- a/ssl/panel/admin/ssl_list.php
+++ b/ssl/panel/admin/ssl_list.php
@@ -50,9 +50,15 @@ if (!$error)
$astatus = array(
$ssl::STATUS_PENDING => _("Pending Certificate"),
$ssl::STATUS_OK => _("Valid"),
- $ssl::STATUS_EXPIRED => ("Expired"),
+ $ssl::STATUS_EXPIRED => "" . _("Expired") . "",
);
+$vhosts = $ssl->get_vhosts();
+foreach ($vhosts as $v) {
+ if ($v["certif"] == 0) {
+ $info=_("Some of your hosting are using a self-signed certificate.
Your browser will not let you surf those domains properly
To fix this, buy a properly signed certificate")."
".$info;
+ }
+}
include_once("head.php");
if ($error) {
@@ -76,7 +82,7 @@ if ($info) {
"/>
- | " . _("(shared)") . ""; - ?> | +" . _("(shared)") . ""; + ?> | -- | - - | - | - + | + "; + echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validendts"])); + if ($val["validendts"] < (time() + 86400 * 31)) + echo ""; + ?> |
+
+ + |
+
+ " . $v["fqdn"] . " \n"; + } + } + ?> |
-
+ "; + echo " | " . _("This hosting has no valid certificate a self-signed one has been created") . " | ";
+ echo "" . $v["fqdn"] . " | "; + echo ""; + } + } + ?> +
+ diff --git a/ssl/panel/admin/ssl_view.php b/ssl/panel/admin/ssl_view.php index 519944ce..3e19be60 100644 --- a/ssl/panel/admin/ssl_view.php +++ b/ssl/panel/admin/ssl_view.php @@ -81,6 +81,10 @@ if ($cert["status"] == $ssl::STATUS_PENDING) {
"/> " onclick="document.location = 'ssl_list.php'"/> +
+ " onclick="return confirm('');"/>
@@ -103,7 +107,9 @@ if ($cert["status"] == $ssl::STATUS_PENDING) { -+