harbor run -t LiteCoder/setup-squid-proxy-restrictionsharbor download LiteCoder/setup-squid-proxy-restrictionsSet up a Squid HTTP/HTTPS proxy server on Ubuntu that restricts access based on client IP subnet and time of day, then verify the configuration.
Install Squid
squid./etc/squid/squid.confBackup Original Configuration
/etc/squid/squid.conf.bak before making any changes.Configure Access Control Lists (ACLs)
company_net for the subnet 10.0.0.0/24.work_hours that permits access Monday through Friday, 09:00–18:00./etc/squid/squid.conf.Configure Access Rules
http_access allow rule that requires both company_net AND work_hours to be satisfied simultaneously.http_access deny all rule to block all other traffic.3128.Start and Verify Squid
3128.Test the Proxy
curl if not already present.http://localhost:3128) and record results:
192.168.1.0/24). This should be denied (HTTP 403).Write Test Results
/app/test_results.json with the following structure:
{
"squid_installed": true,
"config_backup_exists": true,
"acl_company_net_defined": true,
"acl_work_hours_defined": true,
"http_access_rules_configured": true,
"squid_running": true,
"squid_listening_on_3128": true,
"test_allowed_access": "pass",
"test_denied_by_ip": "pass",
"test_denied_by_time": "pass"
}
true if the corresponding check passed, false otherwise.test_* field should be "pass" if the test produced the expected result, "fail" otherwise.Clean Up
/etc/squid/squid.conf.bak back to /etc/squid/squid.conf.service squid start or start Squid directly)./app.