
#-----------------------------------------------------------------------
# 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/
# 020-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
#-----------------------------------------------------------------------
#
# 2000-10-14  Jean-Sebastien Morisset <jsmoriss@jsm-mv.dyndns.org>
#             Initial module written for v5.0.
#
#-----------------------------------------------------------------------
# MODULE CONFIGURATION
#-----------------------------------------------------------------------
#
#N# ipsecvpn
#A# accept
#T# hosts
#   |--------------------------------------------------------------------|
#D# Hostnames of other servers you'll be communicating with via an IPSec
#D# VPN. Entering a value here will also turn off route filtering (used 
#D# to prevent IP spoofing) on your ipsec public interface(s).
#   |--------------------------------------------------------------------|
#
#-----------------------------------------------------------------------
# START OF MODULE CODE
#-----------------------------------------------------------------------


#-----------------------------------------------------------------------
# IPSec VPN (Port 500)
#-----------------------------------------------------------------------

for HOST in `Option_Value ACCEPT $INTERFACE IPSECVPN HOSTS`
do
	echo "Accept $INTERFACE $IPADDR IPSec VPN <- $HOST $LOG_MSG"
	ipchains -A $INCHAIN  -j ACCEPT -p udp -s $HOST   500 -d $IPADDR 500 $LOG
	ipchains -A $OUTCHAIN -j ACCEPT -p udp -s $IPADDR 500 -d $HOST   500 $LOG

	ipchains -A $INCHAIN  -j ACCEPT -p 50 -s $HOST -d $IPADDR $LOG
	ipchains -A $OUTCHAIN -j ACCEPT -p 50 -s $IPADDR -d $HOST $LOG
done

