Changeset 3142
- Timestamp:
- 04/24/12 17:51:47 (13 months ago)
- Location:
- alternc/trunk
- Files:
-
- 3 added
- 15 edited
-
debian/alternc.config (modified) (4 diffs)
-
debian/alternc.postinst (modified) (2 diffs)
-
debian/alternc.postrm (modified) (1 diff)
-
debian/alternc.preinst (modified) (1 diff)
-
debian/templates (modified) (1 diff)
-
etc/alternc/postfix.cf (modified) (2 diffs)
-
etc/alternc/templates/dovecot/dovecot-sql.conf (modified) (2 diffs)
-
etc/alternc/templates/dovecot/dovecot.conf (modified) (8 diffs)
-
etc/alternc/templates/postfix/master.cf (added)
-
etc/alternc/templates/postfix/myalias.cf (modified) (1 diff)
-
etc/alternc/templates/postfix/mydomain.cf (modified) (1 diff)
-
etc/alternc/templates/postfix/mygid.cf (modified) (1 diff)
-
etc/alternc/templates/postfix/myquota.cf (added)
-
etc/alternc/templates/postfix/myvirtual.cf (modified) (1 diff)
-
install/alternc.install (modified) (4 diffs)
-
install/mysql.sh (modified) (7 diffs)
-
install/mysql.sql (modified) (7 diffs)
-
tools/postfix-add-policy (added)
Legend:
- Unmodified
- Added
- Removed
-
alternc/trunk/debian/alternc.config
r3139 r3142 2 2 3 3 set -e 4 5 4 # Source debconf library. 6 5 . /usr/share/debconf/confmodule … … 27 26 MYSQL_USER=sysusr 28 27 MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `" 29 MYSQL_MAIL_USER=alternc_ mail_user28 MYSQL_MAIL_USER=alternc_user 30 29 MYSQL_MAIL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `" 31 30 MYSQL_CLIENT=localhost … … 170 169 fi 171 170 171 db_get alternc/mysql/alternc_mail_user 172 172 if [ -z "$RET" ] 173 173 then … … 175 175 fi 176 176 177 db_get alternc/mysql/alternc_mail_password 177 178 if [ -z "$RET" ] 178 179 then -
alternc/trunk/debian/alternc.postinst
r3139 r3142 46 46 mkdir -p /var/spool/postfix/var/run/saslauthd || true 47 47 dpkg-statoverride --quiet --update --add root sasl 710 /var/spool/postfix/var/run/saslauthd || true 48 49 50 #Create Dovecot user for mail handling FIXME change home with ALTERNC_LOC 51 if ! getent group vmail; then 52 addgroup --gid 1998 vmail 53 fi 54 if ! getent passwd vmail; then 55 adduser -g vmail -u 1998 vmail -d /var/alternc/mail -m 56 fi 57 chown -R vmail:vmail /var/alternc/mail 58 chmod u+w /var/alternc/mail 59 48 60 49 61 # build local.sh if it does not exist … … 145 157 db_get "alternc/mysql/password" 146 158 password="$RET" 147 159 db_get "alternc/mysql/alternc_mail_user" 160 alternc_mail_user="$RET" 161 db_get "alternc/mysql/alternc_mail_password" 162 alternc_mail_password="$RET" 163 148 164 # we source (instead of forking) mysql.sh so that it gets the local environment above 149 165 . /usr/share/alternc/install/mysql.sh -
alternc/trunk/debian/alternc.postrm
r2559 r3142 16 16 case "$1" in 17 17 purge) 18 rm -f /etc/alternc/local.sh /etc/alternc/my .cnf /etc/alternc/bureau.conf18 rm -f /etc/alternc/local.sh /etc/alternc/my_mail.cnf /etc/alternc/my.cnf /etc/alternc/bureau.conf 19 19 rm -f /var/backups/alternc/etc-installed.tar.gz 20 20 -
alternc/trunk/debian/alternc.preinst
r3137 r3142 6 6 7 7 # Create AlternC Panel user for web server 8 if ! getent group alterncpanel ; then8 if ! getent group alterncpanel; then 9 9 addgroup --system --gid 1999 alterncpanel 10 10 fi 11 if ! getent passwd alterncpanel ; then11 if ! getent passwd alterncpanel; then 12 12 adduser --system --home "/etc/alternc/.alterncpanel" \ 13 13 --disabled-password --uid 1999 --ingroup alterncpanel alterncpanel -
alternc/trunk/debian/templates
r2997 r3142 93 93 the system database !!! 94 94 95 96 Template: alternc/mysql/alternc_mail_user 97 Type: string 98 _Description: AlternC's mysql account: 99 AlternC will create a mysql administrator account. Please choose it's 100 username here. The default value should be good in most case. 101 102 Template: alternc/mysql/alternc_mail_password 103 Type: password 104 _Description: Password of the AlternC's mysql account: 105 AlternC requires an administrator account on the mysql server. It will be 106 created automatically during the install process. Please choose a password 107 for this account. 108 95 109 Template: alternc/mysql/client 96 110 Type: string -
alternc/trunk/etc/alternc/postfix.cf
r3003 r3142 1 # Used by alternc.install with postconf 1 2 home_mailbox = Maildir/ 2 3 smtpd_banner = $myhostname ESMTP … … 27 28 alias_database = hash:/etc/aliases 28 29 virtual_alias_maps = proxy:mysql:/etc/postfix/myalias.cf 29 virtual_alias_domains = 30 virtual_alias_domains = 30 31 virtual_mailbox_domains = proxy:mysql:/etc/postfix/mydomain.cf 31 32 virtual_mailbox_maps = proxy:mysql:/etc/postfix/myvirtual.cf 33 virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/myquota.cf 32 34 virtual_mailbox_base = /var/alternc/mail 33 35 virtual_minimum_uid = 2000 34 36 virtual_gid_maps = proxy:mysql:/etc/postfix/mygid.cf 35 37 virtual_uid_maps = proxy:mysql:/etc/postfix/mygid.cf 38 virtual_transport = dovecot 39 dovecot_destination_recipient_limit = 1 36 40 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_rbl_client zen.spamhaus.org, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_unlisted_recipient, reject_unauth_destination -
alternc/trunk/etc/alternc/templates/dovecot/dovecot-sql.conf
r3137 r3142 61 61 # connect = /etc/dovecot/authdb.sqlite 62 62 # 63 connect = host=%%dbhost%% dbname=%%dbname%% user=%%db user%% password=%%dbpwd%%63 connect = host=%%dbhost%% dbname=%%dbname%% user=%%db_mail_user%% password=%%db_mail_pwd%% 64 64 65 65 # Default password scheme. … … 68 68 # http://wiki.dovecot.org/Authentication/PasswordSchemes 69 69 # 70 default_pass_scheme = MD570 default_pass_scheme = PLAIN-MD5 71 71 72 72 # passdb query to retrieve the password. It can return fields: -
alternc/trunk/etc/alternc/templates/dovecot/dovecot.conf
r3137 r3142 23 23 # If you only want to use dovecot-auth, you can set this to "none". 24 24 protocols = imap imaps pop3 pop3s managesieve 25 #protocols = none 25 protocols = imap imaps 26 26 27 27 # A space separated list of IP or host addresses where to listen in for … … 45 45 # .. 46 46 # } 47 #listen = *47 listen = * 48 48 49 49 # Disable LOGIN command and all other plaintext authentications unless … … 230 230 # </usr/share/doc/dovecot-common/wiki/MailLocation.txt> 231 231 # 232 mail_location = maildir:~/Maildir 232 mail_location = maildir:~/Maildir 233 233 234 234 # If you need to set multiple mailbox locations or want to change default … … 700 700 # list of plugins to load. 701 701 #mail_plugins = 702 mail_plugins = quota 702 mail_plugins = quota 703 703 #mail_plugin_dir = /usr/lib/dovecot/modules/pop3 704 704 … … 756 756 protocol lda { 757 757 # Address to use when sending rejection mails (e.g. postmaster@example.com). 758 postmaster_address = postmaster@l autre.net758 postmaster_address = postmaster@localhost 759 759 760 760 # Hostname to use in various parts of sent mails, eg. in Message-Id. … … 1128 1128 # can find mailbox locations. 1129 1129 path = /var/run/dovecot/auth-master 1130 mode = 06 661130 mode = 0600 1131 1131 # Default user/group is the one who started dovecot-auth (root) 1132 user = vmail 1132 user = vmail 1133 1133 #group = 1134 1134 } … … 1169 1169 1170 1170 dict { 1171 quota = mysql:/etc/dovecot/dovecot-dict-quota.conf1171 quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf 1172 1172 #expire = db:/var/lib/dovecot/expire.db 1173 1173 } … … 1217 1217 quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80 1218 1218 #quota = maildir 1219 quota = dict:user: proxy::quotadict1219 quota = dict:user::proxy::quotadict 1220 1220 1221 1221 # ACL plugin. vfile backend reads ACLs from "dovecot-acl" file from maildir -
alternc/trunk/etc/alternc/templates/postfix/myalias.cf
r3139 r3142 7 7 hosts =%%dbhost%% 8 8 dbname = %%dbname%% 9 query = select concat( if(isnull(mailbox.id), '', concat(concat(address.address,'@',domaines.domaine), '\n')), recipient.recipients ) from recipient join address on address.id = re 10 cipient.address_id left outer join mailbox on mailbox.address_id = address.id join domaines on domaines.id = address.domain_id where concat(address.address,'@',domaines.domaine)='% 11 s'; 9 query = select concat( if(isnull(mailbox.id), '', concat(concat(address.address,'@',domaines.domaine), '\n')), recipient.recipients ) from recipient join address on address.id = recipient.address_id left outer join mailbox on mailbox.address_id = address.id join domaines on domaines.id = address.domain_id where concat(address.address,'@',domaines.domaine)='%s'; 12 10 13 11 -
alternc/trunk/etc/alternc/templates/postfix/mydomain.cf
r3139 r3142 7 7 hosts =%%dbhost%% 8 8 dbname = %%dbname%% 9 query = select domaines.domaine from domaines where domaine='%s' and gesmx=1;9 query = select domaines.domaine from domaines join address on address.id=domaines.id where concat(address.address,'@',domaines.domaine)='%s' and gesmx=1; 10 10 -
alternc/trunk/etc/alternc/templates/postfix/mygid.cf
r3139 r3142 7 7 hosts =%%dbhost%% 8 8 dbname = %%dbname%% 9 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'9 query = select compte from domaines join address on address.domain_id = domaines.id join mailbox on mailbox.address_id = address.id where concat(address.address,'@',domaines.domaine)='%s' 10 10 -
alternc/trunk/etc/alternc/templates/postfix/myvirtual.cf
r3139 r3142 7 7 hosts =%%dbhost%% 8 8 dbname = %%dbname%% 9 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, 10 '@',domaines.domaine) ='%s'; 9 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,'@',domaines.domaine) ='%s'; 11 10 -
alternc/trunk/install/alternc.install
r3139 r3142 119 119 # * convert mysql variables into our MYSQL_ naming convention (;s) 120 120 # * print the result (;p) 121 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`121 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` 122 122 chown root:alterncpanel /etc/alternc/my_mail.cnf 123 123 chmod 640 /etc/alternc/my_mail.cnf … … 281 281 fi 282 282 283 # configure postfix appropriatly for our needs283 # configure Postfix appropriatly for our needs 284 284 if [ "$slave" = "1" ]; then 285 285 postfix_conf=/etc/alternc/postfix-slave.cf … … 287 287 postfix_conf=/etc/alternc/postfix.cf 288 288 fi 289 while read line 290 do 289 while read line ; do 291 290 postconf -e "$line" 292 done < $postfix_conf 291 done < "$postfix_conf" 292 293 # Conviguring delivery used bu Postfix FIXME change script name 294 echo `/usr/bin/postfix-add-policy2 dovecot pipe DRhu vmail:vmail '/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} '` 293 295 294 296 # Bug #1215: configure mydestination when $FQDN is not in … … 367 369 fi 368 370 371 #giving vmail user read access on dovecot sql file 372 chgrp vmail /etc/dovecot/dovecot.conf 373 chmod g+r /etc/dovecot/dovecot.conf 374 369 375 # Changing owner of web panel's files 370 376 chown -R alterncpanel:alterncpanel "$ALTERNC_LOC/bureau" -
alternc/trunk/install/mysql.sh
r3139 r3142 35 35 # * password 36 36 # * database 37 # * mail_user38 # * mail_password37 # * alternc_mail_user 38 # * alternc_mail_password 39 39 # * MYSQL_CLIENT 40 40 # … … 56 56 # this means (a) creating the user and (b) creating the database 57 57 grant="GRANT ALL ON *.* TO '$user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$password' WITH GRANT OPTION; 58 CREATE DATABASE IF NOT EXISTS $database;GRANT ALL ON '$database'.dovecot_view TO '$mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$mail_password'; " 58 CREATE DATABASE IF NOT EXISTS $database; " 59 grant_mail="GRANT ALL ON $database.dovecot_view TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';" 60 grant_mail=$grant_mail"GRANT SELECT ON $database.* TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';" 59 61 60 62 echo -n "Trying debian.cnf: " … … 137 139 file=$3 138 140 grep -Eq "^ *$var=" $file || echo "$var=" >> $file 139 SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\" 141 if [ $file = $MYSQL_CONFIG ]; then 142 SED_SCRIPT_USR="$SED_SCRIPT_USR;s\\^ *$var=.*\\$var=\"$RET\"\\" 143 else 144 SED_SCRIPT_MAIL="$SED_SCRIPT_MAIL;s\\^ *$var=.*\\$var=\"$RET\"\\" 145 fi 140 146 } 141 147 142 SED_SCRIPT="" 148 SED_SCRIPT_USR="" 149 SED_SCRIPT_MAIL="" 143 150 # hostname was empty in older (pre-0.9.6?) versions 144 151 if [ -z "$host" ]; then … … 155 162 set_value host $host $MYSQL_MAIL_CONFIG 156 163 set_value database $database $MYSQL_MAIL_CONFIG 157 set_value user $mail_user $MYSQL_MAIL_CONFIG 158 set_value password $mail_password $MYSQL_MAIL_CONFIG 159 164 set_value user $alternc_mail_user $MYSQL_MAIL_CONFIG 165 set_value password $alternc_mail_password $MYSQL_MAIL_CONFIG 166 167 echo $SED_SCRIPT_MAIL 168 echo XXXXXX 169 echo $SED_SCRIPT_USR 160 170 161 171 # take extra precautions here with the mysql password: … … 163 173 SED_SCRIPT_NAME=`mktemp` 164 174 cat > $SED_SCRIPT_NAME <<EOF 165 $SED_SCRIPT 175 $SED_SCRIPT_USR 166 176 EOF 167 177 sed -f "$SED_SCRIPT_NAME" < $MYSQL_CONFIG > $MYSQL_CONFIG.$$ … … 169 179 rm -f $SED_SCRIPT_NAME 170 180 181 SED_SCRIPT_NAME_MAIL=`mktemp` 182 cat > $SED_SCRIPT_NAME_MAIL <<EOF 183 $SED_SCRIPT_MAIL 184 EOF 185 sed -f "$SED_SCRIPT_NAME_MAIL" < $MYSQL_MAIL_CONFIG > $MYSQL_MAIL_CONFIG.$$ 186 mv -f $MYSQL_MAIL_CONFIG.$$ $MYSQL_MAIL_CONFIG 187 rm -f $SED_SCRIPT_NAME_MAIL 188 171 189 # Now we should be able to use the mysql configuration 172 190 mysql="/usr/bin/mysql --defaults-file=$MYSQL_CONFIG" … … 175 193 echo "Checking for MySQL connectivity" 176 194 $mysql -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database user setup failed" 177 $mysql_mail -e "SHOW TABLES" >/dev/null && echo "MYSQL.SH OK!" || echo "MYSQL.SH FAILED: database mail user setup failed" 178 195 echo $grant_mail 179 196 # Final mysql setup: db schema 180 197 echo "installing AlternC schema in $database..." 181 198 $mysql < /usr/share/alternc/install/mysql.sql || echo cannot load database schema 182 199 $mysql <<EOF 200 $grant_mail 201 EOF -
alternc/trunk/install/mysql.sql
r3138 r3142 237 237 -- Addresses for domain. 238 238 239 CREATE TABLE `address` (239 CREATE TABLE IF NOT EXISTS `address` ( 240 240 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id. 241 241 `domain_id` bigint(20) unsigned NOT NULL REFERENCES `domaines`(`id`), -- FK to sub_domains. … … 255 255 -- Local delivered mailboxes. 256 256 257 CREATE TABLE `mailbox` (257 CREATE TABLE IF NOT EXISTS `mailbox` ( 258 258 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id. 259 259 `address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address. … … 273 273 -- Other recipients for an address (aliases) 274 274 275 CREATE TABLE `recipient` (275 CREATE TABLE IF NOT EXISTS `recipient` ( 276 276 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id. 277 277 `address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address … … 287 287 -- Table containing mailman addresses 288 288 289 CREATE TABLE `mailman` (289 CREATE TABLE IF NOT EXISTS `mailman` ( 290 290 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id. 291 291 `address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address … … 546 546 -- Add function who are not in mysql 5 to be able ton convert ipv6 to decimal (and reverse it) 547 547 DELIMITER // 548 DROP FUNCTION IF EXISTS INET_ATON6;// 548 549 CREATE FUNCTION INET_ATON6(n CHAR(39)) 549 550 RETURNS DECIMAL(39) UNSIGNED … … 570 571 DELIMITER ; 571 572 DELIMITER // 573 DROP FUNCTION IF EXISTS INET_NTOA6;// 572 574 CREATE FUNCTION INET_NTOA6(n DECIMAL(39) UNSIGNED) 573 575 RETURNS CHAR(39) … … 648 650 -- 649 651 650 CREATE VIEW `dovecot_view` AS652 CREATE OR REPLACE VIEW `dovecot_view` AS 651 653 SELECT concat(`address`.`address`,'@',`domaines`.`domaine`) AS `user`, 652 654 concat('*:storage=',cast(`mailbox`.`quota` as char charset latin1),'M') AS `userdb_quota_rule`,
Note: See TracChangeset
for help on using the changeset viewer.
