From 6e2a1196ccc9fedfbf5bb4bf55ef0b1adbf705ea Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Sun, 26 Aug 2012 17:20:10 +0000 Subject: [PATCH] adding a THIRD Debian Package : alternc-squirrelmail: configures squirrelmail + avelsieve + changepass. BIG change also in alternc.install : uses /usr/lib/alternc/install.d/ with run-parts. Also adding /etc/alternc/apache-panel.d/ for apache2 instructions ONLY in panel vhosts. TO BE TESTED --- .gitattributes | 7 +- bureau/admin/index.php | 9 +- debian/alternc-squirrelmail.dirs | 8 + debian/alternc.dirs | 5 +- debian/control | 37 +- debian/rules | 5 + etc/alternc/templates/alternc/bureau.conf | 6 +- etc/alternc/templates/apache2/panel.conf | 5 +- etc/alternc/templates/dovecot/dovecot.conf | 1 - install/alternc.install | 97 +++-- squirrelmail/apache-panel.d/squirrelmail.conf | 4 + squirrelmail/squirrelmail-install | 33 ++ .../javascript-common/javascript-common.conf | 11 + .../templates/squirrelmail/apache.conf | 2 +- .../squirrelmail/avelsieve-config.php | 330 ++++++++++++++++++ src/functions.sh | 54 +-- 16 files changed, 552 insertions(+), 62 deletions(-) create mode 100644 debian/alternc-squirrelmail.dirs create mode 100644 squirrelmail/apache-panel.d/squirrelmail.conf create mode 100644 squirrelmail/squirrelmail-install create mode 100644 squirrelmail/templates/javascript-common/javascript-common.conf rename {etc/alternc => squirrelmail}/templates/squirrelmail/apache.conf (73%) create mode 100644 squirrelmail/templates/squirrelmail/avelsieve-config.php diff --git a/.gitattributes b/.gitattributes index 730a6066..66ac827e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -382,6 +382,7 @@ debian/alternc-slave.postinst -text debian/alternc-slave.postrm -text debian/alternc-slave.prerm -text debian/alternc-slave.templates -text +debian/alternc-squirrelmail.dirs -text debian/alternc.config -text debian/alternc.cron.d -text debian/alternc.dirs -text @@ -444,7 +445,6 @@ etc/alternc/templates/postfix/sasl/smtpd.conf -text etc/alternc/templates/proftpd/modules.conf -text etc/alternc/templates/proftpd/proftpd.conf -text etc/alternc/templates/proftpd/welcome.msg -text -etc/alternc/templates/squirrelmail/apache.conf -text install/alternc.install -text install/body_checks -text install/domaines.template -text @@ -500,6 +500,11 @@ po/fr/LC_MESSAGES/alternc-admintools.po -text selenium/20120826-alternc-panel-testsuite.html -text selenium/README -text selenium/alternc.domain-local-mail-tld.html -text +squirrelmail/apache-panel.d/squirrelmail.conf -text +squirrelmail/squirrelmail-install -text +squirrelmail/templates/javascript-common/javascript-common.conf -text +squirrelmail/templates/squirrelmail/apache.conf -text +squirrelmail/templates/squirrelmail/avelsieve-config.php -text src/Makefile -text src/alternc-check -text src/alternc-dboptimize -text diff --git a/bureau/admin/index.php b/bureau/admin/index.php index a575116c..34140abe 100644 --- a/bureau/admin/index.php +++ b/bureau/admin/index.php @@ -1,14 +1,10 @@ = 0.5.00) | debconf-2.0 -Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, squirrelmail, squirrelmail-locales, bind9, wget, rsync, quota, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, fam | gamin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, bash, acl, dovecot-common (>= 1:1.2.15), dovecot-imapd, dovecot-pop3d, vlogger, mailx +Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, quota, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, fam | gamin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, bash, acl, dovecot-common (>= 1:1.2.15), dovecot-imapd, dovecot-pop3d, vlogger, mailx Recommends: mysql-server(>= 5.0), dovecot-managesieved, dovecot-sieve, dovecot-mysql, ntp Conflicts: alternc-admintools, alternc-awstats (< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (< 2.0), courier-authdaemon Provides: alternc-admintools Replaces: alternc-admintools -Suggests: alternc-awstats, alternc-mailman, alternc-changepass, amavisd-new, clamav-daemon, spamassassin, pop-before-smtp, magpierss, zip, ncompress, bzip2 +Suggests: alternc-awstats, alternc-mailman, alternc-changepass, amavisd-new, clamav-daemon, spamassassin, pop-before-smtp, magpierss, zip, ncompress, bzip2, alternc-squirrelmail, alternc-roundcube Description: Hosting software managment suite for Debian AlternC is a mutualized hosting software manager for Linux. It allows you to manage your websites, domains, ftp, emails, aliases, @@ -36,8 +36,6 @@ Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian . Pour plus d'informations, consultez http://www.alternc.com/ - - Package: alternc-slave Architecture: all Pre-depends: debconf (>= 0.5.00) | debconf-2.0 @@ -74,4 +72,33 @@ Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian . Pour plus d'informations, consultez http://www.alternc.com/ - +Package: alternc-squirrelmail +Architecture: all +Pre-depends: debconf (>= 0.5.00) | debconf-2.0 +Depends: debianutils (>= 1.13.1), alternc (>= 1.1), squirrelmail, squirrelmail-locales, avelsieve +Conflicts: alternc (<= 1.0.3) +Provides: alternc-webmail +Suggests: +Description: Squirrelmail-Webmail plugin and configuration for AlternC + AlternC is a mutualized hosting software manager for Linux. + It allows you to manage your websites, domains, ftp, emails, aliases, + web statistics, mailing-lists, jabber accounts, etc. + . + This extension to AlternC is installing and configuring properly the + Squirrelmail Webmail. It also configure Avelsieve to allow server-side + filtering, the password changing through MySQL, and the automatic + creation of proper profile with the right address and language. + . + More information at http://www.alternc.com/ +Homepage: http://www.alternc.com/ +Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian + AlternC est un logiciel d'hébergement mutualisé pour serveur Linux. + Il permet de gérer les sites web, domaines, ftp, emails, alias, + statistiques web, listes de discussions, comptes jabber, etc. + . + Cette extension d'AlternC installe et configure le webmail Squirrelmail. + Il configure aussi Avelsieve pour permettre l'accès au filtrage du courrier + côté serveur, ainsi que le changement de mot de passe via MySQL et la création + automatique des profiles avec la bonne adresse et la bonne langue. + . + Pour plus d'informations, consultez http://www.alternc.com/ diff --git a/debian/rules b/debian/rules index e24eca76..c8b323d9 100755 --- a/debian/rules +++ b/debian/rules @@ -96,6 +96,11 @@ install: build cp debian/alternc.lintian debian/alternc/usr/share/lintian/overrides/alternc cp debian/alternc-slave.lintian debian/alternc/usr/share/lintian/overrides/alternc-slave + install -m 644 squirrelmail/templates/squirrelmail/* debian/alternc-squirrelmail/etc/alternc/templates/squirrelmail/ + install -m 644 squirrelmail/templates/javascript-common/* debian/alternc-squirrelmail/etc/alternc/templates/javascript-common/ + install -m 750 squirrelmail/squirrelmail-install debian/alternc-squirrelmail/usr/lib/alternc/install.d/ + install -m 644 squirrelmail/apache-panel.d/squirrelmail.conf debian/alternc-squirrelmail/etc/alternc/apache-panel.d/ + # This single target is used to build all the packages, all at once, or # one at a time. So keep in mind: any options passed to commands here will # affect _all_ packages. Anything you want to only affect one package diff --git a/etc/alternc/templates/alternc/bureau.conf b/etc/alternc/templates/alternc/bureau.conf index 891f2a7b..3754466a 100644 --- a/etc/alternc/templates/alternc/bureau.conf +++ b/etc/alternc/templates/alternc/bureau.conf @@ -7,5 +7,7 @@ RewriteRule ^/admin/(.*) /$1 [R=301,L] alias /alternc-sql /usr/share/phpmyadmin - alias /webmail /usr/share/squirrelmail - + + # will be used to define aliases such as /javascript /webmail /squirrelmail ... + Include /etc/alternc/apache-panel.d/*.conf + diff --git a/etc/alternc/templates/apache2/panel.conf b/etc/alternc/templates/apache2/panel.conf index 2945d161..9a3f77cc 100644 --- a/etc/alternc/templates/apache2/panel.conf +++ b/etc/alternc/templates/apache2/panel.conf @@ -7,5 +7,8 @@ RewriteRule ^/admin/(.*) /$1 alias /alternc-sql /usr/share/phpmyadmin - alias /webmail /usr/share/squirrelmail + + # will be used to define aliases such as /javascript /webmail /squirrelmail ... + Include /etc/alternc/apache-panel.d/*.conf + diff --git a/etc/alternc/templates/dovecot/dovecot.conf b/etc/alternc/templates/dovecot/dovecot.conf index e7232831..ad6b9911 100644 --- a/etc/alternc/templates/dovecot/dovecot.conf +++ b/etc/alternc/templates/dovecot/dovecot.conf @@ -22,7 +22,6 @@ # Protocols we want to be serving: imap imaps pop3 pop3s managesieve # If you only want to use dovecot-auth, you can set this to "none". protocols = imap imaps pop3 pop3s managesieve -protocols = imap imaps # A space separated list of IP or host addresses where to listen in for # connections. "*" listens in all IPv4 interfaces. "[::]" listens in all IPv6 diff --git a/install/alternc.install b/install/alternc.install index ed02090c..94dd5193 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -1,21 +1,48 @@ #!/bin/sh + +# ---------------------------------------------------------------------- +# AlternC - Web Hosting System +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ +# ---------------------------------------------------------------------- +# LICENSE # -# AlternC Main install script. -# This script should be launched only once, when installing AlternC -# on a new server. THIS SCRIPT ERASE ALL DATA ON THE AlternC SYSTEM !! -# YOU HAVE BEEN WARNED ! +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# To read the license please visit http://www.gnu.org/copyleft/gpl.html +# ---------------------------------------------------------------------- +# Purpose of file: Main install script, launch it anytime ;) +# ---------------------------------------------------------------------- # This script now assumes it has MySQL connectivity through # /etc/alternc/my.cnf +# Also launches scripts in /usr/lib/alternc/install.d/ +# with an argument telling where you are in alternc.install +# argument will be : startup, templates, before-reload, end + +# Somes check before start operations +if [ `id -u` -ne 0 ]; then + echo "must be launched as root" + exit 1 +fi + set -e for i in $*; do case "$i" in -f|--force) - force=1; shift;; + export force=1; shift;; -s|--slave) - slave=1; shift;; + export slave=1; shift;; --) break;; *) @@ -25,6 +52,9 @@ done . /usr/lib/alternc/functions.sh +# hook +run-parts --arg=startup /usr/lib/alternc/install.d + ####################################################################### # Script configuration # @@ -48,9 +78,6 @@ fi if [ -e /etc/proftpd/proftpd.conf ]; then CONFIG_FILES="$CONFIG_FILES etc/proftpd/proftpd.conf etc/proftpd/welcome.msg etc/proftpd/modules.conf" fi -if [ -e /etc/squirrelmail/apache.conf ]; then - CONFIG_FILES="$CONFIG_FILES etc/squirrelmail/apache.conf" -fi if [ -e /etc/default/saslauthd ]; then CONFIG_FILES="$CONFIG_FILES etc/default/saslauthd" @@ -82,7 +109,7 @@ if [ -f "$INSTALLED_CONFIG_TAR" ]; then echo "changing the template in $TEMPLATE_DIR and then calling" echo "$0 to perform the update." echo "" - echo "Please examine the situation closely and call '$0 --force'" + echo "Please examine the situation closely and call '$0 -f'" echo "if you still want to actually overwrite these files." exit 1 fi @@ -174,6 +201,9 @@ s\\%%version%%\\$VERSION\\; s\\%%ns2_ip%%\\$NS2_IP\\; EOF +# hook +run-parts --arg=templates /usr/lib/alternc/install.d + ####################################################################### # Backup configuration files # @@ -214,9 +244,10 @@ php="`ls /usr/lib/apache*/*/*php*.so | sed -e 's/^.*libphp\(.\)\.so$/php\1/' | t ln -fs /etc/alternc/alternc.ini /etc/$php/conf.d/alternc.ini || true if [ -x /usr/sbin/apache2 ]; then s="" - if ! [ -L /etc/apache2/mods-enabled/vhost_alias.load ] + # unused from AlternC 1.1 + if [ -L /etc/apache2/mods-enabled/vhost_alias.load ] then - a2enmod vhost_alias + a2dismod vhost_alias s="apache2" fi if ! [ -L /etc/apache2/mods-enabled/$php.load ] @@ -279,7 +310,7 @@ then echo "POSTFIX is NOT configured properly" echo "please launch dpkg-reconfigure -plow postfix" echo "and choose 'Internet Site'" - echo "then reinstall alternc" + echo "then launch alternc.install again" echo "****************************************" exit 1 fi @@ -294,7 +325,7 @@ grep -v '^\ *#' $postfix_conf |while read line ; do postconf -e "$line" done -# Conviguring delivery used bu Postfix +# Conviguring delivery used by Postfix echo `/usr/lib/alternc/postfix-add-policy dovecot vmail:vmail DRhu pipe '/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${recipient} '` # Bug #1215: configure mydestination when $FQDN is not in @@ -325,13 +356,29 @@ if [ -x /usr/sbin/locale-gen ] ; then echo "fr_FR ISO-8859-1" >>/etc/locale.gen LOCALECHANGED=1 fi + if ! grep -q "^de_DE.UTF-8 UTF-8$" /etc/locale.gen ; then + echo "de_DE.UTF-8 UTF-8" >>/etc/locale.gen + LOCALECHANGED=1 + fi + if ! grep -q "^fr_FR.UTF-8 UTF-8$" /etc/locale.gen ; then + echo "fr_FR.UTF-8 UTF-8" >>/etc/locale.gen + LOCALECHANGED=1 + fi + if ! grep -q "^es_ES.UTF-8 UTF-8$" /etc/locale.gen ; then + echo "es_ES.UTF-8 UTF-8" >>/etc/locale.gen + LOCALECHANGED=1 + fi + if ! grep -q "^en_US.UTF-8 UTF-8$" /etc/locale.gen ; then + echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen + LOCALECHANGED=1 + fi if [ "$LOCALECHANGED" ] ; then locale-gen fi fi ####################################################################### -#populate alternc database with the mailname used by postfix to send mail for each vhost +# populate alternc database with the mailname used by postfix to send mail for each vhost # mailname=`cat /etc/mailname` mysql_query "update variable SET value='"$mailname"' where name='mailname_bounce';" @@ -343,13 +390,6 @@ chmod +r "/etc/mailname" # tar -zcf "$INSTALLED_CONFIG_TAR" -C / $CONFIG_FILES -####################################################################### -# Reload services -# -for service in postfix bind9 dovecot cron proftpd; do - invoke-rc.d $service force-reload || true -done - ####################################################################### # Last touches # @@ -390,6 +430,16 @@ chown -R alterncpanel:alterncpanel "$ALTERNC_LOC/bureau" # We force the re-computing of the DNS zones, since we may have changed the IP address (see #460) /usr/bin/mysql --defaults-file="/etc/alternc/my.cnf" -B -e "update domaines set dns_action='update';" +# hook +run-parts --arg=before-reload /usr/lib/alternc/install.d + +####################################################################### +# Reload services +# +for service in postfix bind9 dovecot cron proftpd; do + invoke-rc.d $service force-reload || true +done + # We should restart apaches after all configuration stuff ... for service in $SERVICES; do test -x /etc/init.d/$service && invoke-rc.d $service stop || true @@ -397,3 +447,6 @@ done for service in $SERVICES; do test -x /etc/init.d/$service && invoke-rc.d $service start || true done + +# hook +run-parts --arg=end /usr/lib/alternc/install.d diff --git a/squirrelmail/apache-panel.d/squirrelmail.conf b/squirrelmail/apache-panel.d/squirrelmail.conf new file mode 100644 index 00000000..39d4b4c1 --- /dev/null +++ b/squirrelmail/apache-panel.d/squirrelmail.conf @@ -0,0 +1,4 @@ + +Alias /squirrelmail /usr/share/squirrelmail +Alias /javascript /usr/share/javascript-common + diff --git a/squirrelmail/squirrelmail-install b/squirrelmail/squirrelmail-install new file mode 100644 index 00000000..308b3c13 --- /dev/null +++ b/squirrelmail/squirrelmail-install @@ -0,0 +1,33 @@ +#!/bin/bash + +# ---------------------------------------------------------------------- +# AlternC - Web Hosting System +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ +# ---------------------------------------------------------------------- +# LICENSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# To read the license please visit http://www.gnu.org/copyleft/gpl.html +# ---------------------------------------------------------------------- +# Purpose of file: Install squirrelmail conf files. +# ---------------------------------------------------------------------- + +if [ "$1" = "templates" ] +then + echo "Installing Squirrelmail Templates ..." + cp -f /etc/alternc/templates/squirrelmail/avelsieve-config.php /etc/alternc/templates/squirrelmail/apache.conf /etc/squirrelmail/ + cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/ + echo "Done" +fi + + diff --git a/squirrelmail/templates/javascript-common/javascript-common.conf b/squirrelmail/templates/javascript-common/javascript-common.conf new file mode 100644 index 00000000..b9c448d4 --- /dev/null +++ b/squirrelmail/templates/javascript-common/javascript-common.conf @@ -0,0 +1,11 @@ + +# WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again. + +#Alias /javascript /usr/share/javascript/ + + + Options FollowSymLinks MultiViews + Order allow,deny + Allow from all + + diff --git a/etc/alternc/templates/squirrelmail/apache.conf b/squirrelmail/templates/squirrelmail/apache.conf similarity index 73% rename from etc/alternc/templates/squirrelmail/apache.conf rename to squirrelmail/templates/squirrelmail/apache.conf index 67749f06..74704ba9 100644 --- a/etc/alternc/templates/squirrelmail/apache.conf +++ b/squirrelmail/templates/squirrelmail/apache.conf @@ -1,7 +1,7 @@ # # Squirrelmail apache config modified for AlternC # -# %%warning_message%% +# WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again. # #Alias /squirrelmail /usr/share/squirrelmail diff --git a/squirrelmail/templates/squirrelmail/avelsieve-config.php b/squirrelmail/templates/squirrelmail/avelsieve-config.php new file mode 100644 index 00000000..e00edad3 --- /dev/null +++ b/squirrelmail/templates/squirrelmail/avelsieve-config.php @@ -0,0 +1,330 @@ + + * @copyright 2002-2004 Alexandros Vellis + * @package plugins + * @subpackage avelsieve + */ + +/** + * Debug Mode. Enable this (change to 1) if you need to send a bug report, + * or to 2 or 3 if you are a developer! + * + * Valid values: + * 0 = No debugging output + * 1 = Normal debugging output + * 2 = Firebug-enhanced debugging output + * 3 = Enhanced debugging output and no Sieve capabilities checks - enables + * all UI features! + */ +if(!defined('AVELSIEVE_DEBUG')) { + define('AVELSIEVE_DEBUG', 0); +} + +/* ======================================================================== */ +/* =================== IMAP Server / SIEVE Setup ========================= */ +/* ======================================================================== */ + +/** @var string Backend to use. Available backends are: + * 'ManageSieve': Uses the ManageSieve protocol. e.g. Cyrus + * 'File': Writes files straight to disk. e.g. Exim4, Dovecot LDA. + */ +global $avelsieve_backend; +$avelsieve_backend = 'ManageSieve'; + + + +/* ======================================================================== */ +/* =================== ManageSieve Backend Options ======================== */ +/* ======================================================================== */ + +/* Port where timsieved listens on the Cyrus IMAP server. Default is 2000. */ + +/** DEBIAN CHANGE: Depsite upstream's intention Debian changed this default + * distribution wide to 4190 which is thus default here. + */ + +global $sieveport; +$sieveport = 2000; + +/** + * @var string Space separated list of preferred SASL mechanisms for the + * authentication to timsieved. e.g. "PLAIN DIGEST-MD5";*/ + +global $sieve_preferred_sasl_mech; +$sieve_preferred_sasl_mech = 'PLAIN'; + +/** + * @var boolean Disable STARTTLS for ManageSieve. You can set this to true, + * if you do not wish to use encryption via TLS mechanisms (i.e. the server + * is not configured properly, or this is a local connection and TLS is not + * needed. + * Note that STARTTLS is supported only in PHP5+. In PHP4 this option will + * have no effect and STARTTLS will be disabled anyway. + * + * DEBIAN CHANGE: + * To properly work with a default cyrus installation on the same host as + * SquirrelMail $avelsieve_disabletls defaults to true. + */ +global $avelsieve_disabletls; +$avelsieve_disabletls = true; + +/* ======================================================================== */ +/* ======================= File Backend Options =========================== */ +/* ======================================================================== */ + +global $avelsieve_file_backend_options, $data_dir, $username; +$avelsieve_file_backend_options = array( + 'avelsieve_default_file' => "$data_dir/$username.sievesource" +); + +/* ======================================================================== */ +/* ====== Implementation- and Server-Specific Options ==================== */ +/* ======================================================================== */ + + +/* In Cyrus 2.3+, the notification action is a bit more complex than the + * others. The oldcyrus variable is for supporting the partially implemented + * notify extension implementation of Cyrus < 2.3. If you have Cyrus < 2.3, + * just set this to true. + * + * This only changes the informational / help text displayed in avelsieve. + * + * Cyrus < 2.3 : $from$, $env-from$, $subject$ + * Cyrus 2.3+ : $from$, $env-from$, $subject$, $text$, $text[n]$ + */ +global $avelsieve_oldcyrus; +$avelsieve_oldcyrus = true; + +/* If you have Cyrus with an lmtpd that can understand the "auth" argument to + * the :envelope test as the SMTP/LMTP auth, or any other Sieve implementation, + * then you can enable this to provide this functionality to the user. + * + * This was not clarified in the base spec of RFC 3028. It will be done + * correctly in a new version of Cyrus, based on a new draft / spec. + */ +global $avelsieve_enable_envelope_auth; +$avelsieve_enable_envelope_auth = true; + +/* Some Implementations of Sieve need certain things in order to operate + * correctly. If you use any of the following server implementations, you MUST + * set this variable to the corresponding value for the filtering to work + * correctly. + * Valid values are: + * - Any RFC3028-mostly-compatible implementation: '' (empty). + * - Exim MTA: 'exim' + * - MFL (as supported by mvmf): 'mfl' + */ +global $avelsieve_custom_sieve_implementation; +$avelsieve_custom_sieve_implementation = ''; + + +/* For delivery agents that don't know how to handle some mailbox prefixes, you + * can enable this option. Example for Dovecot LDA: 'INBOX.'; + */ +global $avelsieve_striproot; +$avelsieve_striproot = ''; + +/* If the backend does not support capabilities reporting, such as the File + * Backend, then you should define which capabilities are used by the server + * implementation. + * + * The following are the capabilities supported by Exim4 as of Exim version + * 4.60, according to README.SIEVE. You can change them if a new version of + * Exim provides more functionality: + * 'envelope', 'fileinto', 'copy', 'vacation', 'comparator-i;ascii-numeric' + * + * The following are the capabilities that are suported by MFM, according to: + * http://www.mvmf.org/mfl/language.shtml#sieve + * 'envelope', 'fileinto', 'reject', 'relational', 'subaddress', 'regex', + * 'editheader', 'copy', 'vacation', 'comparator-i;ascii-casemap', + * 'comparator-i;octet' + * + * The following capabilities have been reported to work with Dovecot LDA: + * 'envelope', 'fileinto', 'copy', 'vacation', 'comparator-i;ascii-numeric', + * 'imapflags', 'subaddress','relational','regex' + * + */ +global $avelsieve_hardcoded_capabilities; +$avelsieve_hardcoded_capabilities = array( + 'envelope', 'fileinto', 'copy', 'vacation', 'comparator-i;ascii-numeric' +); + + +/** @var boolean Enable ImapProxy mode. + * If you use imapproxy, because imapproxy cannot understand and proxy the + * SIEVE protocol, you must connect to the SIEVE daemon (usually on the IMAP + * server) itself. So you need to set $imapproxymode to true, and define a + * mapping, from the imapproxy host (usually localhost) to your real IMAP + * server (usually the same that is defined on Imapproxy's configuration). + * + * This will not work if you use a perdition-style proxy, where different users + * go to different IMAP servers; it applies mostly to people running imapproxy + * for speed and want a quick hack. */ + +global $avelsieve_imapproxymode, $avelsieve_imapproxyserv; +$avelsieve_imapproxymode = false; +$avelsieve_imapproxyserv = array( + 'localhost' => 'imap.example.org' +); + +/** @var boolean Ldapuserdata mode: Gets user's email addresses (including + * mailAlternate & mailAuthorized) from LDAP Prefs Backend plugin's cache */ + +global $avelsieve_ldapuserdatamode; +$avelsieve_ldapuserdatamode = false; + +/** @var array Map of cyrus administrator users, for proxy authentication */ + +global $avelsieve_cyrusadmins_map; +$avelsieve_cyrusadmins_map = array( + 'cyrusimap' => 'cyrussieve' +); + + + +/* ======================================================================== */ +/* =============== Avelsieve Interface / Behavior Setup ================== */ +/* ======================================================================== */ + +/* Be conservative to our updates on the SIEVE server? If true, a button + * entitled "Save Changes" will appear, which will give the user the + * functionality to register her changes. 'false' is recommended. */ +$conservative = false; + +/* Use images for the move up / down, delete rule buttons and STOP? */ + +$useimages = true; + +/* Translate the messages returned by the "Reject" and "Vacation" actions? The + * default behaviour since 0.9 is not to translate them. Change to true if in + * an intranet environment or in a same-language environment. */ + +global $translate_return_msgs; +$translate_return_msgs = false; + +/* Theme to use for the images. A directory with the same name must exist under + * plugins/avelsieve/$imagetheme, that contains the files: up.png, down.png, + * del.png, dup.png, edit.png, top.png, bottom.png. */ + +$imagetheme = 'famfamfam'; +//$imagetheme = 'bluecurve_24x24'; +//$imagetheme = 'bluecurve_16x16'; + +/* Number of items to display _initially_, when displaying the header match + * rule */ +global $startitems; +$startitems = 3; + +/* Maximum number of items to allow in one header match rule. */ +global $maxitems; +$maxitems = 10; + +/* Headers to display in listbox widget, when adding a new header rule. */ + +global $headers; +$headers = array( + 'From', 'To', 'Cc', 'Bcc', 'Subject', 'Reply-To', 'Sender', 'List-Id', + 'MailingList', 'Mailing-List', 'X-ML-Name', 'X-List', 'X-List-Name', 'X-Mailing-List', + 'Resent-From', 'Resent-To', 'X-Mailer', 'X-Mailing-List', + /* debian and ubuntu flags */ + 'X-PTS-Package', 'X-Loop', 'X-Debian-PR-Message', 'X-Debian-PR-Package', + 'X-Debian-PR-Keywords', 'X-Debian-PR-Source', 'X-PTS-Keyword', + 'X-Debian', 'X-Debian-Package', + 'X-Launchpad-Bug', 'X-Launchpad-Bug-Private', 'X-Launchpad-Bug-Security-Vulnerability', + 'X-Launchpad-Message-Rationale', 'X-Generated-By', + /* debian and ubuntu flags end */ + 'X-Spam-Flag', 'X-Spam-Status', + 'X-Priority', 'Importance', 'X-MSMail-Priority', 'Precedence', + 'Return-Path', 'Received', 'Auto-Submitted', + 'X-Spam-Flag', 'X-Spam-Status','X-Spam-Tests' + ); + +/* Available :method's for the :notify extension (if applicable) */ +global $notifymethods; +$notifymethods = array( +'mailto', 'sms' +); +/* use the value "false" if you want to provide a simple input box so that + * users can edit the method themselves : */ +//$notifymethods = false; + + +/* Capabilities to disable. If you would like to force avelsieve not to display + * certain features, even though there _is_ a capability for them by + * Cyrus/timsieved, you should specify these here. For instance, if you would + * like to disable the notify extension, even though timsieved advertises it, + * you should add 'notify' in this array: $force_disable_avelsieve_capability = + * array("notify");. This will still leave the defined feature on, and if the + * user can upload her own scripts then she can use that feature; this option + * just disables the GUI of it. Leave as-is (empty array) if you do not need + * that. + * + * Look in $implemented_capabilities array in include/constants.inc.php for + * valid values */ + +// $disable_avelsieve_capabilities = array("notify"); +global $disable_avelsieve_capabilities; +$disable_avelsieve_capabilities = array(); + +/* Display Filters link in the top Squirrelmail header? */ + +global $avelsieveheaderlink; +$avelsieveheaderlink = true; + +/* Default rules table display mode, one of 'verbose' or 'terse' */ +global $avelsieve_default_mode; +$avelsieve_default_mode = 'terse'; + + + +/* ======================================================================== */ +/* ========================= Custom rules Configuration =================== */ +/* ======================================================================== */ + +/** + * @var array + * List of additional rules to enable. This must be the numeric id of the + * rule. + * + * 10: Spam Rule (as existed in Avelsieve) + * 11: Junk-Mail Rule (new-style SPAM Rule, only one exists per Sieve script) + * 12: Global Whitelist (only one exists per Sieve script) + * 13: Custom Sieve Code (allows users to enter whatever Sieve code they like - + * Alpha/Experimental) + * + * Example: + * array(11, 12); + */ +global $avelsieve_enable_rules; +$avelsieve_enable_rules = array(); + +global $avelsieve_rules_settings; +$avelsieve_rules_settings = array(); +foreach($avelsieve_enable_rules as $r) { + if(file_exists(SM_PATH . 'plugins/avelsieve/config/rule.'.$r.'.php')) { + require(SM_PATH . 'plugins/avelsieve/config/rule.'.$r.'.php'); + } else { + require(SM_PATH . 'plugins/avelsieve/config/rule.'.$r.'.default.php'); + } +} + +/* Please keep the following setting false; it is alpha + needs Squirrelmail + * to be patched in three or four places. */ + +$avelsieve_spam_highlight_enable = false; + + diff --git a/src/functions.sh b/src/functions.sh index 2a423a48..e86af16b 100755 --- a/src/functions.sh +++ b/src/functions.sh @@ -1,29 +1,45 @@ #!/bin/bash -# functions.sh next-gen by Fufroma -# Init some vars +# ---------------------------------------------------------------------- +# AlternC - Web Hosting System +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ +# ---------------------------------------------------------------------- +# LICENSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# To read the license please visit http://www.gnu.org/copyleft/gpl.html +# ---------------------------------------------------------------------- +# Purpose of file: Main functions used for any bash script for AlternC. +# ---------------------------------------------------------------------- + +# Init some vars . /etc/alternc/local.sh + # Init some other vars MYSQL_DO="/usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e " mysql_query() { /usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e "$@" ; } DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log" VHOST_FILE="$VHOST_DIR/vhosts_all.conf" -# Some usefull miscellaneous shell functions + +# Some useful miscellaneous shell functions print_domain_letter() { -# local domain="$1" -# -# local letter=`echo "$domain" | awk '{z=split($NF, a, ".") ; print substr(a[z-1], 1, 1)}'` -# if [ -z "$letter" ]; then -# letter="_" -# fi -# echo $letter local domain=$1 domain=${domain/.${domain/*./}/} domain=${domain/*./} domain=${domain:0:1} - # Bash match un é quand on lui donne [a-z]. Etrange + # Bash match a 'é' when we give him [a-z]. Strange if [[ "$domain" =~ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0-9]{1} ]]; then echo $domain else @@ -31,30 +47,28 @@ print_domain_letter() { fi } + +# echoes the first letter of an alternc account name. print_user_letter() { local user="$1" echo ${user:0:1} } + +# return the uid of an alternc account get_uid_by_name() { mysql_query 'SELECT uid FROM membres WHERE login="'"$1"'" LIMIT 1;' } + # imprime le nom d'usager associé au domaine get_account_by_domain() { - # les admintools ne sont peut-être pas là -# if [ -x "/usr/bin/get_account_by_domain" ] -# then -# # only first field, only first line -# /usr/bin/get_account_by_domain "$1"|head -1|awk '{ print $1;}' -# else - # implantons localement ce que nous avons besoin, puisque admintools - # n'est pas là mysql_query 'SELECT a.login FROM membres a, sub_domaines b WHERE a.uid = b.compte AND \ CONCAT(IF(sub="", "", CONCAT(sub, ".")), domaine) = "'"$1"'" LIMIT 1;' -# fi } + +# Log (echoes+log) an error and exit the current script with an error. log_error() { local error=$1 echo "`date` $0 : $1" | tee -a "$DOMAIN_LOG_FILE" >&2