
#-----------------------------------------------------------------------
# CHANGES
#-----------------------------------------------------------------------
#
# 2000-10-14  Jean-Sebastien Morisset <jsmoriss@jsm-mv.dyndns.org>
#             Initial module written for v5.0.
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#m# 123
#a# accept ignore deny
#i# cluster
#n# smtp
#t# clients
#
#   |--------------------------------------------------------------------|
#d# The accept option opens access to your SMTP (port 25) mail server. Use
#d# the ignore and/or deny options to block specific hosts/networks in a
#d# wider accept range. The deny option logs all rejected packets, while
#d# the ignore option doesn't log anything.
#d#
#d# Example:
#d#   accept-eth1-smtp-clients = any/0
#d#     deny-eth1-smtp-clients = 207.253.78.0/24
#d#
#d# This will let anyone connect to your mail server, except hosts in the 
#d# 207.253.78.* network.
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------

for action in ignore deny accept
do
	case $action in
		accept|ignore)
				action_log_msg="$LOG_MSG"; action_log="$LOG";;
		deny)	action_log_msg="(logged)"; action_log="-l"  ;;
	esac
	for host in `Option_Value $action $INTOPT smtp clients`
	do
		case $action in
			ignore|deny)
				echo "Deny $INTOPT $IPADDR SMTP <- $host $action_log_msg"
				ipchains -A $INCHAIN -j DENY -p tcp -s $host -d $IPADDR smtp $action_log
				;;
			accept)
				Accept_Hostports local tcp "SMTP" $host smtp
				;;
		esac
	done
done
unset action action_log_msg action_log host

