From 4a096f265c260630bacab343f1292363f31c423b Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Sun, 26 Aug 2012 19:59:12 +0000 Subject: [PATCH] Squirrelmail CAN'T BE CONFIGURED THROUGH A PROXY, so that configuration is currently commented out. We need to find a way to run the webmail on another web host than the panel one, that's all. No other solution found. So, next step for alternc-squirrelmail is to propose a vhost from the panel index WHEN ADMIN has a 'squirrelmail' type vhost ... --- .gitattributes | 6 +++- debian/alternc-squirrelmail.dirs | 3 ++ debian/alternc-squirrelmail.postinst | 8 +++-- debian/control | 35 +++++++++++++++++-- debian/rules | 6 ++-- install/alternc.install | 7 ++-- install/mysql.sql | 15 ++++---- install/upgrades/1.1.php | 21 +++++++++++ install/upgrades/1.1.sql | 4 +++ squirrelmail/Makefile | 34 ++++++++++++++++++ squirrelmail/apache-panel.d/squirrelmail.conf | 22 ++++++++++-- squirrelmail/apache2.conf | 23 ++++++++++++ squirrelmail/redirect.php | 4 +++ squirrelmail/squirrelmail-install | 32 +++++++++++++++-- .../templates/apache2/squirrelmail.conf | 10 +++++- src/Makefile | 10 ++---- 16 files changed, 206 insertions(+), 34 deletions(-) create mode 100644 install/upgrades/1.1.php create mode 100644 squirrelmail/Makefile create mode 100644 squirrelmail/apache2.conf create mode 100644 squirrelmail/redirect.php rename etc/alternc/templates/apache2/webmail.conf => squirrelmail/templates/apache2/squirrelmail.conf (61%) diff --git a/.gitattributes b/.gitattributes index 1eaaa46c..f246ca99 100644 --- a/.gitattributes +++ b/.gitattributes @@ -422,7 +422,6 @@ etc/alternc/templates/alternc/bureau.conf -text etc/alternc/templates/apache2/panel.conf -text etc/alternc/templates/apache2/url.conf -text etc/alternc/templates/apache2/vhost.conf -text -etc/alternc/templates/apache2/webmail.conf -text etc/alternc/templates/bind/automatic.conf -text etc/alternc/templates/bind/named.conf.options -text etc/alternc/templates/bind/slaveip.conf -text @@ -472,6 +471,7 @@ install/upgrades/0.9.9.sql -text install/upgrades/1.0.1.php -text install/upgrades/1.0.3.sql -text install/upgrades/1.0.sql -text +install/upgrades/1.1.php -text install/upgrades/1.1.sql -text install/upgrades/README -text lang/README -text @@ -501,8 +501,12 @@ 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/Makefile -text squirrelmail/apache-panel.d/squirrelmail.conf -text +squirrelmail/apache2.conf -text +squirrelmail/redirect.php -text squirrelmail/squirrelmail-install -text +squirrelmail/templates/apache2/squirrelmail.conf -text squirrelmail/templates/javascript-common/javascript-common.conf -text squirrelmail/templates/squirrelmail/apache.conf -text squirrelmail/templates/squirrelmail/avelsieve-config.php -text diff --git a/debian/alternc-squirrelmail.dirs b/debian/alternc-squirrelmail.dirs index a5996cbb..b32c1518 100644 --- a/debian/alternc-squirrelmail.dirs +++ b/debian/alternc-squirrelmail.dirs @@ -1,8 +1,11 @@ +etc/apache2/conf.d etc/alternc etc/alternc/apache-panel.d etc/alternc/templates/squirrelmail +etc/alternc/templates/apache2 etc/alternc/templates/javascript-common etc/cron.d etc/squirrelmail usr/share/alternc/install usr/lib/alternc/install.d +usr/share/alternc-squirrelmail \ No newline at end of file diff --git a/debian/alternc-squirrelmail.postinst b/debian/alternc-squirrelmail.postinst index 14b642b3..e617722a 100644 --- a/debian/alternc-squirrelmail.postinst +++ b/debian/alternc-squirrelmail.postinst @@ -14,10 +14,12 @@ case "$1" in if ! getent passwd alternc-squirrelmail; then useradd -g nogroup -u 1997 alternc-squirrelmail -d /usr/share/squirrelmail fi + dpkg-statoverride --list /var/spool/squirrelmail/attach >/dev/null || dpkg-statoverride --add alternc-squirrelmail root 0750 /var/spool/squirrelmail/attach - dpkg-statoverride --add alternc-squirrelmail root 0750 /usr/lib/squirrelmail/data - chown -R alternc-squirrelmail:root /var/spool/squirrelmail/attach /usr/lib/squirrelmail/data - chmod -R 750 /var/spool/squirrelmail/attach /usr/lib/squirrelmail/data + dpkg-statoverride --list /var/lib/squirrelmail/data >/dev/null || + dpkg-statoverride --add alternc-squirrelmail root 0750 /var/lib/squirrelmail/data + chown -R alternc-squirrelmail:root /var/spool/squirrelmail/attach /var/lib/squirrelmail/data + chmod -R 750 /var/spool/squirrelmail/attach /var/lib/squirrelmail/data ;; esac diff --git a/debian/control b/debian/control index 61994915..b2e67f5f 100644 --- a/debian/control +++ b/debian/control @@ -74,8 +74,8 @@ Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian Package: alternc-squirrelmail Architecture: all -Pre-depends: debconf (>= 0.5.00) | debconf-2.0, alternc (>= 1.1) -Depends: debianutils (>= 1.13.1), squirrelmail, squirrelmail-locales, avelsieve +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: @@ -102,3 +102,34 @@ Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian automatique des profiles avec la bonne adresse et la bonne langue. . Pour plus d'informations, consultez http://www.alternc.com/ + +Package: alternc-roundcube +Architecture: all +Pre-depends: debconf (>= 0.5.00) | debconf-2.0 +Depends: debianutils (>= 1.13.1), alternc (>= 1.1), roundcube, roundcube-mysql, roundcube-plugins +Conflicts: alternc (<= 1.0.3) +Provides: alternc-webmail +Suggests: +Description: Roundcube-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 + Roundcube Webmail. It also configure sieve 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 Roundcube. + Il configure aussi sieve 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 c8b323d9..54c464ff 100755 --- a/debian/rules +++ b/debian/rules @@ -96,10 +96,8 @@ 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/ + # alternc-squirrelmail: + (cd squirrelmail && $(MAKE) install DESTDIR=$(CURDIR)/debian/alternc-squirrelmail) # 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 diff --git a/install/alternc.install b/install/alternc.install index 94dd5193..388f4cd7 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -27,7 +27,7 @@ # 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 +# argument will be : startup, templates, apache2, before-reload, end # Somes check before start operations if [ `id -u` -ne 0 ]; then @@ -243,8 +243,11 @@ rm -f $SED_SCRIPT php="`ls /usr/lib/apache*/*/*php*.so | sed -e 's/^.*libphp\(.\)\.so$/php\1/' | tail -1`" ln -fs /etc/alternc/alternc.ini /etc/$php/conf.d/alternc.ini || true if [ -x /usr/sbin/apache2 ]; then + # hook + run-parts --arg=apache2 /usr/lib/alternc/install.d + s="" - # unused from AlternC 1.1 + # unused from AlternC 1.1, FIXME: remove it later if [ -L /etc/apache2/mods-enabled/vhost_alias.load ] then a2dismod vhost_alias diff --git a/install/mysql.sql b/install/mysql.sql index b0c23924..e836715c 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -496,15 +496,14 @@ INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibil ('vhost','Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'ALL'), ('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt,defmx,defmx2', true, false, false, 'ALL'), ('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt,mx,mx2,defmx,defmx2', false, true, false, 'ALL'), -('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false, 'ALL'), -('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt,mx,mx2,defmx,defmx2',true, true, true , 'ALL'), +('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,txt,mx,mx2,defmx,defmx2',true, true, true , 'ALL'), ('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt,mx,mx2,defmx,defmx2',true, true, true , 'ALL'), -('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, true, true, 'ALL'), -('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true, 'ALL'), -('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true, 'ALL'), -('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@.', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx2',true, false, true, 'ADMIN'), -('defmx2', 'Default backup mail server', 'NONE', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@.', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx',true, false, true, 'ADMIN'), -('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, false, true, 'ALL') +('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, true, true, 'ALL'), +('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,ipv6,cname,txt,mx,mx2',true, false, true, 'ALL'), +('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,ipv6,cname,txt,mx,mx2',true, false, true, 'ALL'), +('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@.', 'vhost,url,ip,ipv6,cname,txt,defmx2',true, false, true, 'ADMIN'), +('defmx2', 'Default backup mail server', 'NONE', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@.', 'vhost,url,ip,ipv6,cname,txt,defmx',true, false, true, 'ADMIN'), +('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, false, true, 'ALL') ; diff --git a/install/upgrades/1.1.php b/install/upgrades/1.1.php new file mode 100644 index 00000000..fa152faf --- /dev/null +++ b/install/upgrades/1.1.php @@ -0,0 +1,21 @@ +#!/usr/bin/php +enabled=1; + +$db->query("SELECT * FROM sub_domaines WHERE type='webmail'"); +if ($db->num_rows()) { + echo "WARNING: You have webmail domain-types, you need to install alternc-squirrelmail or alternc-roundcube to be able to use them again. They will work but may break until you do that\n"; +} diff --git a/install/upgrades/1.1.sql b/install/upgrades/1.1.sql index c2b25e49..ed57c492 100644 --- a/install/upgrades/1.1.sql +++ b/install/upgrades/1.1.sql @@ -225,3 +225,7 @@ DROP TABLE stats2; -- With Dovecot, no more use of size_mail DROP TABLE size_mail; + +-- now that we have separate packages for the webmails, we can't serve webmail domainetype anymore +DELETE FROM domaines_type WHERE name='webmail'; +UPDATE domaines_type SET compatibility=REPLACE(compatibility,'webmail,',''); diff --git a/squirrelmail/Makefile b/squirrelmail/Makefile new file mode 100644 index 00000000..12098037 --- /dev/null +++ b/squirrelmail/Makefile @@ -0,0 +1,34 @@ +# ---------------------------------------------------------------------- +# 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 the files of alternc-squirrelmail packages +# ---------------------------------------------------------------------- + +install: + # alternc-squirrelmail files install + install -m 644 templates/squirrelmail/* $(DESTDIR)/etc/alternc/templates/squirrelmail/ + install -m 644 templates/javascript-common/* $(DESTDIR)/etc/alternc/templates/javascript-common/ + install -m 750 squirrelmail-install $(DESTDIR)/usr/lib/alternc/install.d/ + install -m 644 apache-panel.d/squirrelmail.conf $(DESTDIR)/etc/alternc/apache-panel.d/ + # default webmail vhost: squirrelmail.local, will be proxified from http://panel/squirrel/ + install -m 644 apache2.conf $(DESTDIR)/etc/apache2/conf.d/alternc-squirrelmail.conf + # domaintype template: + install -m 644 templates/apache2/squirrelmail.conf $(DESTDIR)/etc/alternc/templates/apache2/squirrelmail.conf + # empty folder for redirect to /squirrel location ... + install -m 644 redirect.php $(DESTDIR)/usr/share/alternc-squirrelmail/index.php diff --git a/squirrelmail/apache-panel.d/squirrelmail.conf b/squirrelmail/apache-panel.d/squirrelmail.conf index 01c58388..7b8a804c 100644 --- a/squirrelmail/apache-panel.d/squirrelmail.conf +++ b/squirrelmail/apache-panel.d/squirrelmail.conf @@ -1,4 +1,22 @@ -Alias /squirrel /usr/share/squirrelmail -Alias /javascript /usr/share/javascript + + ProxyPass http://squirrelmail.local/squirrel + ProxyPassReverse http://squirrelmail.local/squirrel + + + Alias /squirrel /usr/share/squirrelmail + + + php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/ + php_admin_flag safe_mode off + Options Indexes FollowSymLinks + + + Alias /javascript /usr/share/javascript/ + + + Options FollowSymLinks MultiViews + Order allow,deny + Allow from all + diff --git a/squirrelmail/apache2.conf b/squirrelmail/apache2.conf new file mode 100644 index 00000000..e760f114 --- /dev/null +++ b/squirrelmail/apache2.conf @@ -0,0 +1,23 @@ + + ServerName squirrelmail.local + AssignUserId alternc-squirrelmail nogroup + + # Due to the PROXY TRICK, We need squirrel to be available BOTH at / AND /squirrel ... + DocumentRoot /usr/share/squirrelmail/ + Alias /squirrel /usr/share/squirrelmail + + + php_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail/:/var/lib/squirrelmail/data/:/var/spool/squirrelmail/ + php_admin_flag safe_mode off + Options Indexes FollowSymLinks + + + Alias /javascript /usr/share/javascript/ + + + Options FollowSymLinks MultiViews + Order allow,deny + Allow from all + + + diff --git a/squirrelmail/redirect.php b/squirrelmail/redirect.php new file mode 100644 index 00000000..ab358c5d --- /dev/null +++ b/squirrelmail/redirect.php @@ -0,0 +1,4 @@ +>/etc/hosts +# fi fi +#if [ "$1" = "apache2" ] +#then +# echo "Installing Apache Proxy module for Squirrelmail ..." +# if ! [ -L /etc/apache2/mods-enabled/proxy.load ] +# then +# a2enmod proxy +# fi +# if ! [ -L /etc/apache2/mods-enabled/proxy_http.load ] +# then +# a2enmod proxy_http +# fi +# echo "Done" +#fi + diff --git a/etc/alternc/templates/apache2/webmail.conf b/squirrelmail/templates/apache2/squirrelmail.conf similarity index 61% rename from etc/alternc/templates/apache2/webmail.conf rename to squirrelmail/templates/apache2/squirrelmail.conf index 8f99e2ca..b64aa63b 100644 --- a/etc/alternc/templates/apache2/webmail.conf +++ b/squirrelmail/templates/apache2/squirrelmail.conf @@ -1,6 +1,6 @@ ServerName %%fqdn%% - AssignUserId www-data www-data + AssignUserId alternc-squirrelmail nogroup SetEnv LOGIN "%%UID%%-%%LOGIN%%" DocumentRoot /usr/share/squirrelmail @@ -10,4 +10,12 @@ Options Indexes FollowSymLinks + Alias /javascript /usr/share/javascript/ + + + Options FollowSymLinks MultiViews + Order allow,deny + Allow from all + + diff --git a/src/Makefile b/src/Makefile index 3b79dc7b..ffadfd17 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,12 +1,7 @@ -# -# $Id: Makefile,v 1.20 2005/05/21 16:07:32 arnaud-lb Exp $ # ---------------------------------------------------------------------- # AlternC - Web Hosting System -# Copyright (C) 2002 by the AlternC Development Team. -# http://alternc.org/ -# ---------------------------------------------------------------------- -# Based on: -# Valentin Lacambre's web hosting softwares: http://altern.org/ +# Copyright (C) 2000-2012 by the AlternC Development Team. +# https://alternc.org/ # ---------------------------------------------------------------------- # LICENSE # @@ -24,7 +19,6 @@ # ---------------------------------------------------------------------- # Purpose of file: Makefile des binaires de /usr/lib/alternc # ---------------------------------------------------------------------- -# SETUID=quota_edit quota_get mem_add mem_del du.pl SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh postfix-add-policy LIBS=functions.sh functions_hosting.sh functions_dns.sh