Install Squid Proxy:
First, install Squid Proxy server:
Configure Squid Proxy:
Edit the Squid configuration file to configure URL filtering:
sudo nano /etc/squid/squid.conf
Add or uncomment the following lines to enable URL filtering:
acl block_sites dstdomain "/etc/squid/block_sites.acl"
http_access deny block_sites
Save the changes and exit the editor.
Create Keyword List:
Create a file containing keywords that you want to block:
sudo nano /etc/squid/block_sites.acl
Add the keywords, each on a separate line:
Save the changes and exit the editor.
Update Permissions:
Ensure that Squid has the necessary permissions to read the ACL file:
sudo chown -R proxy:proxy /etc/squid/block_sites.acl
Restart Squid:
Restart the Squid service to apply the changes:
sudo systemctl restart squid
Test the Configuration:
Test the configuration by attempting to access websites containing the specified keywords from a web browser. If the configuration is correct, access to these websites should be blocked.
To disable the keyword-based blocking, you can simply remove or comment out the relevant lines in the Squid configuration file (/etc/squid/squid.conf
), restart the Squid service, and delete the keyword list file (/etc/squid/block_sites.acl
).
Leave a Reply