From b6991be7843bf80e2d96a319e724191dd2e9c594 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Mon, 27 May 2013 13:45:59 +0000 Subject: [PATCH] pushing fixes for ACL / QUOTA in postinst + Postfix unused directives + fixing DBSERVER initialisation innewone --- debian/alternc.config | 34 ++++++++----------- debian/alternc.postinst | 1 + debian/alternc.preinst | 2 +- .../templates/alternc/postfix/postfix.cf | 4 +-- install/newone.php | 32 ++++++++++++----- 5 files changed, 40 insertions(+), 33 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 6d68e311..8ba5e122 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -1,7 +1,6 @@ -#! /bin/bash +#! /bin/bash -x set -e -set -x # Source debconf library. . /usr/share/debconf/confmodule @@ -215,30 +214,25 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do #we get the first existing dir aclcheckfile="$basedir/test-acl" touch "$aclcheckfile" - setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null - - if [ $? -ne 0 ]; then - test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true - db_input critical alternc/acluninstalled || true - db_go - db_reset alternc/acluninstalled || true - db_fset alternc/acluninstalled "seen" "false" || true - exit 2 - fi + setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || ( + test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true + db_input critical alternc/acluninstalled || true + db_go + db_reset alternc/acluninstalled || true + db_fset alternc/acluninstalled "seen" "false" || true + exit 2 + ) test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true - quota -gA -f $MOUNT_POINT 2>/dev/null - - - if [ $? -ne 0 ]; then + quota -gA -f $MOUNT_POINT 2>/dev/null || ( db_get alternc/quotauninstalled if [ -z "$RET" ]; then - db_input critical alternc/quotauninstalled || true - db_go + db_input critical alternc/quotauninstalled || true + db_go #db_reset alternc/quotauninstalled || true - db_set alternc/quotauninstalled "false" || true + db_set alternc/quotauninstalled "false" || true fi - fi + ) ;; 11) db_get alternc/alternc_mail diff --git a/debian/alternc.postinst b/debian/alternc.postinst index 54586140..f82affa6 100644 --- a/debian/alternc.postinst +++ b/debian/alternc.postinst @@ -242,6 +242,7 @@ EOF touch /var/lib/alternc/bind/automatic.conf /var/lib/alternc/bind/slaveip.conf chown root:bind /var/lib/alternc/bind/automatic.conf /var/lib/alternc/bind/slaveip.conf chmod 640 /var/lib/alternc/bind/automatic.conf /var/lib/alternc/bind/slaveip.conf + mkdir -p /var/run/alternc && chown alterncpanel:alterncpanel /var/run/alternc touch /var/run/alternc/refresh_slave /usr/lib/alternc/slave_dns # Apache will not start without this file diff --git a/debian/alternc.preinst b/debian/alternc.preinst index 965e8c65..e5aabcd4 100644 --- a/debian/alternc.preinst +++ b/debian/alternc.preinst @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x set -e diff --git a/etc/alternc/templates/alternc/postfix/postfix.cf b/etc/alternc/templates/alternc/postfix/postfix.cf index 5993d973..3c5fe3be 100644 --- a/etc/alternc/templates/alternc/postfix/postfix.cf +++ b/etc/alternc/templates/alternc/postfix/postfix.cf @@ -1,6 +1,6 @@ # Postfix Configuration options # Used by alternc.install with postconf -# CAREFULL this script is not used directly by postfix. +# WARNING: this script is not used directly by postfix! it is parse by alternc.install home_mailbox = Maildir/ smtpd_banner = $myhostname ESMTP header_checks = regexp:/etc/postfix/header_checks @@ -25,7 +25,6 @@ smtpd_tls_auth_only = no smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = postfix smtpd_sasl_security_options = noanonymous -enable_sasl_authentification = yes broken_sasl_auth_clients = yes smtpd_sasl_type=dovecot smtpd_sasl_path=private/auth @@ -37,7 +36,6 @@ virtual_alias_maps = proxy:mysql:/etc/postfix/myalias.cf virtual_alias_domains = virtual_mailbox_domains = proxy:mysql:/etc/postfix/mydomain.cf virtual_mailbox_maps = proxy:mysql:/etc/postfix/myvirtual.cf -virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/myquota.cf virtual_mailbox_base = %%ALTERNC_MAIL%% virtual_minimum_uid = 2000 virtual_gid_maps = proxy:mysql:/etc/postfix/mygid.cf diff --git a/install/newone.php b/install/newone.php index e7d1bf82..af9e7b97 100644 --- a/install/newone.php +++ b/install/newone.php @@ -29,34 +29,48 @@ ---------------------------------------------------------------------- */ -// On vérifie que mysql.so est bien chargé, sinon on essaye de le charger if(!function_exists('mysql_connect')) { if(!dl("mysql.so")) exit(1); } -// Ne vérifie pas ma session :) +// don't check my authentication ! if(!chdir("/usr/share/alternc/panel")) exit(1); require("/usr/share/alternc/panel/class/config_nochk.php"); -// On passe super-admin +// We go root $admin->enabled=1; -// On crée le compte admin : -//FIXME the last parameter should not be chosen by default: it has to match an entry in the db_servers table -if (!$admin->add_mem("admin","admin","Administrateur", "Admin", "postmaster@".$L_FQDN,1,'default',0,'',0 ,'',1)) { +// We Create the default mysql server if needed : +$db->query("SELECT MIN(id) AS id FROM db_servers;"); +$db->next_record(); +if(!intval($db->Record["id"])) { + echo "No default db_servers, creating one\n"; + // No db_servers ? We create one from the local MySQL parameters + if ($L_MYSQL_HOST=="localhost") $client="localhost"; else $client="%"; + $db->query("INSERT INTO db_servers SET `name`='Default', `host`='$L_MYSQL_HOST', `login`='$L_MYSQL_LOGIN', `password`='$L_MYSQL_PWD', `client`='$client';"); + $db->query("SELECT MIN(id) AS id FROM db_servers;"); + $db->next_record(); +} +$dbs=$db->Record["id"]; + +// And create the admin account +if (!$admin->add_mem("admin","admin","Administrateur", "Admin", "postmaster@".$L_FQDN, + 1,'default',0,'',0 ,'', + $dbs + )) { echo $err->errstr()."\n"; exit(1); } -if(!$db->query("update membres set su=1 where login='admin';")) +if(!$db->query("UPDATE membres SET su=1 WHERE login='admin';")) exit(1); -// On lui attribue des quotas par defaut +// Give admin account some default quota: if(!$quota->synchronise_user_profile()) { exit(1); } exit(0); -?> +