{"id":5942,"date":"2020-06-02T23:03:16","date_gmt":"2020-06-02T20:03:16","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5942"},"modified":"2024-03-14T21:58:48","modified_gmt":"2024-03-14T18:58:48","slug":"install-and-setup-squid-proxy-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-squid-proxy-on-ubuntu-20-04\/","title":{"rendered":"Install and Setup Squid Proxy on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this tutorial, we are going to learn how to install and setup Squid Proxy on Ubuntu 20.04.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"http:\/\/www.squid-cache.org\/\" target=\"_blank\">Squid<\/a>&nbsp;is a full-featured web proxy cache application which provides proxy and cache services for HTTP, FTP, SSL requests and DNS lookups. It also performs transparent caching that reduces bandwidth and improves response time by caching and reusing frequently requested web pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Squid Proxy on Ubuntu 20.04<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Run system update<\/h3>\n\n\n\n<p>To begin with, ensure that your system packages are up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update\napt upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Squid Proxy<\/h3>\n\n\n\n<p>Squid proxy is available on the default Ubuntu 20.04 repositories.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt-cache policy squid<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>squid:\n  Installed: (none)\n  Candidate: 4.10-1ubuntu1.1\n  Version table:\n     4.10-1ubuntu1.1 500\n        500 http:\/\/ke.archive.ubuntu.com\/ubuntu focal-updates\/main amd64 Packages\n        500 http:\/\/ke.archive.ubuntu.com\/ubuntu focal-security\/main amd64 Packages\n     4.10-1ubuntu1 500\n        500 http:\/\/ke.archive.ubuntu.com\/ubuntu focal\/main amd64 Packages<\/code><\/pre>\n\n\n\n<p>Therefore, you can install it by running the command and can be installed by running the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install squid<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Running Squid on Ubuntu 20.04<\/h3>\n\n\n\n<p>When installed, Squid is started and enabled to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status squid<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n\u25cf squid.service - Squid Web Proxy Server\n     Loaded: loaded (\/lib\/systemd\/system\/squid.service; enabled; vendor preset: enabled)\n     Active: active (running) since Fri 2020-05-29 14:00:41 UTC; 10min ago\n       Docs: man:squid(8)\n   Main PID: 2237 (squid)\n      Tasks: 4 (limit: 2282)\n     Memory: 16.3M\n     CGroup: \/system.slice\/squid.service\n             \u251c\u25002237 \/usr\/sbin\/squid -sYC\n             \u251c\u25002239 (squid-1) --kid squid-1 -sYC\n             \u251c\u25002240 (logfile-daemon) \/var\/log\/squid\/access.log\n             \u2514\u25002241 (pinger)\n\nMay 29 14:00:41 ubuntu20 squid[2239]: Using Least Load store dir selection\nMay 29 14:00:41 ubuntu20 squid[2239]: Set Current Directory to \/var\/spool\/squid\nMay 29 14:00:41 ubuntu20 squid[2239]: Finished loading MIME types and icons.\nMay 29 14:00:41 ubuntu20 squid[2239]: HTCP Disabled.\nMay 29 14:00:41 ubuntu20 squid[2239]: Pinger socket opened on FD 14\nMay 29 14:00:41 ubuntu20 squid[2239]: Squid plugin modules loaded: 0\nMay 29 14:00:41 ubuntu20 squid[2239]: Adaptation support is off.\nMay 29 14:00:41 ubuntu20 squid[2239]: Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 12 flags=9\nMay 29 14:00:42 ubuntu20 squid[2239]: storeLateRelease: released 0 objects\n...\n<\/code><\/pre>\n\n\n\n<p>To check if enabled to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl is-enabled squid.service<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>enabled<\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configuring Squid Proxy Server on Ubuntu 20.04<\/h3>\n\n\n\n<p><code>\/etc\/squid\/squid.conf<\/code>&nbsp;is the default Squid Proxy configuration. The configuration has the recommended minimum settings. However, we will modify this configuration to make a few changes. You can also have other configurations under <code><strong>\/etc\/squid\/conf.d\/<\/strong><\/code> directory.<\/p>\n\n\n\n<p>Make a backup of the default configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cp \/etc\/squid\/squid.conf{,.old}<\/code><\/pre>\n\n\n\n<p>By default, the Squid configuration file looks like as shown below (with comments removed);<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nacl localnet src 0.0.0.1-0.255.255.255\t# RFC 1122 \"this\" network (LAN)\nacl localnet src 10.0.0.0\/8\t\t# RFC 1918 local private network (LAN)\nacl localnet src 100.64.0.0\/10\t\t# RFC 6598 shared address space (CGN)\nacl localnet src 169.254.0.0\/16 \t# RFC 3927 link-local (directly plugged) machines\nacl localnet src 172.16.0.0\/12\t\t# RFC 1918 local private network (LAN)\nacl localnet src 192.168.0.0\/16\t\t# RFC 1918 local private network (LAN)\nacl localnet src fc00::\/7       \t# RFC 4193 local private network range\nacl localnet src fe80::\/10      \t# RFC 4291 link-local (directly plugged) machines\nacl SSL_ports port 443\nacl Safe_ports port 80\t\t# http\nacl Safe_ports port 21\t\t# ftp\nacl Safe_ports port 443\t\t# https\nacl Safe_ports port 70\t\t# gopher\nacl Safe_ports port 210\t\t# wais\nacl Safe_ports port 1025-65535\t# unregistered ports\nacl Safe_ports port 280\t\t# http-mgmt\nacl Safe_ports port 488\t\t# gss-http\nacl Safe_ports port 591\t\t# filemaker\nacl Safe_ports port 777\t\t# multiling http\nacl CONNECT method CONNECT\nhttp_access deny !Safe_ports\nhttp_access deny CONNECT !SSL_ports\nhttp_access allow localhost manager\nhttp_access deny manager\ninclude \/etc\/squid\/conf.d\/*\nhttp_access allow localhost\nhttp_access deny all\nhttp_port 3128\ncoredump_dir \/var\/spool\/squid\nrefresh_pattern ^ftp:\t\t1440\t20%\t10080\nrefresh_pattern ^gopher:\t1440\t0%\t1440\nrefresh_pattern -i (\/cgi-bin\/|\\?) 0\t0%\t0\nrefresh_pattern \\\/(Packages|Sources)(|\\.bz2|\\.gz|\\.xz)$ 0 0% 0 refresh-ims\nrefresh_pattern \\\/Release(|\\.gpg)$ 0 0% 0 refresh-ims\nrefresh_pattern \\\/InRelease$ 0 0% 0 refresh-ims\nrefresh_pattern \\\/(Translation-.*)(|\\.bz2|\\.gz|\\.xz)$ 0 0% 0 refresh-ims\nrefresh_pattern .\t\t0\t20%\t4320\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Squid Access Control Policies<\/h4>\n\n\n\n<p>If you already noticed, the above configuration file has ACLs for specific networks and safe ports. You can modify them to include your safe ports as well as the your local networks whose Squid should proxy for.<\/p>\n\n\n\n<p>When defining an ACL, each and every one of them must begin with an <code>acl name<\/code> and <code>acl type<\/code> followed by either type-specific arguments or a quoted filename that they are read from;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>acl aclname acltype argument ...<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>acl aclname acltype \"file\" ...<\/code><\/pre>\n\n\n\n<p>When using &#8220;<code><strong>file<\/strong><\/code>&#8220;, the file should contain one item per line.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/squid\/squid.conf<\/code><\/pre>\n\n\n\n<p>In this tutorial, we will create an ACL for our LAN network, <code><strong>192.168.57.0\/24<\/strong><\/code>. We append this line just above the SSL ports ACL. <strong>Replace the name of the ACL and the source network appropriately. <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>acl localnet src fc00::\/7       \t# RFC 4193 local private network range\nacl localnet src fe80::\/10      \t# RFC 4291 link-local (directly plugged) machines\n<strong># My LAN network ACL\nacl kifarunix-demo-net src 192.168.57.0\/24<\/strong>\n...<\/code><\/pre>\n\n\n\n<p>Read more about ACL configuration directives on <a rel=\"noreferrer noopener\" href=\"http:\/\/www.squid-cache.org\/Doc\/config\/acl\/\" target=\"_blank\">Squid Wiki page<\/a>.<\/p>\n\n\n\n<p><strong>You can comment out (adding # at the beginning of the lines) the default ACLs.<\/strong><\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n# Example rule allowing access from your local networks.\n# Adapt to list your (internal) IP networks from where browsing\n# should be allowed\n#acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 \"this\" network (LAN)\n#acl localnet src 10.0.0.0\/8            # RFC 1918 local private network (LAN)\n#acl localnet src 100.64.0.0\/10         # RFC 6598 shared address space (CGN)\n#acl localnet src 169.254.0.0\/16        # RFC 3927 link-local (directly plugged) machines\n#acl localnet src 172.16.0.0\/12         # RFC 1918 local private network (LAN)\n#acl localnet src 192.168.0.0\/16                # RFC 1918 local private network (LAN)\n#acl localnet src fc00::\/7              # RFC 4193 local private network range\n#acl localnet src fe80::\/10             # RFC 4291 link-local (directly plugged) machines\n# My LAN network ACL\nacl kifarunix-demo-net src 192.168.57.0\/24\n...\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Allow or Deny Access Based on defined ACL<\/h4>\n\n\n\n<p>Once you have the ACL in place, you can then use the <code><strong>http_access<\/strong><\/code>&nbsp;directive to define the ACL allowed or denied to use the proxy to access external network. Therefore, to allow our network, defined by our ACL, <strong>kifarunix-demo-net<\/strong>, external access, add the line below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n#http_access allow localnet\nhttp_access allow localhost\n\n<strong># Allow kifarunix-demo-net\nhttp_access allow kifarunix-demo-net<\/strong>\n\n# And finally deny all other access to this proxy\nhttp_access deny all<\/code><\/pre>\n\n\n\n<p>The last entry should always be&nbsp;<code><strong>http_access deny all<\/strong><\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deny Access to Specific Websites<\/h3>\n\n\n\n<p>Access to specific websites can be restricted using Squid Proxy. For example to block access to youtube, facebook, netflix;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>you would have to create a file that defines the domains of these websites as shown below;<\/li>\n\n\n\n<li>or you would list the domain names, space separated on the ACL statement.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/squid\/denied-sites.squid<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>.youtube.com\n.facebook.com\n.netflix.com<\/code><\/pre>\n\n\n\n<p>Next, create an ACL for the restricted sites above in the squid configuration file and set the&nbsp;<strong>deny<\/strong>&nbsp;rule for the defined ACL.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>acl deniedsites dstdomain \"\/etc\/squid\/denied-sites.squid\"<\/strong><\/code><\/pre>\n\n\n\n<p>Or you can list the sites domain;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>acl deniedsites dstdomain<\/strong> <strong>youtube.com facebook.com netflix.com<\/strong><\/code><\/pre>\n\n\n\n<p>Update squid configuration file.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n#\n# My LAN network ACL\nacl kifarunix-demo-net src 192.168.57.0\/24\n## Sites to Block access to ###\n<strong>acl deniedsites dstdomain \"\/etc\/squid\/denied-sites.squid\"<\/strong>\n...\n...\n# Deny access to facebook, youtube, netflix\n<strong>http_access deny deniedsites<\/strong>\n\n# Allow kifarunix-demo-net\n<strong>http_access allow kifarunix-demo-net<\/strong>\n\n# And finally deny all other access to this proxy\nhttp_access deny all\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Block Sites based on Specific Keywords<\/h3>\n\n\n\n<p>You can also restrict access to a website by the use of a keyword. Create a file with specific keywords as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/squid\/banned-keywords.squid<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>porn\nads\nmovie\ngamble<\/code><\/pre>\n\n\n\n<p>Make the necessary changes on squid configuration file.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n#\n# My LAN network ACL\nacl kifarunix-demo-net src 192.168.57.0\/24\n...\nacl CONNECT method CONNECT\n<strong># ACL for Sites to Block Access to\nacl deniedsites dstdomain \"\/etc\/squid\/denied-sites.squid\"\nacl keyword-ban url_regex -i \"\/etc\/squid\/keyword-ban.squid\"\n...\n# http_access allow localnet\nhttp_access allow localhost\n# Deny access to facebook, youtube, netflix\nhttp_access deny deniedsites\n# Deny access based on keywords\nhttp_access deny keyword-ban\n# Allow kifarunix-demo-net\nhttp_access allow kifarunix-demo-net<\/strong>\n\n# And finally deny all other access to this proxy\nhttp_access deny all\n<\/code><\/pre>\n\n\n\n<p><strong>NOTE<\/strong>: <code>http_access<\/code>&nbsp;entries are processed from top to bottom and depending on which occurs first, access is allowed or denied.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Masking Outgoing Traffic<\/h3>\n\n\n\n<p>As much as you use proxy server to anonymize your IP addresses by presenting the IP address of the proxy to other web servers, proxy servers may expose your IP addresses on the outgoing HTTP requests. You can however disable this by including the following directives at the end of your squid configuration file.<\/p>\n\n\n\n<p>Disable Via headers in requests and replies by locating the line, <code><strong># via on<\/strong><\/code>, uncomment and set its value to <strong><code>off<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Default:\n# via on\n<strong>via off<\/strong><\/code><\/pre>\n\n\n\n<p>Configure Squid not to append your client&#8217;s IP address in the HTTP requests it forwards by uncommenting the line, <code># forwarded_for on<\/code>, and setting the value to <code>off<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Default:\n# forwarded_for on\n<strong>forwarded_for off<\/strong><\/code><\/pre>\n\n\n\n<p>Remove Squid proxy headers to avoid revealing identity of Squid proxy server. You can add the lines below under the section, <code><strong># TAG: request_header_access<\/strong><\/code>.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n<strong>request_header_access From deny all\nrequest_header_access Server deny all\nrequest_header_access WWW-Authenticate deny all\nrequest_header_access Link deny all\nrequest_header_access Cache-Control deny all\nrequest_header_access Proxy-Connection deny all\nrequest_header_access X-Cache deny all\nrequest_header_access X-Cache-Lookup deny all\nrequest_header_access Via deny all\nrequest_header_access X-Forwarded-For deny all\nrequest_header_access Pragma deny all\nrequest_header_access Keep-Alive deny all<\/strong>\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Change Squid Default Port<\/h3>\n\n\n\n<p>Squid proxy listens on&nbsp;<code>TCP port 3128<\/code>&nbsp;by default. To change this port, open the&nbsp;<code>\/etc\/squid\/squid.conf<\/code>&nbsp;configuration file and replace the value of the&nbsp;<code>http_port<\/code>&nbsp;with your desired port number.<\/p>\n\n\n\n<p>For example, to change the default port to 8888, as long as no other application is listening on the same port;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n# Squid normally listens to port 3128\n# http_port 3128                 <strong>&lt;&lt; Comment the line by adding #<\/strong>\n<strong>http_port 8888<\/strong>\n...<\/code><\/pre>\n\n\n\n<p>You can also set it to listen on a specific IP (<strong>Replace the IP address accordingly<\/strong>)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>http_port 192.168.57.8:<\/strong>3128<\/code><\/pre>\n\n\n\n<p>Save and exit the configuration file once you are done with the configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&nbsp;Check Squid Configuration File for Errors<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>squid -k parse<\/code><\/pre>\n\n\n\n<p>If there is any syntax error, the erroneous lines will be displayed. Be sure to run this command every time you modify your configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Restart Squid<\/h3>\n\n\n\n<p>Once you are done with the configuration, save the file and restart squid.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart squid<\/code><\/pre>\n\n\n\n<p>Check that Squid is listening on defined port. In this case, we didn&#8217;t change the default.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ss -altnp | grep 3128<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>LISTEN    0         256           192.168.57.8:3128             0.0.0.0:*        users:((\"squid\",pid=3808,fd=12))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Allow Squid Port on Firewall<\/h3>\n\n\n\n<p>If UFW is running, allow open squid proxy port;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow 3128\/tcp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Clients to Connect Through Proxy server<\/h3>\n\n\n\n<p>To configure end points to connect to internet via Squid proxy server, you can either set system wide proxy configurations, configure client to use the Squid proxy as the gateway or set the proxy settings on the browser.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"system-wide-proxy-settings-ubuntu\"><a href=\"#system-wide-proxy-settings-ubuntu\">System Wide proxy configuration on Ubuntu 20.04<\/a><\/h4>\n\n\n\n<p>To set system wide proxy configurations, create a configuration file under&nbsp;<code>\/etc\/profile.d<\/code>&nbsp;with environment variables defining squid proxy server details as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/profile.d\/squid.sh<\/code><\/pre>\n\n\n\n<p>Replace the IP address of the Squid server accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PROXY_URL=\"192.168.57.8:3128\"\nHTTP_PROXY=$PROXY_URL\nHTTPS_PROXY=$PROXY_URL\nFTP_PROXY=$PROXY_URL\nhttp_proxy=$PROXY_URL\nhttps_proxy=$PROXY_URL\nftp_proxy=$PROXY_URL\nexport HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy<\/code><\/pre>\n\n\n\n<p>After that, source the new configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>source \/etc\/profile.d\/squid.sh<\/code><\/pre>\n\n\n\n<p>To test this, try to download anything from the clients terminal while tailing access logs on squid proxy server.<\/p>\n\n\n\n<p>On the client\u2019s terminal, run;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>wget google.com<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>--2020-06-02 21:24:08--  http:\/\/google.com\/\n<strong>Connecting to 192.168.57.8:3128... connected.\n<\/strong>Proxy request sent, awaiting response... 301 Moved Permanently\nLocation: http:\/\/www.google.com\/ &#91;following]\n--2020-06-02 21:24:08--  http:\/\/www.google.com\/\nReusing existing connection to 192.168.57.8:3128.\nProxy request sent, awaiting response... 200 OK\nLength: unspecified &#91;text\/html]\nSaving to: \u2018index.html.4\u2019\n\nindex.html.4                                   &#91; &lt;=&gt;                                                                                     ]  12.36K  --.-KB\/s    in 0.01s   \n\n2020-06-02 21:24:08 (971 KB\/s) - \u2018index.html.4\u2019 saved &#91;12657]<\/code><\/pre>\n\n\n\n<p>On the Squid proxy server;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>tail -f \/var\/log\/squid\/access.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>1591122302.356      0 192.168.57.10 TCP_MEM_HIT\/301 629 GET http:\/\/google.com\/ - HIER_NONE\/- text\/html\n1591122302.642    282 192.168.57.10 TCP_MISS\/200 13538 GET http:\/\/www.google.com\/ - HIER_DIRECT\/216.58.223.100 text\/html<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Proxy settings on Firefox browser.<\/h4>\n\n\n\n<p>On your Firefox, configure it to connect external network via your Squid server.&nbsp;<strong>Preferences<\/strong>&nbsp;&gt;&nbsp;<strong>Genera<\/strong>l &gt;&nbsp;<strong>Network Settings &gt; Manual Proxy Configuration<\/strong>. Check&nbsp;<strong>Use this proxy server for all protocols.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1152\" height=\"828\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/firefox-proxy.png\" alt=\"Setup Squid Proxy on Ubuntu 20.04\" class=\"wp-image-6017\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/firefox-proxy.png?v=1591126649 1152w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/firefox-proxy-768x552.png?v=1591126649 768w\" sizes=\"(max-width: 1152px) 100vw, 1152px\" \/><\/figure>\n\n\n\n<p>Try to access blocked sites on your browser;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"572\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/blocked-site.png\" alt=\"\" class=\"wp-image-6018\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/blocked-site.png?v=1591126684 842w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/06\/blocked-site-768x522.png?v=1591126684 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/figure><\/div>\n\n\n<p>Check the logs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>tail -f \/var\/log\/squid\/access.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>1591126191.919      0 192.168.57.11 TCP_DENIED\/403 3963 CONNECT www.youtube.com:443 - HIER_NONE\/- text\/html<\/code><\/pre>\n\n\n\n<p>And that how to basically configure squid proxy to block or deny access to external resources. That marks the end of our tutorial on how to install and configure Squid Proxy on Ubuntu 20.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-and-configure-squid-proxy-on-centos-8\/\" target=\"_blank\">Install and Configure Squid Proxy on CentOS 8<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/monitor-squid-logs-with-grafana-and-graylog\/\" target=\"_blank\">Monitor Squid logs with Grafana and Graylog<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/create-squid-logs-extractors-on-graylog-server\/\" target=\"_blank\">Create Squid Logs Extractors on Graylog Server<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/monitor-squid-access-logs-with-graylog-server\/\" target=\"_blank\">Monitor Squid Access Logs with Graylog Server<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-setup-squid-proxy-basic-authentication-with-username-and-password\/\" target=\"_blank\" rel=\"noreferrer noopener\">Setup Squid Proxy Authentication on Ubuntu 18.04\/Fedora 29\/28\/CentOS 7<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we are going to learn how to install and setup Squid Proxy on Ubuntu 20.04. Squid&nbsp;is a full-featured web proxy cache application<\/p>\n","protected":false},"author":1,"featured_media":10750,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[34,121,250],"tags":[1642,1641,4210,1640,277,1643,1200],"class_list":["post-5942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-howtos","category-proxy","tag-block-sites-using-squid-proxy","tag-configure-squid-on-ubuntu-20-04","tag-insqll-squid-proxy-ubuntu-20-04","tag-install-squid-ubuntu-20-04","tag-squid-proxy","tag-squid-proxy-keywords","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5942"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5942"}],"version-history":[{"count":11,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5942\/revisions"}],"predecessor-version":[{"id":21437,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5942\/revisions\/21437"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/10750"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}