Sunday, April 19, 2009

Freebsd Proxy Server using Squid with NCSA Authentication

1. Install squid under /usr/ports/www/squid

2. Then under console, create cache with the following command



      mymachine#cd /usr/local/etc
        mymachine#chown nobody:nogroup squid/*/*/*

           mymachine#/usr/local/sbin/squid –z

3. Create password with htpasswd tools :

       mymachine#htpasswd –c /usr/local/etc/squid/passwd netadmin
     Then type in the password for user netadmin 

4. Modify /usr/local/etc/squid/squid.conf with contents below:

auth_param basic program /usr/local/libexec/squid/ncsa_auth /usr/local/etc/squid
auth_param basic children 5
auth_param basic realm Please enter the username and password
auth_param basic credentialsttl 2 hours
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

5. Then type /usr/local/sbin/RunCache under console, 
     If nothing goes wrong, your proxy is good to go!

Log is under/usr/local/squid/logs


Post a Comment