Dev in progress
This commit is contained in:
parent
3417461db0
commit
f402a5fcc0
|
@ -26,6 +26,8 @@ MYSQL_HOST=127.0.0.1
|
||||||
MYSQL_DATABASE=alternc
|
MYSQL_DATABASE=alternc
|
||||||
MYSQL_USER=sysusr
|
MYSQL_USER=sysusr
|
||||||
MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `"
|
MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `"
|
||||||
|
MYSQL_MAIL_USER=alternc_mail_user
|
||||||
|
MYSQL_MAIL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `"
|
||||||
MYSQL_CLIENT=localhost
|
MYSQL_CLIENT=localhost
|
||||||
FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`"
|
FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`"
|
||||||
INTERNAL_IP="`env LANG=C /sbin/ifconfig|grep inet | grep -v 127.0.0.1| head -1 | cut -d: -f2 | sed -e 's/\([0-9\.]*\).*$/\1/' 2>/dev/null || hostname -f`"
|
INTERNAL_IP="`env LANG=C /sbin/ifconfig|grep inet | grep -v 127.0.0.1| head -1 | cut -d: -f2 | sed -e 's/\([0-9\.]*\).*$/\1/' 2>/dev/null || hostname -f`"
|
||||||
|
@ -53,6 +55,16 @@ if [ -r /etc/alternc/my.cnf ]; then
|
||||||
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`
|
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`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -r /etc/alternc/my_mail.cnf ]; then
|
||||||
|
# make mysql configuration available as shell variables
|
||||||
|
# to convert from .cnf to shell syntax, we:
|
||||||
|
# * match only lines with "equal" in them (/=/)
|
||||||
|
# * remove whitespace around the = and add a left quote operator ' (;s)
|
||||||
|
# * add a right quote operator at the end of line (;s)
|
||||||
|
# * convert mysql variables into our MYSQL_ naming convention (;s)
|
||||||
|
# * print the result (;p)
|
||||||
|
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_MAIL_USER/;s/password/MYSQL_MAIL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my_mail.cnf`
|
||||||
|
fi
|
||||||
|
|
||||||
# mettre les valeurs de local.sh comme "default" pour debconf
|
# mettre les valeurs de local.sh comme "default" pour debconf
|
||||||
db_get alternc/hostingname
|
db_get alternc/hostingname
|
||||||
|
@ -157,6 +169,15 @@ if [ -z "$RET" ]
|
||||||
db_set alternc/alternc_location "$ALTERNC_LOC"
|
db_set alternc/alternc_location "$ALTERNC_LOC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$RET" ]
|
||||||
|
then
|
||||||
|
db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$RET" ]
|
||||||
|
then
|
||||||
|
db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS"
|
||||||
|
fi
|
||||||
db_input medium alternc/desktopname || true
|
db_input medium alternc/desktopname || true
|
||||||
db_input medium alternc/hostingname || true
|
db_input medium alternc/hostingname || true
|
||||||
db_input medium alternc/internal_ip || true
|
db_input medium alternc/internal_ip || true
|
||||||
|
@ -170,6 +191,8 @@ db_input low alternc/mysql/host || true
|
||||||
db_input low alternc/mysql/db || true
|
db_input low alternc/mysql/db || true
|
||||||
db_input low alternc/mysql/user || true
|
db_input low alternc/mysql/user || true
|
||||||
db_input low alternc/mysql/password || true
|
db_input low alternc/mysql/password || true
|
||||||
|
db_input low alternc/mysql/alternc_mail_password || true
|
||||||
|
db_input low alternc/mysql/alternc_mail_user || true
|
||||||
db_input low alternc/mysql/client || true
|
db_input low alternc/mysql/client || true
|
||||||
db_input low alternc/sql/backup_type || true
|
db_input low alternc/sql/backup_type || true
|
||||||
db_input low alternc/sql/overwrite || true
|
db_input low alternc/sql/overwrite || true
|
||||||
|
|
|
@ -231,7 +231,8 @@ EOF
|
||||||
chmod 0440 /etc/sudoers.d/alternc-sudoers
|
chmod 0440 /etc/sudoers.d/alternc-sudoers
|
||||||
else
|
else
|
||||||
echo "running an older version of sudo"
|
echo "running an older version of sudo"
|
||||||
echo "copy content of /usr/share/doc/aegir-provision/examples/example.sudoers into /etc/sudoers for aegir to run properly"
|
#FIXME
|
||||||
|
echo "copy content of /usr/share/doc/examples/example.sudoers into /etc/sudoers.d for to run properly"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# important: postinst gele sans ca
|
# important: postinst gele sans ca
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
alternc (1.1+nmu2) stable; urgency=low
|
alternc (1.1+nmu2) stable; urgency=low
|
||||||
|
|
||||||
* Templating of dovecot and postfix
|
* Templating of dovecot and postfix
|
||||||
adding a view for dovecot usage (dovecot_view)
|
adding a view for dovecot usage (dovecot_view)
|
||||||
adding of user vmail dedicated to the mail system
|
adding of user vmail dedicated to the mail system
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
|
|
||||||
-- Squidly <squidly@nnx.com> Sat, 03 Mar 2012 13:09:06 +0100
|
-- Squidly <squidly@nnx.com> Sat, 03 Mar 2012 13:09:06 +0100
|
||||||
|
@ -30,7 +30,7 @@ alternc (1.0.3) stable; urgency=high
|
||||||
|
|
||||||
alternc (1.0.2) stable; urgency=high
|
alternc (1.0.2) stable; urgency=high
|
||||||
* Bugfix : dependency on gamin OR fam : gamin is better for courier-imap
|
* Bugfix : dependency on gamin OR fam : gamin is better for courier-imap
|
||||||
and fam makes sasl imap auth fail
|
and fam makes sasl imap auth fail
|
||||||
* Bugfix : adding french messages for domain new error messages
|
* Bugfix : adding french messages for domain new error messages
|
||||||
* Bugfix : Fixing domaines types templates issues (incompatibility with pre 1.0 alternc)
|
* Bugfix : Fixing domaines types templates issues (incompatibility with pre 1.0 alternc)
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# %%warning_message%%
|
# %%warning_message%%
|
||||||
#
|
#
|
||||||
|
|
||||||
user = %%dbuser%%
|
user = %%db_mail_user%%
|
||||||
password = %%dbpwd%%
|
password = %%db_mail_pwd%%
|
||||||
hosts =%%dbhost%%
|
hosts =%%dbhost%%
|
||||||
dbname = %%dbname%%
|
dbname = %%dbname%%
|
||||||
query = select concat( if(isnull(mailbox.id), '', concat(concat(address.address,'@',domaines.domaine), '\n')), recipient.recipients ) from recipient join address on address.id = re
|
query = select concat( if(isnull(mailbox.id), '', concat(concat(address.address,'@',domaines.domaine), '\n')), recipient.recipients ) from recipient join address on address.id = re
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# %%warning_message%%
|
# %%warning_message%%
|
||||||
#
|
#
|
||||||
|
|
||||||
user = %%dbuser%%
|
user = %%db_mail_user%%
|
||||||
password = %%dbpwd%%
|
password = %%db_mail_pwd%%
|
||||||
hosts =%%dbhost%%
|
hosts =%%dbhost%%
|
||||||
dbname = %%dbname%%
|
dbname = %%dbname%%
|
||||||
query = select domaines.domaine from domaines where domaine='%s' and gesmx=1;
|
query = select domaines.domaine from domaines where domaine='%s' and gesmx=1;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# %%warning_message%%
|
# %%warning_message%%
|
||||||
#
|
#
|
||||||
|
|
||||||
user = %%dbuser%%
|
user = %%db_mail_user%%
|
||||||
password = %%dbpwd%%
|
password = %%db_mail_pwd%%
|
||||||
hosts =%%dbhost%%
|
hosts =%%dbhost%%
|
||||||
dbname = %%dbname%%
|
dbname = %%dbname%%
|
||||||
query = select compte from domaines join address on address.domain_id = domaines.id join mailbox on mailbox.address_id = address.id where address.address='%s'
|
query = select compte from domaines join address on address.domain_id = domaines.id join mailbox on mailbox.address_id = address.id where address.address='%s'
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# %%warning_message%%
|
# %%warning_message%%
|
||||||
#
|
#
|
||||||
|
|
||||||
user = %%dbuser%%
|
user = %%db_mail_user%%
|
||||||
password = %%dbpwd%%
|
password = %%db_mail_pwd%%
|
||||||
hosts =%%dbhost%%
|
hosts =%%dbhost%%
|
||||||
dbname = %%dbname%%
|
dbname = %%dbname%%
|
||||||
table = mail_domain
|
table = mail_domain
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# %%warning_message%%
|
# %%warning_message%%
|
||||||
#
|
#
|
||||||
|
|
||||||
user = %%dbuser%%
|
user = %%db_mail_user%%
|
||||||
password = %%dbpwd%%
|
password = %%db_mail_pwd%%
|
||||||
hosts =%%dbhost%%
|
hosts =%%dbhost%%
|
||||||
dbname = %%dbname%%
|
dbname = %%dbname%%
|
||||||
query = select concat(path, '/Maildir/') from mailbox join address on address.id = mailbox.address_id join domaines on domaines.id = address.domain_id where concat(address.address,
|
query = select concat(path, '/Maildir/') from mailbox join address on address.id = mailbox.address_id join domaines on domaines.id = address.domain_id where concat(address.address,
|
||||||
|
|
|
@ -110,6 +110,19 @@ if [ -r /etc/alternc/my.cnf ]; then
|
||||||
chmod 640 /etc/alternc/my.cnf
|
chmod 640 /etc/alternc/my.cnf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -r /etc/alternc/my_mail.cnf ]; then
|
||||||
|
# make mysql configuration available as shell variables
|
||||||
|
# to convert from .cnf to shell syntax, we:
|
||||||
|
# * match only lines with "equal" in them (/=/)
|
||||||
|
# * remove whitespace around the = and add a left quote operator ' (;s)
|
||||||
|
# * add a right quote operator at the end of line (;s)
|
||||||
|
# * convert mysql variables into our MYSQL_ naming convention (;s)
|
||||||
|
# * print the result (;p)
|
||||||
|
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`
|
||||||
|
chown root:alterncpanel /etc/alternc/my_mail.cnf
|
||||||
|
chmod 640 /etc/alternc/my_mail.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
WARNING="WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again."
|
WARNING="WARNING: Do not edit this file, edit the one in /etc/alternc/templates and launch alternc.install again."
|
||||||
|
|
||||||
VERSION="`dpkg -s alternc | sed -n -e 's/^Version: \(.*\)/\1/p'`"
|
VERSION="`dpkg -s alternc | sed -n -e 's/^Version: \(.*\)/\1/p'`"
|
||||||
|
@ -148,6 +161,8 @@ s\\%%dbhost%%\\$MYSQL_HOST\\;
|
||||||
s\\%%dbname%%\\$MYSQL_DATABASE\\;
|
s\\%%dbname%%\\$MYSQL_DATABASE\\;
|
||||||
s\\%%dbuser%%\\$MYSQL_USER\\;
|
s\\%%dbuser%%\\$MYSQL_USER\\;
|
||||||
s\\%%dbpwd%%\\$MYSQL_PASS\\;
|
s\\%%dbpwd%%\\$MYSQL_PASS\\;
|
||||||
|
s\\%%db_mail_user%%\\$MYSQL_MAIL_USER\\;
|
||||||
|
s\\%%db_mail_pwd%%\\$MYSQL_MAIL_PASS\\;
|
||||||
s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\;
|
s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\;
|
||||||
s\\%%warning_message%%\\$WARNING\\;
|
s\\%%warning_message%%\\$WARNING\\;
|
||||||
s\\%%fqdn_lettre%%\\$FQDN_LETTER\\;
|
s\\%%fqdn_lettre%%\\$FQDN_LETTER\\;
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
# * user
|
# * user
|
||||||
# * password
|
# * password
|
||||||
# * database
|
# * database
|
||||||
|
# * mail_user
|
||||||
|
# * mail_password
|
||||||
# * MYSQL_CLIENT
|
# * MYSQL_CLIENT
|
||||||
#
|
#
|
||||||
# XXX: the sed script should be generated here
|
# XXX: the sed script should be generated here
|
||||||
|
@ -47,12 +49,13 @@
|
||||||
echo "Granting users..."
|
echo "Granting users..."
|
||||||
|
|
||||||
MYSQL_CONFIG="/etc/alternc/my.cnf"
|
MYSQL_CONFIG="/etc/alternc/my.cnf"
|
||||||
|
MYSQL_MAIL_CONFIG="/etc/alternc/my_mail.cnf"
|
||||||
|
|
||||||
. /etc/alternc/local.sh
|
. /etc/alternc/local.sh
|
||||||
# the purpose of this "grant" is to make sure that the generated my.cnf works
|
# the purpose of this "grant" is to make sure that the generated my.cnf works
|
||||||
# this means (a) creating the user and (b) creating the database
|
# this means (a) creating the user and (b) creating the database
|
||||||
grant="GRANT ALL ON *.* TO '$user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$password' WITH GRANT OPTION;
|
grant="GRANT ALL ON *.* TO '$user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$password' WITH GRANT OPTION;
|
||||||
CREATE DATABASE IF NOT EXISTS $database;"
|
CREATE DATABASE IF NOT EXISTS $database;GRANT ALL ON '$database'.dovecot_view TO '$mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$mail_password'; "
|
||||||
|
|
||||||
echo -n "Trying debian.cnf: "
|
echo -n "Trying debian.cnf: "
|
||||||
mysql="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
mysql="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
||||||
|
@ -110,11 +113,29 @@ EOF
|
||||||
chmod 640 $MYSQL_CONFIG
|
chmod 640 $MYSQL_CONFIG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f $MYSQL_MAIL_CONFIG ]; then
|
||||||
|
echo "Updating mysql configuration in $MYSQL_MAIL_CONFIG"
|
||||||
|
else
|
||||||
|
echo "Creating mysql configuration in $MYSQL_MAIL_CONFIG"
|
||||||
|
cat > $MYSQL_MAIL_CONFIG <<EOF
|
||||||
|
# AlternC - Web Hosting System - MySQL mail user Configuration
|
||||||
|
# Automatically generated by AlternC configuration, do not edit
|
||||||
|
# This file will be modified on package configuration
|
||||||
|
# (e.g. upgrade or dpkg-reconfigure alternc)
|
||||||
|
[mysql]
|
||||||
|
database=
|
||||||
|
|
||||||
|
[client]
|
||||||
|
EOF
|
||||||
|
chown root:www-data $MYSQL_MAIL_CONFIG
|
||||||
|
chmod 640 $MYSQL_MAIL_CONFIG
|
||||||
|
fi
|
||||||
# create a sed script to create/update the file
|
# create a sed script to create/update the file
|
||||||
set_value() {
|
set_value() {
|
||||||
var=$1
|
var=$1
|
||||||
RET=$2
|
RET=$2
|
||||||
grep -Eq "^ *$var=" $MYSQL_CONFIG || echo "$var=" >> $MYSQL_CONFIG
|
file=$3
|
||||||
|
grep -Eq "^ *$var=" $file || echo "$var=" >> $file
|
||||||
SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\"
|
SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,10 +144,19 @@ SED_SCRIPT=""
|
||||||
if [ -z "$host" ]; then
|
if [ -z "$host" ]; then
|
||||||
host="localhost"
|
host="localhost"
|
||||||
fi
|
fi
|
||||||
set_value host $host
|
#filling the config file for the sysusr
|
||||||
set_value database $database
|
set_value host $host $MYSQL_CONFIG
|
||||||
set_value user $user
|
set_value database $database $MYSQL_CONFIG
|
||||||
set_value password $password
|
set_value user $user $MYSQL_CONFIG
|
||||||
|
set_value password $password $MYSQL_CONFIG
|
||||||
|
|
||||||
|
|
||||||
|
#filling the config file for the mailuser
|
||||||
|
set_value host $host $MYSQL_MAIL_CONFIG
|
||||||
|
set_value database $database $MYSQL_MAIL_CONFIG
|
||||||
|
set_value user $mail_user $MYSQL_MAIL_CONFIG
|
||||||
|
set_value password $mail_password $MYSQL_MAIL_CONFIG
|
||||||
|
|
||||||
|
|
||||||
# take extra precautions here with the mysql password:
|
# take extra precautions here with the mysql password:
|
||||||
# put the sed script in a temporary file
|
# put the sed script in a temporary file
|
||||||
|
@ -140,9 +170,11 @@ rm -f $SED_SCRIPT_NAME
|
||||||
|
|
||||||
# Now we should be able to use the mysql configuration
|
# Now we should be able to use the mysql configuration
|
||||||
mysql="/usr/bin/mysql --defaults-file=$MYSQL_CONFIG"
|
mysql="/usr/bin/mysql --defaults-file=$MYSQL_CONFIG"
|
||||||
|
mysql_mail="/usr/bin/mysql --defaults-file=$MYSQL_MAIL_CONFIG"
|
||||||
|
|
||||||
echo "Checking for MySQL connectivity"
|
echo "Checking for MySQL connectivity"
|
||||||
$mysql -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED!"
|
$mysql -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database user setup failed"
|
||||||
|
$mysql_mail -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database mail user setup failed"
|
||||||
|
|
||||||
# Final mysql setup: db schema
|
# Final mysql setup: db schema
|
||||||
echo "installing AlternC schema in $database..."
|
echo "installing AlternC schema in $database..."
|
||||||
|
|
Loading…
Reference in New Issue