squid 要設定 ncsa_auth 認證其實不難, 有趣的是我們也可以利用 myport 來產生一個 acl
squid 的 acl 跟 iptalbes 的 rule 很像, first match first apply. 所以我們可以設定從某些 port 來的 request 不需要密碼驗證, 其他的則必須要密碼驗證。另外也可以加入允許連連線的來源網址,只要注意規則的順序就好囉!
# Deny others ...
squid 的 acl 跟 iptalbes 的 rule 很像, first match first apply. 所以我們可以設定從某些 port 來的 request 不需要密碼驗證, 其他的則必須要密碼驗證。另外也可以加入允許連連線的來源網址,只要注意規則的順序就好囉!
# vi /etc/squid/squid.conf http_port = 3128 # listensing port Bhttp_port = 9999 # listensing port B # Enable ncsa_auth (htpasswd -c /etc/squid/passwd username)auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off # Add filter for ncsa authacl lab_lan src 172.18.0.0/22 172.18.4.0/22 # multiple CIDR networkacl ncsa_users proxy_auth REQUIREDacl no_auth myport 9999http_access allow no_auth lab_lan http_access allow ncsa_users lab_lan# Deny others ...
http_access deny all
留言
張貼留言