Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Squid: forward to another proxy (with authentication details for the parent proxy)

In short, I am looking for a simple way to do the following (please give code samples if possible):

  • set up and start a proxy server on my computer (say address is 10.10.200.200:6767) that can capture all web requests from my phone
  • once the request from phone comes to this proxy, it will add custom authentication details (my_username/my_password) and forward it to the institute proxy (say address is 10.1.2.3:80)
  • I dont need any caching/acceleration on my local proxy (10.10.200.200). It just needs to catch the request and forward it.

Now, more details to fully explain my situation:

In my institute, authentication is needed to pass through a proxy so that we can connect to the internet. I normally enter my ldap username/password to authenticate when the pop up appears.

Now, I want to connect my phone to the institute WiFi but my phone does not have the option of authentication with proxy. Only a proxy address can be specified. So, I am planning to set up a local proxy on my computer to catch all requests from my phone, add authentication details and pass it to my institute proxy through my computer.

I installed squid3 (on Ubuntu), but looking at the configuration file, I am lost. I tried googling but it looks all too complicated.

Hoping someone can provide help.

like image 863
Neo Avatar asked Oct 05 '13 15:10

Neo


People also ask

How do I authenticate a Squid proxy?

How does Proxy Authentication work in Squid? Users will be authenticated if squid is configured to use proxy_auth ACLs (see next question). Browsers send the user's authentication credentials in the HTTP Authorization: request header.

What is Squid forward proxy?

Squid is a caching and forwarding HTTP web proxy. It has a wide variety of uses, including speeding up a web server by caching repeated requests, caching web, DNS and other computer network lookups for a group of people sharing network resources, and aiding security by filtering traffic.

How do I install Squid web proxy with Active directory authentication?

In Active Directory create a user called "Squid Proxy" with the logon name [email protected]. Ensure the following is true when creating the account. Create a password file used by squid for ldap access and secure the file permissions (substitute the word "squidpass" below with your password).

Is Squid proxy A reverse proxy?

Squid as Reverse ProxyIn the second operating mode, Squid is employed as a reverse proxy.


1 Answers

I figured from squid tutorials that the simplest configuration to do this is:

http_access allow all http_port 3128  coredump_dir /var/spool/squid3 refresh_pattern ^ftp:       1440    20% 10080 refresh_pattern ^gopher:    1440    0%  1440 refresh_pattern -i (/cgi-bin/|\?) 0 0%  0 refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880 refresh_pattern .       0   20% 4320  cache_peer 10.1.2.3 parent 80 0 no-query default login=my_username:my_password never_direct allow all 

These lines should get you a working proxy server on your local machine that forwards all requests to another proxy server (change ip addresses accordingly). However, please note that in the above script, I have disabled any access control/filters, so potentially, anybody can connect and use your proxy. You need to add additional code to restrict entry to only some devices.

like image 172
Neo Avatar answered Sep 19 '22 02:09

Neo