Install Squid 3 Server and Add Password Authentication

首先安裝 Squid 3

apt-get install squid3

把原本的 /etc/squid3/squid.conf 備份後,建立下面這個檔案

http_port 3128

auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/.passwd
auth_param basic children 1
auth_param basic credentialsttl 1 minute
auth_param basic casesensitive off

acl auth proxy_auth REQUIRED
acl localhost src

http_access allow auth
# 透過密碼認證
http_access allow localhost
# 本地端不用認證
http_access deny all
# 其他來源都不行

cache deny all

forwarded_for delete
request_header_access Via deny all

建立一個使用這帳戶,以供 proxy 認證使用

htpasswd -c /etc/squid3/.passwd {user_name}

重起 suqid3 即可

/etc/init.d/squid3 restart

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.