Difference between revisions of "Squid with authentication on Centos 6"

From vpsget wiki
Jump to: navigation, search
Line 21: Line 21:
 
</pre>
 
</pre>
 
Now when EPEL is installed you can install squid as shown above.<br/>
 
Now when EPEL is installed you can install squid as shown above.<br/>
Before setting up the authentication, test basic squid functionality. It has to work without requiring authorization.</br>
+
Before setting up the authentication, test basic squid functionality. It has to work without requiring authorization.<br/>
 +
Create user:
 +
<pre>
 +
htpasswd /etc/squid/passwd user1
 +
</pre>
 +
This command creates file ''passwd''. In this file will be stored NCSA users and passwords.<br/>
 +
Output:
 +
<pre>
 +
New password:
 +
Re-type new password:
 +
Adding password for user user1
 +
</pre>
 +
If '''htpasswd''' command is not recognized, make sure you have httpd ''installed'':
 +
<pre>
 +
yum install httpd
 +
</pre>
 +
Make sure squid can read ''/etc/squid/passwd'':
 +
<pre>
 +
chmod o+r /etc/squid/passwd
 +
</pre>

Revision as of 14:31, 4 April 2013

There are several authentication helpers, squid can work with. I this guide we will set up ncsa_auth helper.
Install squid if you haven't it installed yet:

yum install squid

If there is any problem with installing squid - install EPEL repo:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Enable the remi repository by opening file /etc/yum.repos.d/remi.repo and set enabled=1

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

Now when EPEL is installed you can install squid as shown above.
Before setting up the authentication, test basic squid functionality. It has to work without requiring authorization.
Create user:

htpasswd /etc/squid/passwd user1

This command creates file passwd. In this file will be stored NCSA users and passwords.
Output:

New password:
Re-type new password:
Adding password for user user1

If htpasswd command is not recognized, make sure you have httpd installed:

yum install httpd

Make sure squid can read /etc/squid/passwd:

chmod o+r /etc/squid/passwd