Subversion Repositories ALCASAR

Rev

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

Rev 2993 Rev 2994
Line 8... Line 8...
8
###########################################################################################
8
###########################################################################################
9
 
9
 
10
# ****** Paths - chemin des commandes *******
10
# ****** Paths - chemin des commandes *******
11
SED="/bin/sed -i"
11
SED="/bin/sed -i"
12
CONF_FILE="/usr/local/etc/alcasar.conf"
12
CONF_FILE="/usr/local/etc/alcasar.conf"
-
 
13
POSTFIX_CONF_FILE="/etc/postfix/main.cf"
13
LOCAL_IPTABLE_FILE="/usr/local/etc/alcasar-iptables-local.sh"
14
LOCAL_IPTABLE_FILE="/usr/local/etc/alcasar-iptables-local.sh"
14
saslPath="/etc/postfix/sasl"
15
saslPath="/etc/postfix/sasl"
15
smtpIP="0.0.0.0/0"
16
smtpIP="0.0.0.0/0"
16
 
17
 
17
usage="Usage: alcasar-mail_install.sh 0|1|2|3"
18
usage="Usage: alcasar-mail_install.sh 0|1|2|3"
Line 68... Line 69...
68
				exit 1
69
				exit 1
69
			;;
70
			;;
70
		esac
71
		esac
71
	done
72
	done
72
fi
73
fi
73
if  [[ $TYPE_MAIL -eq 0 ]]; then # idesable mail service
74
if  [[ $TYPE_MAIL -eq 0 ]]; then # disable mail service
74
	$SED "s/^MAIL=.*/MAIL=off/" $CONF_FILE
75
	$SED "s/^MAIL=.*/MAIL=off/" $CONF_FILE
75
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=/" $CONF_FILE
76
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=/" $CONF_FILE
76
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
77
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
77
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE
78
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=/" $CONF_FILE
78
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=/" $CONF_FILE
79
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=/" $CONF_FILE
79
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
80
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=/" $CONF_FILE
80
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAINE=/" $CONF_FILE
81
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAINE=/" $CONF_FILE
81
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=/" $CONF_FILE
82
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=/" $CONF_FILE
82
	$SED "/^SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
83
	$SED "/^SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
83
	$SED "/^\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
-
 
84
	$SED "/^SMTP_PORT/ s/^/#/g" $LOCAL_IPTABLE_FILE
84
	$SED "/^SMTP_PORT/ s/^/#/g" $LOCAL_IPTABLE_FILE
-
 
85
	$SED "/^\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
85
	$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
86
elif [[ $TYPE_MAIL -eq 2 ]]; then
-
 
87
	echo "relayhost = [${smtp}]:${port}" >> /etc/postfix/main.cf
87
	$SED "s/^relayhost =.*/relayhost =/g" $POSTFIX_CONF_FILE
88
elif [[ $TYPE_MAIL -eq 3 ]]; then
88
elif [[ $TYPE_MAIL -eq 2 ]]; then # relay to an extern mail server
89
	echo "relayhost = [${smtp}]:${port}" >> /etc/postfix/main.cf
89
	echo "relayhost = [${smtp}]:${port}" >> /etc/postfix/main.cf
-
 
90
elif [[ $TYPE_MAIL -eq 3 ]]; then # use an email address
-
 
91
	$SED "s/^MAIL=.*/MAIL=on/" $CONF_FILE
-
 
92
	$SED "s/^MAIL_TYPE=.*/MAIL_TYPE=3/" $CONF_FILE
-
 
93
	$SED "s/^MAIL_SMTP=.*/MAIL_SMTP=/" $CONF_FILE
-
 
94
	$SED "s/^MAIL_SMTP_IP=.*/MAIL_SMTP_IP=$smtp/" $CONF_FILE
-
 
95
	$SED "s/^MAIL_PORT=.*/MAIL_PORT=$port/" $CONF_FILE
-
 
96
	$SED "s/^MAIL_ADDR=.*/MAIL_ADDR=$mailAddr/" $CONF_FILE
-
 
97
	$SED "s/^MAIL_WHITEDOMAIN=.*/MAIL_WHITEDOMAINE=$whiteDomain/" $CONF_FILE
-
 
98
	$SED "s/^MAIL_ADMIN=.*/MAIL_ADMIN=$adminMail/" $CONF_FILE
-
 
99
	$SED "/^SMTP_IP/ s/^/SMTP_IP=$port/" $LOCAL_IPTABLE_FILE
-
 
100
	$SED "/^SMTP_PORT/ s/^/SMTP_PORT=$port/g" $LOCAL_IPTABLE_FILE
-
 
101
	$SED "/^\$IPTABLES -A OUTPUT -p tcp -d \$SMTP_IP/ s/^/#/" $LOCAL_IPTABLE_FILE
-
 
102
	$SED "/^\$IPTABLES -A INPUT  -p tcp -s \$SMTP_IP/ s/^/#/g" $LOCAL_IPTABLE_FILE
-
 
103
	$SED "s/^relayhost =.*/relayhost =/g" $POSTFIX_CONF_FILE
-
 
104
	$SED "s/^relayhost =.*/relayhost = $smtp:$port/g" $POSTFIX_CONF_FILE
90
	[ -d ${saslPath} ] || mkdir ${saslPath}
105
	[ -d ${saslPath} ] || mkdir ${saslPath}
91
	echo "[${smtp}]:${port} ${mailAddr}:${mailMdp}" > ${saslPath}/sasl_passwd
106
	echo "[${smtp}]:${port} ${mailAddr}:${mailMdp}" > ${saslPath}/sasl_passwd
92
	postmap ${saslPath}/sasl_passwd
107
	postmap ${saslPath}/sasl_passwd
93
	chmod -R 777 ${saslPath}
108
	chmod -R 777 ${saslPath}
94
	#chown root:root ${saslPath}/sasl_passwd*
109
	#chown root:root ${saslPath}/sasl_passwd*