download
#
# An example of how to insert the original client address
# to a http header
from Zorp.Core import *
from Zorp.Http 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 MyHTTP(HttpProxy):
def config(self):
HttpProxy.config(self)
self.request_headers["X-Userhost"] = (HTTP_HDR_INSERT, self.session.client_address)
# to show only the IP address, use the example below
#self.request_headers["X-Userhost"] = (HTTP_HDR_INSERT, self.session.client_address.ip_s)
def inserthdr():
Service("intra_http", MyHTTP)
Listener(SockAddrInet("192.168.1.1", 50080), "intra_http")
|