Skip to content

Instantly share code, notes, and snippets.

@yvanin
Last active December 16, 2022 10:27
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save yvanin/ef831720112c1f6ee8c3 to your computer and use it in GitHub Desktop.
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

@snehal31590
Copy link

Hi,
From where should I be getting basic_ncsa_auth file. Please reply asap.

Thanks,
Snehal

@snehal31590
Copy link

I have got it but it isnt working for me

@madnut-ua
Copy link

Works great for me, thanks!

@khalidimran
Copy link

you will created with cmd :D and it shoud working

@luisaceituno
Copy link

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
Copy link

skljoc commented Sep 15, 2019

Why dont you share full configuration file? Please

@skljoc
Copy link

skljoc commented Sep 15, 2019

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

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 :( :(

@krishnastunning
Copy link

it doesn't work

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