How can I route a specific local device through a proxy?

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

How can I route a specific local device through a proxy?

Post by /RaspberryPi »

[h=3]Current Setup[/h] https://i.imgur.com/yEg2lg3.png
Currently just running a pi-hole DNS, and a lighttpd server on port 80 to access pi-hole admin web interface.
I have made a DHCP reservation on my router for my RPi (10.0.0.10).
[h=3]What I want to do[/h] https://i.imgur.com/wSryx3n.png
I want to route traffic from my Smart TV through a transparent mitmproxy.
I have the ability to configure these settings on my TV: - IP Address - Subnet mask - Gateway - DNS server
[h=3]Questions / Confusion[/h] Where does mitmproxy need to be within my network? Currently I'm trying to run it on the RPi on port 8080. I places dots (1, 2, 3) in the above image thinking of different places it could live, but I'm not sure.
Ideally only the traffic from my TV gets routed through the proxy. Particularly, I really only care about the traffic for a single domain my-domain.com and only for unencrypted HTTP protocol.
mitmproxy says I need to use a transparent proxy for clients that I can't setup proxy configurations for (which I can't for my TV). As part of the setup, it says I need to configure my network:
[INDENT] There are many ways to configure your network for transparent proxying. We’ll look at two common scenarios:
  • Configuring the client to use a custom gateway/router/“next hopâ€￾
  • Implementing custom routing on the router
[/INDENT] So my understanding is I can either:
  1. Set the gateway to the IP of my RPi (10.0.0.10) and REDIRECT port 80 -> 8080 on the pi. I tried this but my TV can't connect to the internet. This kind of makes sense to me, since I feel like my TV at least needs the router right?
  2. Or my router needs to be able to dynamically do this (which I don't think my router has settings for this... is there an easy way to put your own programs onto a router?)
I'm not sure if certain network setups can help me do some of this, or if I have to basically run all of my network traffic through mitmproxy. Wouldn't this be a bad idea for network performance?
If more hardware is needed to do what I want, I am open to those ideas.

submitted by /u/Flagauster
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”