Squid
Install
pkg install squid pkg install htdigest sysrc squid_enable="YES"
Auth
There are two ways to specify the password auth, htdigest
or htpasswd
.
htdigest
/usr/local/etc/squid/squid.conf
auth_param basic program /usr/local/libexec/squid/basic_ncsa_auth /usr/local/etc/squid/password auth_param basic realm proxy auth_param basic casesensitive
apache-htdigest -c /usr/local/etc/squid/password realm username # or htdigest if apache-htdigest is not found
php -a echo 'user': . crypt('password', base64_encode('password'));
htpasswd
/usr/local/etc/squid/squid.conf
auth_param digest realm proxy auth_param digest program /usr/local/libexec/squid/digest_file_auth -c /usr/local/etc/squid/password
htpasswd -c /usr/local/etc/squid/password username
ACL
/usr/local/etc/squid/squid.conf
acl users proxy_auth REQUIRED acl ncku src 140.116.0.0/16 http_access deny !ncku http_access allow users http_port 3128
Check config
squid -f /usr/local/etc/squid/squid.conf -k parse
Start service
service squid start