GIT – in and Enable Authetication

Why squid:

Squid is a proxy server which lets you browse websites through a proxy. Using a proxy, you can:

1) browse websites blocked by your ISP.

2) browse websites and your Service provider wont know which all websites you browsed.

3) browse securely

Installation:

How to install squid in :

sudo apt-get install squid

/etc/init.d/squid start

How to install squid in /Redhat and Fedora:

yum install squid

/etc/init.d/squid start

How to enable password authentication in squid:

Squid support many auth programs. We will use ncsa_auth in this article to configure password authentication. The ncsa_auth program will read the encrypted password created by htpasswd (htpasswd is a package installed by default with apache) and authenticate users.

We are going to add a user “squser” using htpasswd. We also need to define a password file which we need to specify in squid configuration. Lets create a file /etc/squid/squid_passwd for saving passwords.

1) Create the password file /etc/squid/squid_passwd

touch /etc/squid/squid_passwd

2) Add user “squser” with password “sqpassword”

htpasswd /etc/squid/squid_passwd squser

Enter the password when prompted. Now if you check the file /etc/squid/squid_passwd , you’ll see that user is added.

3) Now locate the ncsa_auth library. The lib folder of squid is normally /usr/lib/squid/ . You can confirm the same using a locate command.

locate ncsa_auth

You’ll get an output with correct path to ncsa_auth library. Normally it will be /usr/lib/squid/ncsa_auth

4) Well, we have added the user and located the ncsa_auth library. Now we need to insist squid to use ncsa_auth program to authenticate users. You have to add following lines to /etc/squid/squid.conf. Please note that the order of the following lines are very important. If its not in order, the settings wont work correctly.

At the bottom of the section “TAG: auth_param” ( which means just above the section “TAG: authenticate_cache_garbage_interval”), add:

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd

At the bottom of the section “TAG: acl” (Just above the section “TAG: http_access”), add:

acl ncsa_users proxy_auth REQUIRED

At the beginning of the section “TAG: http_access” (which means following line needs to be added above all other “http_access” directives), add:

http_access allow ncsa_users

5) Restart squid and you’re done!

/etc/init.d/squid restart

Print Friendly, PDF & Email

Comments

comments

Bài viết liên quan