
#-----------------------------------------------------------------------
# README
#-----------------------------------------------------------------------
#
# This module supports the IPSec VPN, typically used by S/WAN and other
# tunneling software.
#
# To install, copy this file to /etc/firewall/modules/public/services/
# 050-ipsecvpn-hosts. Since VPN bandwidth use may be very high, it's 
# preferable to keep this module near the top. Execute rc.firewall with
# the --update-config parameter. This will add the new options to the 
# configuration file.
#
#-----------------------------------------------------------------------
# CHANGES
#-----------------------------------------------------------------------
#
# 2001-02-15  Edwin ten Brink <edwin@privateer.student.utwente.nl>
#             Created from the modified version of original ipsecvpn
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#m# 123
#a# accept
#i# cluster
#n# ipsecvpnah
#t# servers
#
#   |--------------------------------------------------------------------|
#d# ipsecvpnah (Port 500 UDP)
#d# Hostnames of other servers you'll be communicating with via an IPSec
#d# VPN, typically used by S/WAN and other tunneling software.
#d# Entering a value here will also turn off route filtering (used 
#d# to prevent IP spoofing) on your ipsec public interface(s).
#d# Note: This module assumes you use AH packet level authentication.
#d# Other VPN protocols may be found in the contrib directory.
#d# Your ipsec interface must be declared PUBLIC!
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------

module_name="ipsecvpnah"       # module name used in options
module_type="servers"          # the module type (clients, servers, etc.)
service_name="IPSec VPN (AH)"  # displayed on-screen
service_port="500"             # port number for this service

for host in `Option_Value accept $INTOPT $module_name $module_type`
do
	echo "Accept $INTOPT $IPADDR $service_name <-> $host $LOG_MSG"
	ipchains -A $INCHAIN  -j ACCEPT -p udp -s $host   $service_port -d $IPADDR $service_port $LOG
	ipchains -A $OUTCHAIN -j ACCEPT -p udp -s $IPADDR $service_port -d $host   $service_port $LOG

	ipchains -A $INCHAIN  -j ACCEPT -p 51 -s $host   -d $IPADDR $LOG
	ipchains -A $OUTCHAIN -j ACCEPT -p 51 -s $IPADDR -d $host   $LOG
done
unset host

