
#-----------------------------------------------------------------------
# Copyright (C) 2000-2001, Jean-Sebastien Morisset <jsmoriss@mvlan.net>
#-----------------------------------------------------------------------
# $Id: 610-pcanywhere-servers,v 1.4 2001/08/11 17:01:21 jsmoriss Exp $
#-----------------------------------------------------------------------
# README
#-----------------------------------------------------------------------
#
# Allow a Windows PC to connect to a pcAnywhere host.
#
# Host PCAnywhere must be using TCP/IP Compatibility mode. If it isn't
# working visit symantec.com and search for "How to change the pcAywhere
# IP ports". There is a short section on "Restricting pcAnywhere ports".
# Follow those instructions (it's a registry change on the host and
# remote) and then it should be working ok.
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#m# 23
#a# accept ignore deny
#i# cluster
#n# pcanywhere
#t# servers
#
#   |--------------------------------------------------------------------|
#d# pcanywhere (Ports 5631 TCP, 5632 UDP)
#d# The following rules will allow an internal Windows PC to connect to
#d# an external pcAnywhere host when strict or paranoid mode is on.
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------

module_name="pcanywhere"    # module name used in options
service_name="PcAnywhere"   # displayed on-screen
module_type="servers"       # the module type (clients, servers, etc.)
tcp_service_port="5631"     # tcp port number for this service
udp_service_port="5632"     # udp port number for this service

#--------------------------------------------------------------------
# PcAnywhere (Port 5631-5632)
#--------------------------------------------------------------------

[ ! "$CLUSTER_NAME" ] && { inchain="$INCHAIN"; outchain="$OUTCHAIN"; } || \
                         { inchain="$OUTCHAIN"; outchain="$INCHAIN"; }

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 "Reject $INTOPT $IPADDR -> $host $service_name $action_log_msg"
				ipchains -A $outchain -j REJECT -p tcp   -y -s $IPADDR -d $host $tcp_service_port $action_log
				ipchains -A $outchain -j REJECT -p udp      -s $IPADDR -d $host $udp_service_port $action_log
				;;
			accept)
				Hostports accept remote tcp "$service_name" $host $tcp_service_port
				Hostports accept remote udp ""              $host $udp_service_port
				;;
		esac
	done
done

unset module_name module_type service_name tcp_service_port udp_service_port
unset action action_log_msg action_log host inchain outchain

