Squid content filtering: Block / download of music MP3, mpg, mpeg, exec file by extensions
MP3
MPEG
MPG
AVG
AVI
EXEHow do I configure squid content filtering?
You need to use squid ACL (access control list) to block all files by extensions.
How do I block music files using squid content filtering ACL?
First open your squid.conf file /etc/squid/squid.conf, run:# vi /etc/squid/squid.conf
Now add the following lines to your squid ACL section:
acl blockfiles urlpath_regex -i "/etc/squid/blocks.files.acl"
You want display custom error message when a file is blocked:
# Deny all blocked extension
error_directory /usr/share/squid/errors/English
deny_info ERR_BLOCKED_FILES blockfiles
http_access deny blockfiles
Save and close the file.Create a custom error message HTML file called ERR_BLOCKED_FILES in /etc/squid/error/ directory or /usr/share/squid/errors/English directory:
# vi /usr/share/squid/errors/English/ERR_BLOCKED_FILES
Append following content:
<HTML> <HEAD> <TITLE>ERROR: Blocked file content</TITLE> </HEAD> <BODY> <H1>File is blocked due to new IT policy</H1> <p>Please contact helpdesk for more information:</p> <ul> <li>Phone: 555-12435 (ext 44)</li> <li>Email: helpdesk@nixcraft.com</li> </BODY> </HTML> |
# vi /etc/squid/blocks.files.acl
Append following text:
\.exe(\?.*)?$
\.avi(\?.*)?$
\.bat(\?.*)?$
\.tar(\?.*)?$
\.mpg(\?.*)?$
\.mp3(\?.*)?$
\.mp4(\?.*)?$
Save and close the file. Restart Squid:
# /etc/init.d/squid restart
Squid in action:
Say hello to rep_mime_type
To block Active Stream Format (Windows Media Player) and flash video format, add the following in your squid.conf:acl media rep_mime_type x-ms-asf acl mediapr urlpath_regex \.(afx|asf)(\?.*)?$ acl media rep_mime_type video/flv video/x-flv acl mediapr urlpath_regex \.flv(\?.*)?$ http_access deny mediapr http_reply_access deny mediaSave and close the file. Reload squid server:
# systemctl reload squid
OR
# squid -k reconfigure
# squid -k check
# /etc/init.d/squid restart
Sources : https://www.cyberciti.biz/faq/squid-content-filter-block-files/
0 Response to "Cara Blok konten ekstensi mp3 mp4 dengan squid di ubuntu"
Post a Comment