[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Squid - How to  make squid proxy prevent malwares

Published on
8,244 Points
Last Modified:
In this tutorial I will explain how to make squid prevent malwares in five easy steps:

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

Step 1:
Create a file called malware_block_list.txt and save in /etc/squid

Step 2:
Create a new access list (ACL) in your squid.conf
# File which contains the list 
acl malware_block_list url_regex-i "/etc/squid/malware_block_list.txt" 
# Access Denied 
http_access deny malware_block_list 
# Redirect message - (You can make your own) 
deny_info http://malware.hiperlinks.com.br/denied.shtml malware_block_list

Open in new window

Step 3:
Execute in shell.
wget -O - http://malware.hiperlinks.com.br/cgi/submit?action=list_squid > /etc/squid/malware_block_list.txt

Open in new window

Step 4:
Put in Scheduled Tasks (Crontab).
**In my case the file from the list of malware is updated at 00 hours and 06 hours.
* 00,06 * * * wget -O - http://malware.hiperlinks.com.br/cgi/submit?action=list_squid > /etc/squid/malware_block_list.txt

Open in new window

Step 5:
Reload squid configuration.
service squid reload

Open in new window

Every time that scheduled task is executed, the file is updated.
Open /etc/squid/malware_block_list.txt and see if you can see the list of urls, take one and put in your browser to see if the the error message appears.
error messageRegards

André Bolinhas

Administrative Comment

I'm one of EE's Page Editors assigned to these zones.

I'm changing this Article's status to Author Review so that you can edit it, as discussed below.  When you have responded to the issues below, change the status to Editor Review to alert me.  I'm telling every author that I consider unpublished Articles as subject to deletion, if at any time 30 days shall elapse without requested feedback from the author.

1.  After your first sentence tell what squid is in a short sentence.

2.  Define technical terms/jargon and abbreviations for a more general audience

3.  Your image cannot be read.  Try a narrower width screen capture, no more than 600 to 750 pixels wide.

Here are Article Publishing Criteria that will be used here.

Reasonable applicability to designated zone(s)
English language and reasonable paragraph structure
Reasonable use of grammar and words
Reasonable organization and flow of the overall presentation through to its conclusions
Basic clarity of presentation, ideas and conclusions
Define technical terms/jargon and abbreviations for a more general audience
Embedded images are to be readable, as needed

Excessive use of undefined technical terms/jargon and abbreviations
Content is materially misstated or factually wrong, or  the conclusions are logically incorrect or misleading
"IM talk"
Conflicting statements/ideas
Unjustified, off-topic content

Standard Deletion Criteria
Explicit defamatory or malicious content
Libelous content or statements that violate third party rights
Content that outlines illegal, unethical activities
Spamming, flaming, soliciting, promoting, advertising for commercial purpose
Plagiarism, posting copyrighted content
Clear misuse of the EE points system
Content that has considerable errors, information that is intentionally false or misleading

Here are EE's guidelines and additional help resources for Articles

    * Make sure your content is unique, tech related
    * Articles should be no less than 300 words
    * Use short, descriptive titles
    * Be simple, clear, and detailed
    * Use formatting tips for readability
    * Test code snippets before publishing
    * Attach necessary files, screenshots
    * Reference all source material
    * Spell-check, edit content for errors

Here are more resources available to you or you can ask an Article question in this Article or at

See Guidelines and Help Topics for Writing Articles at:

See the Article Tips page, where you'll find tips and guidelines to improve your article writing.

Author Comment

Hi WaterStreet,

Thanks for warning me of the errors of my article, this was my first article that I wrote in my whole life:)

I changed my article, I ask you to verify that it is within the guidelines set by you.

If not, please let me know so I can re-edit it.

Thanks for your help


André Bolinhas


Expert Comment

Great post! But there's a typo in the config, you forgot a space in "url_regex-i" ACL type. It should look like:

acl malware_block_list url_regex -i "/etc/squid/malware_block_list.txt"

Featured Post

Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Join & Write a Comment

Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Other articles by this author

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month