{"id":17417,"date":"2023-07-07T06:59:29","date_gmt":"2023-07-07T06:59:29","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=17417"},"modified":"2023-07-06T07:07:38","modified_gmt":"2023-07-06T07:07:38","slug":"how-to-configure-squid-proxy-server-for-https-filtering","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-configure-squid-proxy-server-for-https-filtering\/","title":{"rendered":"How to Configure Squid Proxy Server for HTTPS Filtering"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1024x768.jpg\" alt=\"How to Configure Squid Proxy Server for HTTPS Filtering\" width=\"1024\" height=\"768\" class=\"alignnone size-large wp-image-17418 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1024x768.jpg 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-300x225.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1536x1152.jpg 1536w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-2048x1536.jpg 2048w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-128x96.jpg 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-420x315.jpg 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-540x405.jpg 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-720x540.jpg 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-960x720.jpg 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1140x855.jpg 1140w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1320x990.jpg 1320w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/07\/How-to-Configure-Squid-Proxy-Server-for-HTTPS-Filtering-1440x1080.jpg 1440w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/p>\n<p>As more and more data is transmitted over the internet, the need for secure connections has never been greater. One way to achieve this is through HTTPS filtering. HTTPS filtering allows you to inspect, monitor, and filter secure web traffic to enhance security and control.<\/p>\n<p>One tool that can help you achieve this is the Squid Proxy Server. Squid is a powerful and flexible proxy server that can be used to improve network performance by caching frequently accessed web content, reducing bandwidth usage, and speeding up response times. But beyond these, Squid also offers features for web traffic filtering, including HTTPS filtering.<\/p>\n<p>In this tutorial, we will guide you through the process of configuring Squid Proxy Server for HTTPS filtering on CentOS. This will allow you to monitor and control secure web traffic, enhancing your network&#8217;s security and performance.<\/p>\n<p>Before we proceed, it&#8217;s important to note that you should have Squid Proxy Server installed on your CentOS system. If you haven&#8217;t done so yet, you can refer to our previous tutorial on <a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-configure-squid-proxy-server-for-private-connections-on-centos\/\">how to install and set up Squid Proxy Server<\/a>.<\/p>\n<h2>Step 1: Enable SSL Bumping<\/h2>\n<p>The first step in configuring Squid for HTTPS filtering is to enable SSL Bumping. SSL Bumping is a feature in Squid that allows it to peek into the SSL traffic, enabling it to block or allow specific websites based on your rules.<\/p>\n<p>To enable SSL Bumping, open the Squid configuration file:<\/p>\n<pre>vi \/etc\/squid\/squid.conf\r\n<\/pre>\n<p>Then, add the following lines to the configuration file:<\/p>\n<pre>http_port 3128 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=\/etc\/squid\/ssl_cert\/myCA.pem\r\nssl_bump peek all\r\nssl_bump bump all\r\n<\/pre>\n<p>This will enable SSL Bump on port 3128 with the certificate located at \/etc\/squid\/ssl_cert\/myCA.pem.<\/p>\n<h2>Step 2: Create SSL Certificate<\/h2>\n<p>Next, you need to create an SSL certificate that Squid will use for SSL Bumping. To do this, first, create a directory for the SSL certificate:<\/p>\n<pre>mkdir \/etc\/squid\/ssl_cert\r\n<\/pre>\n<p>Then, navigate to the newly created directory:<\/p>\n<pre>cd \/etc\/squid\/ssl_cert\r\n<\/pre>\n<p>Now, generate the SSL certificate:<\/p>\n<pre>openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout myCA.pem -out myCA.pem\r\n<\/pre>\n<p>This will create a new SSL certificate named myCA.pem that will be valid for 365 days.<\/p>\n<h2>Step 3: Configure Squid for HTTPS Filtering<\/h2>\n<p>Now that you have enabled SSL Bumping and created an SSL certificate, you can configure Squid for HTTPS filtering. To do this, open the Squid configuration file:<\/p>\n<pre>vi \/etc\/squid\/squid.conf\r\n<\/pre>\n<p>Then, add the following lines to the configuration file:<\/p>\n<pre>acl SSL_ports port 443\r\nacl CONNECT method CONNECT\r\nhttp_access deny CONNECT !SSL_ports\r\nhttp_access allow localhost manager\r\nhttp_access deny manager\r\nhttp_access allow localnet\r\nhttp_access allow localhost\r\nhttp_access deny all\r\n<\/pre>\n<p>These lines will configure Squid to filter HTTPS traffic. The &#8216;acl SSL_ports port 443&#8217; line defines the SSL ports, the &#8216;acl CONNECT method CONNECT&#8217; line defines the CONNECT method used for SSL connections, and the &#8216;http_access deny CONNECT !SSL_ports&#8217; line denies any CONNECT requests that are not to SSL ports.<\/p>\n<h2>Step 4: Restart Squid<\/h2>\n<p>After making these changes, you need to restart Squid for the changes to take effect. You can do this with the following command:<\/p>\n<pre>systemctl restart squid\r\n<\/pre>\n<h2>Step 5: Configure Your Browser to Use Squid<\/h2>\n<p>Once you&#8217;ve set up your Squid proxy server, the next step is to configure your web browser to use it. This process varies depending on the browser you are using. Here are the steps for some of the most popular web browsers:<\/p>\n<h3>Google Chrome<\/h3>\n<ol>\n<li>Open Google Chrome and click on the three-dot menu in the top-right corner.<\/li>\n<li>Go to &#8220;Settings&#8221; and scroll down to the bottom of the page.<\/li>\n<li>Click on &#8220;Advanced&#8221; to expand the advanced settings.<\/li>\n<li>Under the &#8220;System&#8221; section, click on &#8220;Open your computer\u2019s proxy settings&#8221;.<\/li>\n<li>In the &#8220;Proxy settings&#8221; window, under &#8220;Manual proxy setup&#8221;, turn on &#8220;Use a proxy server&#8221;.<\/li>\n<li>Enter the IP address of your Squid server in the &#8220;Address&#8221; field and the port number (usually 3128) in the &#8220;Port&#8221; field.<\/li>\n<li>Click &#8220;Save&#8221; to apply the changes.<\/li>\n<\/ol>\n<h3>Mozilla Firefox<\/h3>\n<ol>\n<li>Open Firefox and click on the three-line menu in the top-right corner.<\/li>\n<li>Go to &#8220;Options&#8221; and scroll down to the &#8220;Network Settings&#8221; section.<\/li>\n<li>Click on &#8220;Settings&#8221; to open the &#8220;Connection Settings&#8221; window.<\/li>\n<li>Select &#8220;Manual proxy configuration&#8221;.<\/li>\n<li>Enter the IP address of your Squid server in the &#8220;HTTP Proxy&#8221; field and the port number in the &#8220;Port&#8221; field.<\/li>\n<li>Check the box that says &#8220;Use this proxy server for all protocols&#8221;.<\/li>\n<li>Click &#8220;OK&#8221; to apply the changes.<\/li>\n<\/ol>\n<h3>Safari<\/h3>\n<ol>\n<li>Open Safari and click on &#8220;Safari&#8221; in the menu bar, then select &#8220;Preferences&#8221;.<\/li>\n<li>Go to the &#8220;Advanced&#8221; tab and click on &#8220;Change Settings&#8221; next to &#8220;Proxies&#8221;.<\/li>\n<li>In the &#8220;Proxies&#8221; window, check the box for &#8220;Web Proxy (HTTP)&#8221;.<\/li>\n<li>Enter the IP address of your Squid server in the &#8220;Web Proxy Server&#8221; field and the port number in the field next to it.<\/li>\n<li>Click &#8220;OK&#8221; and then &#8220;Apply&#8221; to save the changes.<\/li>\n<\/ol>\n<h3>Microsoft Edge<\/h3>\n<ol>\n<li>Open Microsoft Edge and click on the three-dot menu in the top-right corner.<\/li>\n<li>Go to &#8220;Settings&#8221; and select &#8220;System&#8221; on the left side.<\/li>\n<li>Under &#8220;System&#8221;, click on &#8220;Open your computer\u2019s proxy settings&#8221;.<\/li>\n<li>In the &#8220;Proxy settings&#8221; window, under &#8220;Manual proxy setup&#8221;, turn on &#8220;Use a proxy server&#8221;.<\/li>\n<li>Enter the IP address of your Squid server in the &#8220;Address&#8221; field and the port number (usually 3128) in the &#8220;Port&#8221; field.<\/li>\n<li>Click &#8220;Save&#8221; to apply the changes.<\/li>\n<\/ol>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">sudo apt-get install squid<\/span> \u2013 This command is used to install Squid on Ubuntu.<\/li>\n<li><span class=\"fw-bold\">vi \/etc\/squid\/squid.conf<\/span> \u2013 This command opens the Squid configuration file in a text editor.<\/li>\n<li><span class=\"fw-bold\">mkdir \/etc\/squid\/ssl_cert<\/span> \u2013 This command creates a new directory for the SSL certificate.<\/li>\n<li><span class=\"fw-bold\">cd \/etc\/squid\/ssl_cert<\/span> \u2013 This command changes the current directory to the newly created SSL certificate directory.<\/li>\n<li><span class=\"fw-bold\">openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout \/etc\/squid\/ssl\/squid.key -out \/etc\/squid\/ssl\/squid.crt<\/span> \u2013 This command generates a new self-signed SSL certificate.<\/li>\n<li><span class=\"fw-bold\">systemctl restart squid<\/span> \u2013 This command restarts the Squid service, applying any changes made to the configuration file.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, we&#8217;ve walked through the process of setting up Squid Proxy Server for HTTPS filtering on CentOS. We&#8217;ve covered the installation of Squid, the configuration of Squid for HTTPS filtering, the generation of an SSL certificate, and finally, how to configure your browser to use Squid.<\/p>\n<p>By following these steps, you should now have a Squid Proxy Server that&#8217;s capable of filtering HTTPS traffic. This setup can significantly enhance your network&#8217;s security and performance by allowing you to monitor and control secure web traffic.<\/p>\n<p>Remember, Squid is a versatile tool that can do much more than just HTTPS filtering. It can be used to cache web content, control access to websites, and even improve your network&#8217;s performance. To learn more about what Squid can do, check out our other tutorials on <a href=\"https:\/\/webhostinggeeks.com\/blog\/squid-proxy-server-features-functions-benefits\/\">Squid: features, functions, and benefits<\/a>.<\/p>\n<p>I hope you found this tutorial helpful. If you have any questions or run into any issues, feel free to leave a comment below. <\/p>\n<p>Happy browsing!<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is HTTPS filtering and why is it important?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<span itemprop=\"text\">HTTPS filtering is a technique used to inspect, monitor, and filter secure web traffic. It involves decrypting, inspecting, and then re-encrypting the traffic. This allows you to see the contents of secure web traffic and apply filtering rules to it. It&#8217;s important for network security as it can help block access to certain websites, monitor web usage, and protect against threats hidden in encrypted traffic.<\/span>\n<\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Can Squid filter all types of web traffic?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<span itemprop=\"text\">Yes, Squid can filter both HTTP and HTTPS traffic. However, filtering HTTPS traffic requires additional configuration and the use of the SSL Bump feature.<\/span>\n<\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Is it legal to filter HTTPS traffic?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<span itemprop=\"text\">Yes, it is generally legal to filter HTTPS traffic, as long as you are doing it on a network that you own and manage, and you have the necessary permissions from the users of the network. However, laws can vary by country and region, so it&#8217;s always a good idea to check with a legal expert if you&#8217;re unsure.<\/span>\n<\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do I stop using the Squid proxy server?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<span itemprop=\"text\">To stop using the Squid proxy server, you can go back to the proxy settings in your browser and turn off the proxy server option. This will stop your web traffic from being routed through the Squid proxy server.<\/span>\n<\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Does Squid work with other operating systems besides CentOS?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<span itemprop=\"text\">Yes, Squid is a cross-platform software that works with a variety of operating systems, including other Linux distributions, BSD, and Windows. The installation and configuration process may vary depending on the operating system.<\/span>\n<\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>As more and more data is transmitted over the internet, the need for secure connections has never been greater. One way to achieve this is through HTTPS filtering. HTTPS filtering&#8230;<\/p>\n","protected":false},"author":6,"featured_media":17418,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1057],"tags":[2115,2114,1678,1793,2116],"class_list":["post-17417","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-squid-server","tag-filtering","tag-https","tag-proxy","tag-squid","tag-traffic"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/17417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=17417"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/17417\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/17418"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=17417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=17417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=17417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}