Subversion Repositories ALCASAR

Rev

Rev 3060 | Rev 3062 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3060 Rev 3061
Line 6... Line 6...
6
##	Script by K@M3L & T3RRY (LaPlateform), joss_p & Rexy
6
##	Script by K@M3L & T3RRY (LaPlateform), joss_p & Rexy
7
##  This script configure PostFix
7
##  This script configure PostFix
8
##		0 : no email autoregistration
8
##		0 : no email autoregistration
9
##		1 : PostFix is the SMTP server
9
##		1 : PostFix is the SMTP server
10
##		2 : PostFix relay to an other SMTP server
10
##		2 : PostFix relay to an other SMTP server
11
##		2 : PostFix use an external email address (with SASL)
11
##		3 : PostFix use an external email address (with Cyrus-SASL)
12
###########################################################################################
12
###########################################################################################
13
 
13
 
-
 
14
######################################################
-
 
15
##			Email configuration examples (mode = 3)
-
 
16
## common parameters : smtp_use_tls = yes, smtp_tls_security_level = encrypt, smtp_sasl_auth_enable = yes
-
 
17
## common rules : 'myhostname' parameter should be the domain name of the sasl_email account
-
 
18
########## smtp.free.fr:465
-
 
19
## smtp_sasl_security_option = noanonymous, relayhost = [smtp.free.fr]:465, smtp_tls_wrappermode = yes
-
 
20
########## smtp.free.fr:587
-
 
21
## smtp_sasl_security_option = noanonymous, relayhost = [smtp.free.fr]:587, smtp_tls_wrappermode = no
-
 
22
 
14
# ****** Paths *******
23
# ****** Paths *******
15
SED="/bin/sed -i"
24
SED="/bin/sed -i"
16
CONF_FILE="/usr/local/etc/alcasar.conf"
25
CONF_FILE="/usr/local/etc/alcasar.conf"
17
POSTFIX_CONF_FILE="/etc/postfix/main.cf"
26
POSTFIX_CONF_FILE="/etc/postfix/main.cf"
18
LOCAL_IPTABLE_FILE="/usr/local/etc/alcasar-iptables-local.sh"
27
LOCAL_IPTABLE_FILE="/usr/local/etc/alcasar-iptables-local.sh"
Line 164... Line 173...
164
	if [ "$smtpPort" = "465" ]; then # wrappermode is madatory only if port = 465
173
	if [ "$smtpPort" = "465" ]; then # wrappermode is madatory only if port = 465
165
		$SED "s/^smtp_tls_wrappermode =.*/smtp_tls_wrappermode = yes/g" $POSTFIX_CONF_FILE
174
		$SED "s/^smtp_tls_wrappermode =.*/smtp_tls_wrappermode = yes/g" $POSTFIX_CONF_FILE
166
	else
175
	else
167
		$SED "s/^smtp_tls_wrappermode =.*/smtp_tls_wrappermode = no/g" $POSTFIX_CONF_FILE
176
		$SED "s/^smtp_tls_wrappermode =.*/smtp_tls_wrappermode = no/g" $POSTFIX_CONF_FILE
168
	fi
177
	fi
169
	if [ "$domainName" = "localdomain" ]; then  # use a real domain name to avoid extern smtp server reject
178
	if [ "$domainName" = "localdomain" ]; then  # use the domain name of $mail_Addr to avoid extern smtp servers reject
-
 
179
		domain_of_smtpIP=`echo $smtp_IP|rev|cut -d '.' -f1-2|rev`
170
		$SED "s/^myhostname =.*/myhostname = alcasar.net/g" $POSTFIX_CONF_FILE
180
		$SED "s/^myhostname =.*/myhostname = $domain_of_smtpIP/g" $POSTFIX_CONF_FILE
171
	else
181
	else
172
		$SED "s/^myhostname =.*/myhostname = $hostName.$domainName/g" $POSTFIX_CONF_FILE
182
		$SED "s/^myhostname =.*/myhostname = $hostName.$domainName/g" $POSTFIX_CONF_FILE
173
	fi
183
	fi
174
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
184
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
175
	echo "[${smtpIP}]:${smtpPort} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
185
	echo "[${smtpIP}]:${smtpPort} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd