fixing most squirrelmail install script + alternc-changepass plugin
This commit is contained in:
parent
b8979c818d
commit
52072b919b
|
@ -21,8 +21,12 @@ case "$1" in
|
||||||
chown -R alternc-squirrelmail:root /var/spool/squirrelmail/attach /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
|
chmod -R 750 /var/spool/squirrelmail/attach /var/lib/squirrelmail/data
|
||||||
# Enable the squirrelmail plugin
|
# Enable the squirrelmail plugin
|
||||||
squirrelmail-configure --remove-plugin alternc-changepass
|
squirrelmail-configure --remove-plugin alternc_changepass
|
||||||
squirrelmail-configure --install-plugin alternc-changepass
|
squirrelmail-configure --install-plugin alternc_changepass
|
||||||
|
echo "**********************************************"
|
||||||
|
echo "* ALTERNC-SQUIRRELMAIL: *"
|
||||||
|
echo "* Please run alternc.install to fully deploy *"
|
||||||
|
echo "**********************************************"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
||||||
if (!defined("ALTERNC_LOC")) {
|
if (!defined("ALTERNC_CHANGEPASS_LOC")) {
|
||||||
echo "No AlternC-Changepass configuration, please setup alternc-changepass plugin in /etc/squirrelmail/";
|
error_log("No configuration for squirrelmail plugin at /etc/squirrelmail/alternc-changepass.conf, please check");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bindtextdomain("alternc-changepass", ALTERNC_LOC."/bureau/locales");
|
bindtextdomain("alternc-changepass", ALTERNC_CHANGEPASS_LOC."/bureau/locales");
|
||||||
|
|
||||||
$link=mysql_connect(
|
$link=mysql_connect(
|
||||||
ALTERNC_CHANGEPASS_MYSQL_HOST,
|
ALTERNC_CHANGEPASS_MYSQL_HOST,
|
||||||
|
@ -14,7 +14,7 @@ $link=mysql_connect(
|
||||||
ALTERNC_CHANGEPASS_MYSQL_PASSWORD
|
ALTERNC_CHANGEPASS_MYSQL_PASSWORD
|
||||||
);
|
);
|
||||||
if ($link) {
|
if ($link) {
|
||||||
mysql_select_db(ALTERNC_CHANGEPASS_MYSLQ_DB);
|
mysql_select_db(ALTERNC_CHANGEPASS_MYSQL_DB);
|
||||||
} else {
|
} else {
|
||||||
__("Can't connect to MySQL server on AlternC!");
|
__("Can't connect to MySQL server on AlternC!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
||||||
bindtextdomain("alternc-changepass", ALTERNC_LOC."/bureau/locales");
|
if (!defined("ALTERNC_CHANGEPASS_LOC")) {
|
||||||
|
error_log("No configuration for squirrelmail plugin at /etc/squirrelmail/alternc-changepass.conf, please check");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bindtextdomain("alternc-changepass", ALTERNC_CHANGEPASS_LOC."/bureau/locales");
|
||||||
|
|
||||||
function squirrelmail_plugin_init_alternc_changepass() {
|
function squirrelmail_plugin_init_alternc_changepass() {
|
||||||
global $squirrelmail_plugin_hooks;
|
global $squirrelmail_plugin_hooks;
|
||||||
|
|
|
@ -28,29 +28,45 @@ then
|
||||||
cp -f /etc/alternc/templates/squirrelmail/avelsieve-config.php /etc/alternc/templates/squirrelmail/apache.conf /etc/squirrelmail/
|
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/
|
cp -f /etc/alternc/templates/javascript-common/javascript-common.conf /etc/javascript-common/
|
||||||
if [ -e /etc/alternc/templates/squirrelmail/alternc-changepass.conf ]; then
|
if [ -e /etc/alternc/templates/squirrelmail/alternc-changepass.conf ]; then
|
||||||
CONFIG_FILES="$CONFIG_FILES squirrelmail/alternc-changepass.conf"
|
CONFIG_FILES="$CONFIG_FILES etc/squirrelmail/alternc-changepass.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOGIN="2000_squirrelmail"
|
LOGIN="2000_squirrel"
|
||||||
PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`"
|
PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`"
|
||||||
|
|
||||||
# Add new variables to the sed script ...
|
# Add new variables to the sed script ...
|
||||||
SED_SCRIPT="/tmp/alternc.install.sedscript"
|
SED_SCRIPT="/tmp/alternc-squirrelmail.sedscript"
|
||||||
cat >> $SED_SCRIPT <<EOF
|
# cf alternc.install for more explanations on this horror :
|
||||||
|
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf`
|
||||||
|
. /etc/alternc/local.sh
|
||||||
|
# Configuration template location
|
||||||
|
TEMPLATE_DIR="/etc/alternc/templates"
|
||||||
|
|
||||||
|
cat > $SED_SCRIPT <<EOF
|
||||||
|
s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\;
|
||||||
|
s\\%%dbhost%%\\$MYSQL_HOST\\;
|
||||||
|
s\\%%dbname%%\\$MYSQL_DATABASE\\;
|
||||||
s\\%%squirrelmail-login%%\\$LOGIN\\;
|
s\\%%squirrelmail-login%%\\$LOGIN\\;
|
||||||
s\\%%squirrelmail-password%%\\$PASSWORD\\;
|
s\\%%squirrelmail-password%%\\$PASSWORD\\;
|
||||||
EOF
|
EOF
|
||||||
|
for file in $CONFIG_FILES; do
|
||||||
|
TEMPLATE="$TEMPLATE_DIR/${file##etc/}"
|
||||||
|
echo -n " $file"
|
||||||
|
if [ -f "$TEMPLATE" ]; then
|
||||||
|
sed -f "$SED_SCRIPT" < $TEMPLATE > /$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm -f $SED_SCRIPT
|
||||||
|
|
||||||
echo " Done"
|
echo " Done"
|
||||||
|
|
||||||
. /usr/lib/alternc/functions.sh
|
. /usr/lib/alternc/functions.sh
|
||||||
|
|
||||||
echo "giving write access to squirrelmail to the email password ..."
|
echo "giving write access to squirrelmail to the email password ..."
|
||||||
# cf alternc.install for more explanations on this horror :
|
|
||||||
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf`
|
|
||||||
# now database host user and password are mysql root account values ;)
|
# now database host user and password are mysql root account values ;)
|
||||||
mysql_query "GRANT UPDATE (password) ON ${database}.address TO '$LOGIN'@'%' IDENTIFIED BY PASSWORD('$PASSWORD');"
|
mysql_query "GRANT UPDATE (password) ON ${database}.address TO '${LOGIN}'@'${MYSQL_CLIENT}' IDENTIFIED BY '${PASSWORD}';"
|
||||||
mysql_query "GRANT SELECT ON ${database}.address TO '$LOGIN'@'%';"
|
mysql_query "GRANT SELECT ON ${database}.address TO '${LOGIN}'@'${MYSQL_CLIENT}';"
|
||||||
mysql_query "GRANT SELECT ON ${database}.domaines TO '$LOGIN'@'%';"
|
mysql_query "GRANT SELECT ON ${database}.domaines TO '${LOGIN}'@'${MYSQL_CLIENT}';"
|
||||||
echo " Done"
|
echo " Done"
|
||||||
|
|
||||||
echo "Setting squirrelmail domaintype"
|
echo "Setting squirrelmail domaintype"
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
define("ALTERNC_CHANGEPASS_LOC","%%ALTERNC_LOC%%");
|
define("ALTERNC_CHANGEPASS_LOC","%%ALTERNC_LOC%%");
|
||||||
define("ALTERNC_CHANGEPASS_MYSQL_HOST","%%dbhost%%");
|
define("ALTERNC_CHANGEPASS_MYSQL_HOST","%%dbhost%%");
|
||||||
define("ALTERNC_CHANGEPASS_MYSQL_USER","%%squirrelmail-login%%"); // 2000_squirrelmail
|
define("ALTERNC_CHANGEPASS_MYSQL_USER","%%squirrelmail-login%%"); // 2000_squirrelmail
|
||||||
define("ALTERNC_CHANGEPASS_MYSQL_PASSWORD","%%squirrelmail-pass%%"); // een3ooCi
|
define("ALTERNC_CHANGEPASS_MYSQL_PASSWORD","%%squirrelmail-password%%"); // een3ooCi
|
||||||
define("ALTERNC_CHANGEPASS_MYSQL_DB","%%dbname%%");
|
define("ALTERNC_CHANGEPASS_MYSQL_DB","%%dbname%%");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue