You need to edit the '/etc/squid/squid.conf' file to these changes.
First we need to defined our local network (eg : 192.168.2.0/24 ). To do that we can edit the 'acl localnet src * ' line in the config file to;
acl localnet src 192.168.2.0/24
Then we assume that we need to block youtube access within working hours to all uses in the network. Therefore, we need to set the working hours in the configurations file. This configuration should come soon after defining 'Safe_ports'.
acl officehours time M T W H F 8:00-17:00
Now you can give the host name of the host machine by;
If anyone need to access youtube within office hours we need to have a option for that. For an example, we can set a youtbe allowed IP range and/or some individual IP addressed like this.
acl allowyoutube src 192.168.2.21-192.168.2.40 acl allowyoutube src 192.168.2.75 acl allowyoutube src 192.168.2.65
Now we can block youtube to all users except special users by setting;
acl youtube dstdomain .youtube.com http_access deny CONNECT youtube !allowyoutube officehours http_access deny youtube !allowyoutube officehours # deny access to not safe and non-ssl ports http_access deny !Safe_ports http_access deny CONNECT !SSL_ports # allow only local network http_access allow localnet http_access deny all
Then restart the squid service and see the logs on ' /var/log/squid/ ' for more information.