Line 84... |
Line 84... |
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 -d \$SMTP_IP/ s/^/#/" $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 -s \$SMTP_IP/ s/^/#/g" $LOCAL_IPTABLE_FILE
|
87 |
$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
|
87 |
$SED "s/^relayhost =.*/relayhost =/" $POSTFIX_CONF_FILE
|
88 |
elif [[ $TYPE_MAIL -eq 2 ]]; then # Enable mail service (relaying to an extern mail server)
|
88 |
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_TYPE=.*/MAIL_TYPE=2/" $CONF_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
|
- |
|
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
|
89 |
echo "relayhost = [${smtp}]:${port}" >> /etc/postfix/main.cf
|
93 |
$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
|
90 |
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
|
94 |
elif [[ $TYPE_MAIL -eq 3 ]]; then # Enable mail service (using an email address)
|
91 |
$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
|
95 |
$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
|
92 |
$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
|
96 |
$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
|
93 |
$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
|
97 |
$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
|
94 |
$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtp/" $CONF_FILE
|
98 |
$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtp/" $CONF_FILE
|
Line 102... |
Line 106... |
102 |
$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
|
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
|
103 |
$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
|
107 |
$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
|
104 |
[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
|
108 |
[ -d ${SASLPATH} ] || mkdir ${SASLPATH}
|
105 |
echo "[${smtp}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
|
109 |
echo "[${smtp}]:${port} ${mailAddr}:${mailMdp}" > ${SASLPATH}/sasl_passwd
|
106 |
postmap ${SASLPATH}/sasl_passwd
|
110 |
postmap ${SASLPATH}/sasl_passwd
|
107 |
chmod -R 777 ${SASLPATH}
|
111 |
chmod -R 644 ${SASLPATH}
|
108 |
#chown root:root ${SASLPATH}/sasl_passwd*
|
112 |
chown root:root ${SASLPATH}/sasl_passwd*
|
109 |
#chmod 0600 ${SASLPATH}/sasl_passwd*
|
113 |
chmod 0600 ${SASLPATH}/sasl_passwd*
|
110 |
else
|
114 |
else
|
111 |
echo "Erreur ! Aucun type de messagerie sélectionné !"
|
115 |
echo "Erreur ! Aucun type de messagerie sélectionné !"
|
112 |
exit 0
|
116 |
exit 0
|
113 |
fi
|
117 |
fi
|
114 |
/usr/local/bin/alcasar-iptables.sh
|
118 |
/usr/local/bin/alcasar-iptables.sh
|