Subversion Repositories ALCASAR

Rev

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

Rev 3013 Rev 3016
Line 80... Line 80...
80
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
80
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
81
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=/" $CONF_FILE
81
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=/" $CONF_FILE
82
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=/" $CONF_FILE
82
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=/" $CONF_FILE
83
	$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE
83
	$SED "/^SMTP_IP=/ s/^/#/" $LOCAL_IPTABLE_FILE
84
	$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE
84
	$SED "/^SMTP_PORT=/ s/^/#/" $LOCAL_IPTABLE_FILE
85
	$SED "/^\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
85
	$SED "/^\$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
86
	$SED "/^\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP/ s/^/#/g" $LOCAL_IPTABLE_FILE
86
	$SED "/^\$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
87
	$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
87
	$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
-
 
88
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
88
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server)
89
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server)
89
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
90
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
90
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=2/" $CONF_FILE
91
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=2/" $CONF_FILE
-
 
92
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
-
 
93
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
-
 
94
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=$port/" $CONF_FILE
-
 
95
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
-
 
96
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=$whiteDomain/" $CONF_FILE
-
 
97
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
-
 
98
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
-
 
99
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$port/" $LOCAL_IPTABLE_FILE
91
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP.*/\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP --dport \$SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
100
	$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
92
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP.*/\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP --sport \$SMTP_PORT -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
101
	$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
93
	$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
102
	$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
-
 
103
	[ -e ${SASLPATH}/sasl_passwd ] && rm -f ${SASLPATH}/sasl_passwd
94
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
104
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
95
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
105
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
96
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
106
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
97
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
107
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
98
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtp/" $CONF_FILE
108
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtpIP/" $CONF_FILE
99
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=$port/" $CONF_FILE
109
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=$port/" $CONF_FILE
100
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=$mailAddr/" $CONF_FILE
110
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=$mailAddr/" $CONF_FILE
101
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=$whiteDomain/" $CONF_FILE
111
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAIN=$whiteDomain/" $CONF_FILE
102
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
112
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
103
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
113
	$SED "s/^#SMTP_IP=.*/SMTP_IP=$smtpIP/" $LOCAL_IPTABLE_FILE
104
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$port/" $LOCAL_IPTABLE_FILE
114
	$SED "s/^#SMTP_PORT=.*/SMTP_PORT=$port/" $LOCAL_IPTABLE_FILE
105
	$SED "s/^#\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP.*/\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP --dport \$SMTP_PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT/" $LOCAL_IPTABLE_FILE
115
	$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
106
	$SED "s/^#\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP.*/\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP --sport \$SMTP_PORT -m conntrack --ctstate 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 -m conntrack --ctstate ESTABLISHED     -j ACCEPT/" $LOCAL_IPTABLE_FILE
107
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE
117
	$SED "s/^relayhost =.*/relayhost = $smtpIP:$port/g" $POSTFIX_CONF_FILE
108
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
118
	[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
109
	echo "[${smtpIP}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
119
	echo "[${smtpIP}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
110
	postmap ${SASLPATH}/sasl_passwd
120
	postmap ${SASLPATH}/sasl_passwd
111
	chmod -R 644 ${SASLPATH}
121
	chmod -R 644 ${SASLPATH}
Line 114... Line 124...
114
else
124
else
115
	echo "Erreur ! Aucun type de messagerie sélectionné !"
125
	echo "Erreur ! Aucun type de messagerie sélectionné !"
116
	exit 0
126
	exit 0
117
fi
127
fi
118
/usr/local/bin/alcasar-iptables.sh
128
/usr/local/bin/alcasar-iptables.sh
-
 
129
systemctl restart postfix.service
119
exit 0
130
exit 0