full templating of postfix and dovecot + little bugfixes

This commit is contained in:
Steven Mondji-Lerider 2012-05-02 13:03:48 +00:00
parent 8a7077ae44
commit 854719a110
9 changed files with 23 additions and 13 deletions

View File

@ -62,7 +62,6 @@ Class m_mail_localbox{
global $db, $err;
$err->log("localbox","set_localbox");
$path="mail/";
//if(!$db->query("select distinct left(ad.address,1) as letter,d.domaine from address ad,where ad.id = $mail_id ;"));
if(!$db->query("select distinct left(ad.address,1) as letter,ad.address ,d.domaine from address ad, domaines d where ad.domain_id = d.id and ad.id = $mail_id order by letter;"));
if(! $db->next_record()){
@ -70,7 +69,7 @@ Class m_mail_localbox{
}
$path="/var/alternc/mail/".$db->f('letter')."/".$db->f('address')."_".$db->f('domaine');
//FIXME faire un touch de la maildir si dovecot ne sait pas le faire.
if(!$db->query("INSERT into mailbox (address_id,path) values ($mail_id,'$path');"));
if(!$db->query("INSERT into mailbox (address_id,path,quota) values ($mail_id,'$path',50);"));
}

View File

@ -56,7 +56,7 @@ case "$1" in
fi
chown -R vmail:vmail /var/alternc/mail
chmod u+w /var/alternc/mail
chmod -R g+w /var/alternc/mail
# build local.sh if it does not exist
if [ ! -f $CONFIGFILE ]; then

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
alternc (1.1+nmu3) stable; urgency=low
* Templating full configuration of postfix & dovecot
* bugfixes in mysql database configuration
* adding default quota (to use with dovecot) in local mailbox creation
-- Squidly <squidly@nnx.com> Wed, 02 May 2012 14:51:49 +0200
alternc (1.1+nmu2) stable; urgency=low
* Templating of dovecot and postfix

View File

@ -1,5 +1,5 @@
connect host=%%dbhost%% dbname=%%dbname%% user=%%dbuser%% password=%%dbpwd%%
connect host=%%dbhost%% dbname=%%dbname%% user=%%db_mail_user%% password=%%db_mail_pwd%%
#connect = host=localhost dbname=mails user=testuser password=pass
# CREATE TABLE quota (

View File

@ -67,7 +67,7 @@ connect = host=%%dbhost%% dbname=%%dbname%% user=%%db_mail_user%% password=%%db_
# List of supported schemes is in
# http://wiki.dovecot.org/Authentication/PasswordSchemes
#
default_pass_scheme = PLAIN-MD5
default_pass_scheme = MD5
# passdb query to retrieve the password. It can return fields:
# password - The user's password. This field must be returned.

View File

@ -1195,6 +1195,7 @@ plugin {
# userdb. It's also possible to give mailbox-specific limits, for example:
# quota_rule = *:storage=1048576
quota_rule = *:storage=100M
quota_rule2 = Trash:storage=10M
# quota_rule2 = Trash:storage=102400
# User has now 1GB quota, but when saving to Trash mailbox the user gets
# additional 100MB.
@ -1212,9 +1213,9 @@ plugin {
# exceeded limit is excecuted, so put the highest limit first.
# Note that % needs to be escaped as %%, otherwise "% " expands to empty.
# quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
# quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
# quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80
quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
#quota = maildir
quota = dict:user::proxy::quotadict

View File

@ -6,5 +6,4 @@ user = %%db_mail_user%%
password = %%db_mail_pwd%%
hosts =%%dbhost%%
dbname = %%dbname%%
query = select domaines.domaine from domaines join address on address.id=domaines.id where concat(address.address,'@',domaines.domaine)='%s' and gesmx=1;
query = select domaines.domaine from domaines where domaine='%s' and gesmx=1;

View File

@ -42,7 +42,7 @@ if [ -e /etc/bind/named.conf ]; then
fi
if [ -d /etc/postfix ]; then
CONFIG_FILES="$CONFIG_FILES etc/postfix/myalias.cf etc/postfix/myrelay.cf
etc/postfix/mydomain.cf etc/postfix/mygid.cf
etc/postfix/mydomain.cf etc/postfix/mygid.cf etc/postfix/myquota.cf
etc/postfix/myvirtual.cf etc/postfix/sasl/smtpd.conf"
fi
if [ -e /etc/proftpd/proftpd.conf ]; then
@ -56,6 +56,10 @@ if [ -e /etc/default/saslauthd ]; then
CONFIG_FILES="$CONFIG_FILES etc/default/saslauthd"
fi
if [ -e /etc/dovecot/dovecot.conf ]; then
CONFIG_FILES="$CONFIG_FILES etc/dovecot/dovecot.conf etc/dovecot/dovecot-sql.conf etc/dovecot/dovecot-dict-quota.conf"
fi
INSTALLED_CONFIG_TAR="/var/backups/alternc/etc-installed.tar.gz"
#######################################################################
@ -264,7 +268,7 @@ for file in body_checks header_checks; do
done
# Attribute the correct rights to critical postfix files
if [ -e /etc/postfix/myalias.cf -o -e /etc/postfix/mydomain.cf -o -e /etc/postfix/mygid.cf -o -e /etc/postfix/myvirtual.cf -o -e /etc/postfix/myrelay.cf ]; then
if [ -e /etc/postfix/myalias.cf -o -e /etc/postfix/mydomain.cf -o -e /etc/postfix/mygid.cf -o -e /etc/postfix/myvirtual.cf -o -e /etc/postfix/myrelay.cf -o -e /etc/postfix/myquota.cf ]; then
chown root:postfix /etc/postfix/my*
chmod 640 /etc/postfix/my*
fi

View File

@ -245,8 +245,7 @@ CREATE TABLE IF NOT EXISTS `address` (
`expire_date` datetime DEFAULT NULL, -- Expiration date, used for temporary addresses.
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Update date, for technical usage only.
PRIMARY KEY (`id`),
UNIQUE INDEX `domain_id_idx` (`domain_id`),
UNIQUE KEY `address` (`address`)
UNIQUE INDEX `fk_domain_id` (`domain_id`,`address`)
) COMMENT = 'This is the main address table. It represents an address as in RFC2822';
--