squid+mysql
Posted On 2008年11月8日星期六 at 时间: 21:52:00 by David Lusquid 用户认证
htpasswd /etc/squid/passwd test
chown root:squid /etc/squid/passwd
chmod 640 /etc/squid/passwd
acl INTERNAL src 192.168.0.0/24
acl AUTHUSERS proxy_auth REQUIRED
http_access allow INTERNAL AUTHUSERS
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid - Home Proxy Server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
service squid reload
squid+mysql 认证
yum install gcc mysql mysql-server mysql-devel y
wget http://people.arxnet.hu/airween/mysql_auth/mysql_auth-0.8.tar.gz
tar zxf mysql_auth-0.8.tar.gz
cd mysql_auth-0.8
修改 Makefile
CFLAGS = -I /usr/include/mysql -L/usr/lib/mysql
$(INSTALL) -o squid -g squid -m 755 mysql_auth /usr/local/libexec/mysql_auth
$(INSTALL) -o root -g root -m 700 mypasswd /usr/local/bin/mypasswd
$(INSTALL) -o squid -g squid -m 600 $(CONF) /usr/local/etc/mysql_auth.conf
$(INSTALL) -o squid -g squid -m 600 $(CONF) /usr/local/etc/mysql_auth.conf.default
修改 src/mysql_auth.conf
mysqld_socket /var/lib/mysql/mysql.sock
修改 src/mypassword.c
#include
修改 src/mysql_auth.c
#include
make && make install
cd scripts/
mysql <>
mypasswd test test
测试用户
mysql_auth
test test
OK!
在/etc/squid/squid.conf 中增加 mysql_auth 认证
添加下面的代码到"TAG: acl"一节的后面
auth_param basic program /usr/local/bin/mysql_auth
auth_param basic realm Squid caching server
auth_param basic children 5
auth_param basic credentialsttl 2 hours
acl password proxy_auth REQUIRED
http_access allow password
service squid start
--
知行合一