配置文件如下:

  1. http_port 8080

  2. #auth ldap

  3. auth_param basic program /usr/local/squid/libexec/basic_ldap_auth -R -b "dc=test,dc=net" -D "cn=Administrator,cn=Users,dc=test,dc=net" -w "xxxx" -f sAMAccountName=%s -h 192.168.1.8

  4. #192.168.1.8 是AD; administrator和xxxx是此AD的用户名和密码

  5. auth_param basic children 5

  6. auth_param basic realm test.net

  7. auth_param basic credentialsttl 5 minutes

  8. acl test proxy_auth REQUIRED

  9. http_access allow test

  10. acl CONNECT method CONNECT

  11. redirect_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.conf

  12. cache_dir ufs /usr/local/squid/var/cache/squid 1024 16 256

  13. coredump_dir /usr/local/squid/var/cache/squid

  14. refresh_pattern ^ftp:           1440    20%     10080

  15. refresh_pattern ^gopher:        1440    0%      1440

  16. refresh_pattern -i (/cgi-bin/|\?) 0     0%      0

  17. refresh_pattern .               0       20%     4320

  18. cache_effective_user squid

  19. cache_effective_group squid

  20. visible_hostname Firewall



如果要在squidGuard里启用LDAP认证,那squid里首先得启用LDAP认证.

具体代码就按官方的(删除了CN=...)


ldap://ldap.example.net/cn=administrator,ou=People,dc=example,dc=net?memberUid?sub(&(objectclass=posixGroup)(memberUid=%s))