《2022年带用户验证的SQUID源码编译安装代理服务器教程.docx》由会员分享,可在线阅读,更多相关《2022年带用户验证的SQUID源码编译安装代理服务器教程.docx(10页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、2022年带用户验证的SQUID源码编译安装代理服务器教程摘要:带用户验证的SQUID源码编译安装b:08a74b3ab3首先升级openssl(为了系统更平安)/b:08a74b3ab3详见b:08a74b3ab3编译squid/b:08a74b3ab3./configure-prefix=/usr/local/squid-mandir=/usr/share/man-enable-carp-with-dl-enable-storeio=aufs,ufs,diskd,coss,null-with-pthreads-enable-icmp-enable-delay-pools-enable-us
2、eragent-log-enable-referer-log-enable-kill-parent-hack-enable-snmp-enable-arp-acl-enable-htcp-enable-ssl-with-openssl=/usr/local/openssl-0.9.7e-enable-external-acl-helpers=ip_user-enable-err-language=Simplify_Chinese-enable-err-language=Simplify_Chinese-enable-linux-netfilter-enable-auth=basic-enabl
3、e-baisc-auth-helpers=NCSA-enable-underscores-enable-x-accelerator-vary-disable-internal-dnsb:08a74b3ab3修改src/fs/aufs/store_asyncufs.h,使其可以用异步IO写文件,以提高存储速度将#defineASYNC_WRITE改为1/b:08a74b3ab3makemakeinstallb:08a74b3ab3进入helpers/basic_auth/NCSA,编译出nasa_auth/b:08a74b3ab3makemakeinstallb:08a74b3ab3利用apac
4、he里面的htpasswd生成密码文件/b:08a74b3ab3/path/htpasswd-c/etc/squid.passtest123123b:08a74b3ab3配置squid.conf/b:08a74b3ab3code:1:08a74b3ab3hierarchy_stoplistcgi-bin?aclQUERYurlpath_regexcgi-bin?no_cachedenyQUERYemulate_httpd_logonauth_parambasicprogram/usr/local/squid/libexec/ncsa_auth/etc/squid.passauth_paramb
5、asicchildren5auth_parambasicrealmPlatinumproxy-cachingserverauth_parambasiccredentialsttl1minutesauth_parambasiccasesensitiveoffrefresh_patternftp:&1440&20%&10080refresh_patterngopher:&1440&0%&1440refresh_pattern.&0&20%&4320cachemgr_passwdplatinumallaclallsrc0.0.0.0/0.0.0.0acllocalhostsrc127
6、.0.0.1/255.255.255.255aclto_localhostdst127.0.0.0/8aclAUTHUSERproxy_authREQUIREDhttp_accessallowAUTHUSERhttp_accessallowlocalhosthttp_accessallowto_localhosthttp_accessdeny&allhttp_reply_accessallowallicp_accessallowallcache_effective_usersquidvisible_hostnameplatinumhttpd_accel_hostplatinumhttpd_ac
7、cel_with_proxyonhttpd_accel_uses_host_headeronerror_directory/usr/local/squid/share/errors/Simplify_Chinesecoredump_dir/usr/local/squid/var/cachecache_diraufs/usr/local/squid/var/cache10016256cache_access_log/usr/local/squid/var/logs/access.logcache_log/usr/local/squid/var/logs/cache.logcache_store_
8、log/usr/local/squid/var/logs/store.logcache_mem32MB/code:1:08a74b3ab3b:08a74b3ab3创建交换文件/b:08a74b3ab3useraddsquid-s/sbin/nologinmkdir-p/usr/local/squid/var/cachechown-Rsquid.squid/usr/local/squid/var/usr/local/squid/sbin/squid-zb:08a74b3ab3运行squid/b:08a74b3ab3/usr/local/squid/sbin/squid若使开机自动运行,在/etc
9、/rc.local里添加即可color=red:08a74b3ab3留意:用户认证模式不能与透亮模式一起运用,否则会出错,用户验证无法通过/color:08a74b3ab3ljily000 回复于:2022-03-13 12:54:28对每个用户能否绑定一个ip,该用户只能在指定ip的机器上通过squid代理出去。platinum 回复于:2022-03-13 14:00:35可以用acl限制也可以结合iptables来实现wingger 回复于:2022-03-13 18:14:42ExternalACLssquid2.5版本,有一个ACL扩展功能ip_user,应当可以满意你的要求如:可能
10、安装的时候要编译进去code:1:2707935133./configureenable-external-acl-helpers=ip_user/code:1:2707935133配置时要在squid.conf加入如下一行:code:1:2707935133external_acl_typeip_user_helper%SRC%LOGINusr/local/squid/libexec/ip_user-f/usr/local/squid/etc/ip_user.confaclAclNameexternalip_user_helper/code:1:2707935133%SRC指客户IP地址,%
11、LOGIN指用户名.在ip_user.conf中的配置格式如下:ip_addr/maskuser|group|ALL|NONE例如:code:1:2707935133127.0.0.1ALL192.168.1.0/24bob10.8.1.0/24lusers172.16.0.0/16NONE/code:1:2707935133上面的语句意思如下(我就不翻译了):Thisconfigurationfilecausesip_usertoreturnOKforanyrequestcomingfrom127.0.0.1,forBobsrequestscomingfromthe192.168.1.0/2
12、4network,foranynameinthelusergroupwhentherequestcomesfromthe10.8.1.0/24network,andreturnsERRforanyrequestfromthe172.16.0.0/16network.ItalsoreturnsERRforanyaddressandusernamepairthatdoesntappearinthelist.段誉 回复于:2022-03-13 18:26:41受教,学习ingljily000 回复于:2022-03-22 14:15:42quote:c478550dd1=wingger上面的语句意思
13、如下(我就不翻译了):Thisconfigurationfilecausesip_usertoreturnOKforanyrequestcomingfrom127.0.0.1,forBobsrequestscomingfromthe192.168.1.0/24network,foranyna./quote:c478550dd1:P:Pcode:1:c478550dd1[code]external_acl_typeip_user_helper%SRC%LOGINusr/local/squid/libexec/ip_user-f/usr/local/squid/etc/ip_user.confaclAclNameexternalip_user_helper[/code]/code:1:c478550dd1似乎差点东西:P,code:1:c478550dd1external_acl_typeip_user_helper%SRC%LOGIN/usr/local/squid/libexec/ip_user_check-f/usr/local/squid/etc/ip_user.confaclAclNameexternalip_user_helper/code:1:c478550dd1找了好半天!:em06:
限制150内