squid代理加用戶認證


squid代理加用戶認證

 

用authentication helpers添加身份驗證

有如下幾種認證方式 :
=> NCSA: Uses an NCSA-style username and password file.
=> LDAP: Uses the Lightweight Directory Access Protocol
=> MSNT: Uses a Windows NT authentication domain.
=> PAM: Uses the Linux Pluggable Authentication Modules scheme.
=> SMB: Uses a SMB server like Windows NT or Samba.
=> getpwam: Uses the old-fashioned Unix password file.
=> SASL: Uses SALS libraries.
=> NTLM, Negotiate and Digest authentication

配置NCSA 認證


一、創建認證用戶名/密碼,用htpasswd

  1. #htpasswd  /etc/squid/passwd user1

輸入密碼
New password:
Re-type new password:

二、確定squid是否支持authentication helper

yum 安裝的

  1. #rpm -ql squid | grep ncsa_auth

輸出:
/usr/lib64/squid/ncsa_auth


三、配置SQUID認證
# vi /etc/squid/squid.conf

加入驗證部分內容:

  1. auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd     //定義squid密碼文件與ncsa_auth文件位置
  2. auth_param basic children 15          //認證進程的數量
  3. auth_param basic realm Squid proxy-caching web server
  4. auth_param basic credentialsttl 2 hours        //認證有效期
  5. auth_param basic casesensitive off             //用戶名不區分大小寫,可改為ON區分大小寫

添加 acl 驗證用戶:

  1. acl ncsa_users proxy_auth REQUIRED
  2. http_access allow ncsa_users

四、重啟squid生效
# /etc/init.d/squid restart


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM