#!/bin/bash
#

## Firewall Script
#  01-07-26  by Erik Wegner
#  http-proxy-client <Interface> <ProxyIP
#

INT=$1  # Interface
PIP=$2  # Network

if test -z $1 || test -z $2 ; then
	echo "$0 <Interface> <ProxyIP>"
	echo "e.g.: $0 eth0 192.168.4.1"
	exit 2
fi

# Pfad zu IPTables
if test -z $IPTABLES ; then
	IPTABLES=/usr/sbin/iptables
fi

## Ports
#  Nicht-privilegierte = 1024-65535
P_HIGH=1024:65535
P_PROXY=80

echo -e "\n\n## Proxy auf entferntem Rechner, [$P_HIGH] -> $INT-$PIP[$P_PROXY] "
echo "$IPTABLES -A OUTPUT -m state --state NEW \\
	-p TCP -o $INT --sport $P_HIGH \\
	--dport $P_PROXY -d $PIP -j ACCEPT"

