Skip to content

Instantly share code, notes, and snippets.

@yvanin
Last active December 11, 2024 10:00
Show Gist options
  • Select an option

  • Save yvanin/ef831720112c1f6ee8c3 to your computer and use it in GitHub Desktop.

Select an option

Save yvanin/ef831720112c1f6ee8c3 to your computer and use it in GitHub Desktop.
HTTP proxy with basic authentication using Squid
  1. Download and install Squid 3.5 for Windows (default path is C:\Squid)

  2. Create file C:\Squid\etc\.htpasswd with the following content:

    admin:$apr1$kWA/DRFy$klaeXRe3S3jIPqc64HTMA0

    This corresponds to username admin and password 1234
    To generate your own username/password use http://www.htaccesstools.com/htpasswd-generator-windows/

  3. Open Squid configuration (squid.conf)

  4. Add following to the top of squid.conf:

    auth_param basic program "/cygdrive/c/squid/lib/squid/basic_ncsa_auth.exe" "/cygdrive/c/squid/etc/.htpasswd"
    acl ncsa_users proxy_auth REQUIRED
    http_access allow ncsa_users

  5. Comment out all http_access allow ... entries in squid.conf (except ncsa_users)

  6. Restart Squid service

Web proxy is ready!

Proxy address: http://127.0.0.1:3128/
Proxy username: admin
Proxy password: 1234

@snehhal315

Copy link
Copy Markdown

I have got it but it isnt working for me

@madnut-ua

Copy link
Copy Markdown

Works great for me, thanks!

@khalidimran

Copy link
Copy Markdown

you will created with cmd :D and it shoud working

@luisaceituno

Copy link
Copy Markdown

For future reference, relative paths work for me too. As follows:

auth_param basic program /lib/squid/basic_ncsa_auth.exe /etc/squid/ncsa_users.htpasswd
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all

Using Squid Server 3.5.28 installed with Diladele B.V.'s installer version 1.3.5.28.

@skljoc

skljoc commented Sep 15, 2019

Copy link
Copy Markdown

Why dont you share full configuration file? Please

@skljoc

skljoc commented Sep 15, 2019

Copy link
Copy Markdown

When I paste the upper code into the configuration, after I enter username and pass in firefox, webpages does not open. What could be wrong? Thanks

@gguest2021

Copy link
Copy Markdown

For future reference, relative paths work for me too. As follows:

auth_param basic program /lib/squid/basic_ncsa_auth.exe /etc/squid/ncsa_users.htpasswd
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all

Using Squid Server 3.5.28 installed with Diladele B.V.'s installer version 1.3.5.28.

please help me!! im using the version 4.1 Squid for windows Dialele :( :(

@sadminnp

sadminnp commented May 7, 2022

Copy link
Copy Markdown

it doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment