Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Firewall settings
- for MASK in ...IP RANGE...; do
- iptables -t nat -A PREROUTING -i "$LAN_IFACE" -s "$LAN_TYPE.$MASK" -p tcp --dport 80 -j DNAT --to "$PROXY_IP:$PROXY_PORT"
- iptables -I FORWARD -s "$LAN_TYPE.$MASK" -d ! "$LAN_NET" -p tcp -j DROP
- iptables -I FORWARD -d "$LAN_TYPE.$MASK" -s ! "$LAN_NET" -p tcp -j DROP
- done
- # Startup settings
- while :; do nc -l -p $PROXY_PORT -e /path/to/proxy_script; done &
- # Proxy script
- # read headers
- if [ "$HTTP_HOST" == "$SERVER" ]; then
- echo "HTTP/1.0 403 Forbidden"
- else
- echo "HTTP/1.0 307 Temporary Redirect"
- echo "Location: http://$SERVER/"
- fi
- cat <<EOF
- Content-Type: text/html; charset=UTF-8
- <html>
- <head>
- ...
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement