
#-----------------------------------------------------------------------
# DESCRIPTION
#-----------------------------------------------------------------------
#
#-----------------------------------------------------------------------
# CHANGES
#-----------------------------------------------------------------------
#
# 2001-02-05  Edwin ten Brink <edwin@privateer.student.utwente.nl>
#             Changed ipchains statement into Accept_Hostports
# 2000-11-28  Edwin ten Brink <edwin@privateer.student.utwente.nl>
#             Modified for v5.0.1.a4
# 2000-10-16  Edwin ten Brink <edwin@privateer.student.utwente.nl>
#             Creation
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#m# 123
#a# accept ignore
#i# 
#n# dnetproxy
#t# clients
#
#   |--------------------------------------------------------------------|
#d# dnetproxy (Port 2064 TCP)
#d# Distributed.net personal proxy, an encryption challenge
#d# http://www.distributed.net
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------

#-----------------------------------------------------------------------
# If you define new variables and/or functions within a module, you
# should always keep them in lower case. This will avoid any 
# conflicts with rc.firewall variables and function names.
#-----------------------------------------------------------------------

module_name="dnetproxy"      # module name used in options
module_type="clients"        # the module type (clients, servers, etc.)
service_name="D.Net pproxy"  # displayed on-screen
service_port="2064"          # port number for this service

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 $module_name $module_type`
	do
		case $action in
			ignore|deny)
				echo "Deny $INTOPT $IPADDR $service_name <- $host $action_log_msg"
				ipchains -A $INCHAIN -j DENY -p tcp -s $host -d $IPADDR $service_port $action_log
				;;
			accept)
				Accept_Hostports local tcp "$service_name" $host $service_port
				;;
		esac
	done
done
unset module_name module_type service_name service_port
unset action action_log_msg action_log host

