[EN] Squid with MySQL user authentication
1 2 | apt-get update; apt-get install squid3 cd /etc/squid3 |
RHEL-like (Red Hat/Fedora/CentOS):
1 2 | yum install squid cd /etc/squid |
For all (deb+rpm-based):
1 2 | mv squid.conf squid.conf.default vi squid.conf |
squid.conf:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #Uncomment for transparent proxy #http_port 3128 transparent # http_port 3128 acl localhost src 127.0.0.0/8 http_access allow localhost cache_dir ufs /var/spool/squid3/ 3500 8 128 auth_param basic program /usr/lib/squid3/squid_db_auth --user squiduser --password password --plaintext --persist auth_param basic children 5 auth_param basic realm Need login and password. auth_param basic credentialsttl 1 minute auth_param basic casesensitive off acl db-auth proxy_auth REQUIRED http_access allow db-auth http_access allow localhost http_access deny all dns_defnames off dns_v4_first on dns_nameservers 8.8.8.8 |
Configure MySQL database:
1 | mysql -p |
1 2 | CREATE DATABASE squid; GRANT SELECT ON squid.* TO squiduser @localhost IDENTIFIED BY 'password'; |
1 2 3 4 5 6 7 8 9 | use squid; CREATE TABLE `passwd` ( `user` varchar(32) NOT NULL default '', `password` varchar(35) NOT NULL default '', `enabled` tinyint(1) NOT NULL default '1', `fullname` varchar(60) default NULL, `comment` varchar(60) default NULL, PRIMARY KEY (`user`) ); |
Add new user:
1 | insert into passwd values('rcstar','rcstar',1,'Admin','Admin user'); |
Ready.
Ви маєте увійти, щоб оприлюднити коментар.