what's the frequency of the letter "n" in:
q: squid http transparent proxy for spoofed dns requests i'm working on a security project which requires a remotely-accessible transparent proxy. i have set up an azure vm running ubuntu 18.04 with squid running as a transparent proxy. i'm only concerned with routing external http traffic through the proxy. the client that will connect to the proxy has a dns server configured which spoofs all requests to the ip of the vm.
the issue with the configuration is that squid is not transparently proxying http requests according to their host header, and is instead trying to connect to their original destination ip address (i.e. back to itself). as a result, when accessing an http website (using http://scratchpads.org as an example) on the client, the following error is observed:
the following error was encountered while trying to retrieve the url: http://scratchpads.org/

    connection to 10.0.1.4 failed

the system returned: (111) connection refused

where 10.0.1.4 is the internal ip of the vm.
the squid configuration is kept minimal for testing purposes:
http_access allow all
http_port 3129
http_port 3128 intercept

the iptables configuration on the vm to forward external traffic through squid is as follows:
sudo iptables -t nat -a prerouting -i eth0 -p tcp --dport 80 -j redirect --to-port 3128

the squid access log when trying to access the website looks as follows:
1614856056.293      0 [request source ip] tcp_miss/503 4310 get http://scratchpads.org/ - original_dst/10.0.1.4 text/html
1614856056.619      0 [request source ip] tcp_miss/503 4218 get http://scratchpads.org/favicon.ico - original_dst/10.0.1.4 text/html

i've checked that dns requests are resolved properly on the vm, and traffic originating from the machine does not get routed through squid (as desired), so there is no forwarding loop. there are also no errors in the squid startup logs, cache logs, or access logs. i've also tried various squid acls, and iptables configurations (setting up dnat and masquerading rules) to no effect.
does anyone know how i can get the http requests to be proxied to their original destination according to their host header, and not back to the ip of the transparent proxy?

a: turns out this is not possible using squid for some good reasons. i solved the issue by setting up privoxy in "intercepting" mode, which did exactly what i needed.

user
I counted 119 "n"s in that text.
assistant