diff --git a/doc-src/02-docstyle.css b/doc-src/02-docstyle.css index 9b8a8edc1..8e07434b9 100644 --- a/doc-src/02-docstyle.css +++ b/doc-src/02-docstyle.css @@ -10,3 +10,7 @@ body { .nowrap { white-space: nowrap; } + +h1 { + line-height: 1.1; +} \ No newline at end of file diff --git a/doc-src/_layout.html b/doc-src/_layout.html index 72b27cd3c..836a3e9da 100644 --- a/doc-src/_layout.html +++ b/doc-src/_layout.html @@ -6,7 +6,7 @@ - mitmproxy 0.9 docs + mitmproxy $!VERSION!$ docs @@ -51,9 +51,10 @@ $!nav("transparent/linux.html", this, state)!$ $!nav("transparent/osx.html", this, state)!$ -
\# Listen for DNS requests on the internal network + interface=eth1 + \# Act as a DHCP server, assign IP addresses to clients + dhcp-range=192.168.3.10,192.168.3.100,96h + \# Broadcast gateway and dns server information + dhcp-option=option:router,192.168.3.1 + dhcp-option=option:dns-server,192.168.3.1 ++ Apply changes: + `sudo service dnsmasq restart` +
+ iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 \ + -j REDIRECT --to-port 8080 + iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 \ + -j REDIRECT --to-port 8080 ++ +4. If required, install the mitmproxy + certificates on the test device. + +5. Finally, we can run
mitmproxy -T
.
+ The proxied machine cannot to leak any data outside of HTTP or DNS requests.
+
diff --git a/doc-src/tutorials/transparent-dhcp/step1_proxy.png b/doc-src/tutorials/transparent-dhcp/step1_proxy.png
new file mode 100644
index 000000000..a0c944843
Binary files /dev/null and b/doc-src/tutorials/transparent-dhcp/step1_proxy.png differ
diff --git a/doc-src/tutorials/transparent-dhcp/step1_vbox_eth0.png b/doc-src/tutorials/transparent-dhcp/step1_vbox_eth0.png
new file mode 100644
index 000000000..4b7b4e9b8
Binary files /dev/null and b/doc-src/tutorials/transparent-dhcp/step1_vbox_eth0.png differ
diff --git a/doc-src/tutorials/transparent-dhcp/step1_vbox_eth1.png b/doc-src/tutorials/transparent-dhcp/step1_vbox_eth1.png
new file mode 100644
index 000000000..b994d4cbc
Binary files /dev/null and b/doc-src/tutorials/transparent-dhcp/step1_vbox_eth1.png differ
diff --git a/doc-src/tutorials/transparent-dhcp/step2_proxied_vm.png b/doc-src/tutorials/transparent-dhcp/step2_proxied_vm.png
new file mode 100644
index 000000000..2046cc579
Binary files /dev/null and b/doc-src/tutorials/transparent-dhcp/step2_proxied_vm.png differ
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 1894f7f0b..f2dcc43f8 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -106,18 +106,19 @@ class RequestReplayThread(threading.Thread):
class HandleSNI:
- def __init__(self, handler, client_conn, host, port, cert, key):
+ def __init__(self, handler, client_conn, host, port, key):
self.handler, self.client_conn, self.host, self.port = handler, client_conn, host, port
- self.cert, self.key = cert, key
+ self.key = key
def __call__(self, client_connection):
try:
sn = client_connection.get_servername()
if sn:
self.handler.get_server_connection(self.client_conn, "https", self.host, self.port, sn)
+ dummycert = self.handler.find_cert(self.client_conn, self.host, self.port, sn)
new_context = SSL.Context(SSL.TLSv1_METHOD)
new_context.use_privatekey_file(self.key)
- new_context.use_certificate(self.cert.x509)
+ new_context.use_certificate(dummycert.x509)
client_connection.set_context(new_context)
self.handler.sni = sn.decode("utf8").encode("idna")
# An unhandled exception in this method will core dump PyOpenSSL, so
@@ -331,8 +332,7 @@ class ProxyHandler(tcp.BaseHandler):
def establish_ssl(self, client_conn, host, port):
dummycert = self.find_cert(client_conn, host, port, host)
sni = HandleSNI(
- self, client_conn, host, port,
- dummycert, self.config.certfile or self.config.cacert
+ self, client_conn, host, port, self.config.certfile or self.config.cacert
)
try:
self.convert_to_ssl(dummycert, self.config.certfile or self.config.cacert, handle_sni=sni)