Subversion Repositories ALCASAR

Rev

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

Rev 3021 Rev 3022
Line 82... Line 82...
82
				exit 1
82
				exit 1
83
			;;
83
			;;
84
		esac
84
		esac
85
	done
85
	done
86
fi
86
fi
87
echo "Type=$TYPE_MAIL - port=$port - smtpIP=$smtpIP - mailAddr=$mailAddr - mailMdp=$mailMdp - adminMail=$adminMail - whitedomain=$whiteDomain"
-
 
88
if  [[ $TYPE_MAIL -eq 0 ]]; then # disable mail service
87
if  [[ $TYPE_MAIL -eq 0 ]]; then # disable mail service
89
	$SED "s/^MAIL=.*/MAIL=off/" $CONF_FILE
88
	$SED "s/^MAIL=.*/MAIL=off/" $CONF_FILE
90
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=/" $CONF_FILE
89
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=/" $CONF_FILE
91
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE
90
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE
92
	$SED "s/^MAIL_SMTP_PORT=.*/MAIL_SMTP_PORT=/" $CONF_FILE
91
	$SED "s/^MAIL_SMTP_PORT=.*/MAIL_SMTP_PORT=/" $CONF_FILE
Line 97... Line 96...
97
	$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE
96
	$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE
98
	$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE
97
	$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE
99
	$SED "s/^\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
98
	$SED "s/^\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
100
	$SED "s/^\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
99
	$SED "s/^\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
101
	$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
100
	$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
-
 
101
	$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE
-
 
102
	$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE
-
 
103
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
-
 
104
elif [[ $TYPE_MAIL -eq 1 ]]; then # Enable mail service (act as smtp server)
-
 
105
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
-
 
106
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=1/" $CONF_FILE
-
 
107
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE
-
 
108
	$SED "s/^MAIL_SMTP_PORT=.*/MAIL_SMTP_PORT=/" $CONF_FILE
-
 
109
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
-
 
110
	$SED "s/^MAIL_PASSWORD=.*/MAIL_PASSWORD=/" $CONF_FILE
-
 
111
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=$whiteDomain/" $CONF_FILE
-
 
112
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
-
 
113
	$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE
-
 
114
	$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE
-
 
115
	$SED "s/^\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
-
 
116
	$SED "s/^\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
-
 
117
	$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
-
 
118
	$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE
-
 
119
	$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE
102
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
120
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
103
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server)
121
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server)
104
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
122
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
105
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=2/" $CONF_FILE
123
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=2/" $CONF_FILE
106
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
124
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
Line 111... Line 129...
111
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
129
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
112
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
130
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
113
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE
131
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE
114
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
132
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -d \$SMTP_IP -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
115
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
133
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -s \$SMTP_IP -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
116
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE
134
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$smtpPort/g" $POSTFIX_CONF_FILE
-
 
135
	$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = may/g" $POSTFIX_CONF_FILE
-
 
136
	$SED "/^smtp_tls_wrappermode = yes/d" $POSTFIX_CONF_FILE
117
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
137
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
118
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
138
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
119
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
139
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
120
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
140
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
121
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
141
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
Line 126... Line 146...
126
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
146
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
127
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
147
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
128
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE
148
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$smtpPort/" $LOCAL_IPTABLE_FILE
129
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
149
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT.*/\$IPTABLES -A OUTPUT -p tcp --dport \$SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
130
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
150
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT.*/\$IPTABLES -A INPUT  -p tcp --sport \$SMTP_PORT -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
131
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE
151
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$smtpPort/g" $POSTFIX_CONF_FILE
-
 
152
	$SED "s/^smtp_tls_security_level =.*/smtp_tls_security_level = encrypt/g" $POSTFIX_CONF_FILE
-
 
153
	echo "smtp_tls_wrappermode = yes" >> $POSTFIX_CONF_FILE
132
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
154
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
133
	echo "[${smtpIP}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
155
	echo "[${smtpIP}]:${smtpPort} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
134
	postmap ${SASLPATH}/sasl_passwd
156
	postmap ${SASLPATH}/sasl_passwd
135
	chmod -R 644 ${SASLPATH}
157
	chmod -R 644 ${SASLPATH}
136
	chown root:root ${SASLPATH}/sasl_passwd*
158
	chown root:root ${SASLPATH}/sasl_passwd*
137
	chmod 0600 ${SASLPATH}/sasl_passwd*
159
	chmod 0600 ${SASLPATH}/sasl_passwd*
138
else
160
else