
#-----------------------------------------------------------------------
# DESCRIPTION
#-----------------------------------------------------------------------
#
# Veritas BackupExec module - Client Agent on Linux.
#
# This module support the BackupExec Linux client agent.
#
# BackupExec appears to require port 8192 open to receive requests from
# the BackupExec server, however the documentation specifically states
# that the client port can be any high numbered port. This module uses
# port 8192 to listen to - check this after starting the BackupExec
# client agent.
#
# After installing the module, the user should execute rcf with the 
# --update-config parameter. The necessary options will be added to the
# configuration file.
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#m# 123
#a# accept
#i# cluster novirtual
#n# bkupexec
#t# servers
#
#   |--------------------------------------------------------------------|
#d# Backup Exec servers -> Linux Client Agent
#d# Uses local port 8192 for Client Agent requests. Check this after
#d# starting the Backup Exec Client Agent.
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------
#
module_name="bkupexec"		# module name used in options
module_type="servers"		# the module type (clients, servers, etc.)
service_name="BkUpExec"		# displayed on-screen
service_port="6101"		# ports used by BackupExec to connect to server
listen_ports="8192"		# ports used by BackupExec Agents to listen for commands

if [ ! "$CLUSTER_NAME" ]
then
	inchain="$INCHAIN"; outchain="$OUTCHAIN"
else
	outchain="$INCHAIN"; inchain="$OUTCHAIN"
fi

# BackupExec backup service or agent service

for host in `Option_Value accept $INTOPT $module_name $module_type`
do
	echo "Accept $INTOPT $IPADDR $service_name <-> $host $service_name $LOG_MSG"

	ipchains -A $inchain  -j ACCEPT -p tcp ! -y -s $host   $service_port -d $IPADDR $UNPRIVPORTS  $LOG
	ipchains -A $outchain -j ACCEPT -p tcp      -s $IPADDR $UNPRIVPORTS  -d $host   $service_port $LOG

	ipchains -A $inchain  -j ACCEPT -p tcp      -s $host   $UNPRIVPORTS  -d $IPADDR $listen_ports $LOG
	ipchains -A $outchain -j ACCEPT -p tcp ! -y -s $IPADDR $listen_ports -d $host   $UNPRIVPORTS  $LOG

done

unset module_name module_type service_name service_port host

