[fix] incron not working for aliases, reload aliases every hour anyway, don't reload apache if not needed

This commit is contained in:
Benjamin Sonntag 2015-02-24 18:54:28 +01:00
parent 1b113a9940
commit 29ce982d40
6 changed files with 20 additions and 10 deletions

View File

@ -1,4 +1,5 @@
# Every hour, do ssl actions
33 * * * * root /usr/lib/alternc/update_ssl.php
@reboot root mkdir -p /var/run/alternc/ssl && chown alterncpanel:alterncpanel /var/run/alternc/ssl
@reboot root mkdir -p /var/run/alternc-ssl && chown alterncpanel:alterncpanel /var/run/alternc-ssl
# in case incron didn't work, fix ssl aliases every hour:
44 * * * * root /usr/lib/alternc/ssl_alias_manager.sh

View File

@ -35,7 +35,7 @@ ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
php_admin_flag safe_mode off
AddDefaultCharset UTF-8
# open_basedir allows access to specifics directories. We need to grant access to these directories for alternc, awstats, mailman...
php_admin_value open_basedir /usr/share/alternc-mailman/patches/:/etc/alternc/:/run/alternc/:/var/run/alternc/:/usr/share/alternc/panel/:%%ALTERNC_HTML%%/:/tmp:/usr/share/php/:/var/cache/alternc-webalizer/:/etc/locale.gen:%%ALTERNC_LOGS%%:/etc/awstats/:/var/log/alternc/:/var/lib/alternc/panel/
php_admin_value open_basedir /usr/share/alternc-mailman/patches/:/etc/alternc/:/run/:/var/run/:/usr/share/alternc/panel/:%%ALTERNC_HTML%%/:/tmp:/usr/share/php/:/var/cache/alternc-webalizer/:/etc/locale.gen:%%ALTERNC_LOGS%%:/etc/awstats/:/var/log/alternc/:/var/lib/alternc/panel/
</Directory>

View File

@ -1 +1 @@
/var/run/alternc/ssl IN_CREATE,IN_ATTRIB,IN_NO_LOOP /usr/lib/alternc/ssl_alias_manager.sh
/var/run/alternc-ssl IN_CREATE,IN_ATTRIB,IN_NO_LOOP /usr/lib/alternc/ssl_alias_manager.sh

View File

@ -9,6 +9,11 @@ if ($argv[1] == "templates") {
// install ssl.conf
echo "[alternc-ssl] Installing ssl.conf template\n";
copy("/etc/alternc/templates/apache2/mods-available/ssl.conf","/etc/apache2/mods-available/ssl.conf");
mkdir("/var/run/alternc-ssl");
chown("/var/run/alternc-ssl","alterncpanel");
chgrp("/var/run/alternc-ssl","alterncpanel");
// replace open_basedir line if necessary :
exec('sed -i -e "s#:/var/run/alternc#:/var/run#" -e "s#:/run/alternc#:/run#" /etc/alternc/apache2.conf /etc/alternc/templates/alternc/apache2.conf');
}
if ($argv[1] == "before-reload") {

View File

@ -42,7 +42,7 @@ class m_ssl {
const FILTER_OK = 2;
const FILTER_EXPIRED = 4;
const FILTER_SHARED = 8;
const SSL_INCRON_FILE = "/var/run/alternc/ssl/generate_certif_alias";
const SSL_INCRON_FILE = "/var/run/alternc-ssl/generate_certif_alias";
var $myDomainesTypes = array("vhost-ssl", "vhost-mixssl", "panel-ssl", "roundcube-ssl", "squirrelmail-ssl", "php52-ssl", "php52-mixssl");

View File

@ -1,6 +1,6 @@
#!/bin/bash
rm -f /var/run/alternc/ssl/generate_certif_alias
rm -f /var/run/alternc-ssl/generate_certif_alias
# Launched by incron when /tmp/generate_certif_alias exists
# regenerate the list of global aliases used by Comodo for certificate ownership validation
@ -18,7 +18,11 @@ do
echo "alias $name ${FILEDIR}${name}" >>$TMP
echo "$content" >"${FILEDIR}${name}"
done
mv -f "$TMP" "$APACHECONF"
service apache2 reload
if ! diff -q "$TMP" "$APACHECONF"
then
mv -f "$TMP" "$APACHECONF"
service apache2 reload
else
rm -f "$TMP"
fi