modifying vhost template creation to add the membre mail address to the template for sendmail to use it as the return path for mail sent via php

This commit is contained in:
Steven Mondji-Lerider 2012-10-15 09:07:00 +00:00
parent 1fdf90d5de
commit 8c090ab9e1
4 changed files with 10 additions and 8 deletions

View File

@ -7,7 +7,7 @@
<Directory "%%document_root%%"> <Directory "%%document_root%%">
php_admin_value open_basedir "%%account_root%%:/usr/share/php/" php_admin_value open_basedir "%%account_root%%:/usr/share/php/"
php_admin_value upload_tmp_dir %%document_root%%/tmp php_admin_value upload_tmp_dir %%document_root%%/tmp
php_admin_value sendmail_path '/usr/lib/alternc/sendmail ' php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes AllowOverride AuthConfig FileInfo Limit Options Indexes
</Directory> </Directory>

View File

@ -53,8 +53,9 @@ host_create() {
# First, usefull vars. Some may be empty or false, it's # First, usefull vars. Some may be empty or false, it's
# OK, it will be solve in the "case" below # OK, it will be solve in the "case" below
local FQDN=$2 local FQDN=$2
local REDIRECT=$3 # Yes, TARGET_DIR and REDIRECT are the same local MAIL_ACCOUNT=$3
local TARGET_DIR=$3 # It's used by different template local REDIRECT=$4 # Yes, TARGET_DIR and REDIRECT are the same
local TARGET_DIR=$4 # It's used by different template
local USER=$(get_account_by_domain $FQDN) local USER=$(get_account_by_domain $FQDN)
local U_ID=$(get_uid_by_name "$USER") local U_ID=$(get_uid_by_name "$USER")
local G_ID=$(get_uid_by_name "$USER") local G_ID=$(get_uid_by_name "$USER")
@ -100,6 +101,7 @@ host_create() {
-e "s#%%redirect%%#$REDIRECT2#g" \ -e "s#%%redirect%%#$REDIRECT2#g" \
-e "s#%%UID%%#$U_ID#g" \ -e "s#%%UID%%#$U_ID#g" \
-e "s#%%GID%%#$G_ID#g" \ -e "s#%%GID%%#$G_ID#g" \
-e "s#%%mail_account%%#$MAIL_ACCOUNT#g" \
$TMP_FILE $TMP_FILE
# Check if all is right in the conf file # Check if all is right in the conf file

View File

@ -6,7 +6,7 @@ $fr="";
$rt=""; $rt="";
open(SM,"|/usr/sbin/sendmail -t -i"); open(SM,"|/usr/sbin/sendmail -t -i -f '".@ARGV[0]."'");
chomp($A=<STDIN>); chomp($A=<STDIN>);
while ($A ne "") { while ($A ne "") {

View File

@ -66,11 +66,11 @@ done
# sub_domaines.web_action = update and sub_domains.only_dns = false # sub_domaines.web_action = update and sub_domains.only_dns = false
IFS="$NEWIFS" IFS="$NEWIFS"
mysql_query " mysql_query "
select concat_ws('$IFS',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), sd.valeur ) select concat_ws('$IFS',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), m.mail, sd.valeur )
from sub_domaines sd from sub_domaines sd,membres m
where sd.web_action ='UPDATE' where sd.web_action ='UPDATE'
;" | while read type domain valeur ; do ;" | while read type domain mail valeur ; do
host_create "$type" "$domain" "$valeur" host_create "$type" "$domain" "$mail" "$valeur"
mysql_query "update sub_domaines sd set web_action='OK',web_result='$?' where lower(sd.type)='$type' and if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine)='$domain' and sd.valeur='$valeur'; " mysql_query "update sub_domaines sd set web_action='OK',web_result='$?' where lower(sd.type)='$type' and if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine)='$domain' and sd.valeur='$valeur'; "
echo 1 > "$RELOAD_WEB" echo 1 > "$RELOAD_WEB"
done done