# # An example of how to use HttpProxyURIFilter and RegexpFileMatcher to # filter unwanted URL-s in HTTP with Zorp # See also http.black and http.white
# This policy implements a transparent http proxy, which blocks all
# urls ending to "exe", but the ones which under http://www.domain.hu/download
# see http.black and http.white for the actual black- and whitelist
#
# based on example provided by Kosa Attila 
#

from Zorp.Core import *
from Zorp.Http import *
from Zorp.Matcher import *

Zorp.firewall_name = 'zorp@example.net'

InetZone("site-net", "192.168.1.0/24", 
	 outbound_services=["intra_http"],
	 inbound_services=[])
		
InetZone("internet", "0.0.0.0/0",
         inbound_services=["*"],
         outbound_services=[])

class IDHttp(HttpProxyURIFilter):
	matcher=RegexpFileMatcher('/etc/zorp/http.black', '/etc/zorp/http.white')
	def config(self):
		HttpProxyURIFilter.config(self)
		self.transparent_mode = 1

def regexp():
	
	Service("intra_http", IDHttp)
	Listener(SockAddrInet("192.168.1.1", 50080), "intra_http")