Q. I am using Debian stable Linux version and squid proxy server for our small software company. I need to block a port number 1234. How to filter a particular port?
A. You can easily filter any port with squid ACL (Access Control List).
ACL is used for defining an access List. When using "file" the file should contain one item per line By default, regular expressions are CASE-SENSITIVE. To make them case-insensitive, use the -i option.
Procedure to block a port
First open /etc/squid/squid.conf file
# vi /etc/squid/squid.conf
Locate your ACL section and add configuration directive as follows:
acl block_port port 1234
http_access deny block_port
http_access allow all
If you just want to skip a particular IP (192.168.1.5) try as follows:
acl block_port port 1234
acl no_block_port_ip src 192.168.1.5
http_access deny block_port !no_block_port_ip
http_access allow all
Close and save the file.
Restart squid proxy server:
# /etc/init.d/squid restart
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 13 comments… read them below or add one }
i want to block to some site not ports how i block tham plz help me.Thanks
Anees,
See this Squid deny users accessing a website FAQ
Opened ACL.But could not understand where to write the configuration changes as u have stated.Plz help its urgent.
Hi,
I tried your given the instruction port blocking for yahoo messanger, gtalk but its not working that rule..
acl porttest port 5050 5222 5223
acl block_port port 5050 5222 5223
acl test src 172.27.162.43
http_access deny block_port test
http_access allow all
Please help me how to port level blocking partiucalar src ip’s
Its possible to deny particular port ??
Thanks
Yagnes
s.yagnes@gmail.com
Hi,
I tried your given the instruction port blocking for yahoo messanger, gtalk but its not working that rule..
acl block_port port 5050 5222 5223
acl test src 172.27.162.43
http_access deny block_port test
http_access allow all
Please help me how to port level blocking partiucalar src ip’s
Its possible to deny particular port ??
Thanks
Yagnes
s.yagnes@gmail.com
Thank for the blocking stuff.
We are unable to access following url from squid proxy, could you please assist us how can I access this url using squid proxy server.
http://tx1.kewill-ipacs.com:18080/kewillfwd/app/kewillfwd.jnlp
Add port number to Safe_port list in squid.conf
How to black the job site for linux proxy server. i am using RHEL4.
sir,
i’m using redhad 5 server edition. i config squid.config for particular websites can’t access. but now i want to particular my netwok ip’s only allowed particular website only other website totaly blocked. how do done this?..
example
my n/w is 191.168.0.0/255.255.0.0
but 191.168.3.6 ip user only access gmail.com other website totally block how to done this?
note: particular websites only i want to allow other website i want to deny how?
how to done this plz help[replay] me….
Hello,
Can we try multiple ip’s should be exempted in blocked search, like, -
acl no_block_port_ip src 192.168.1.5, 192.168.1.6, 192.168.1.4
http_access deny block_port !no_block_port_ip
Please guide me.
Hello,
I have a RHEL 5 Proxy server. my client on Window XP or Window Vista.
How can I block any user MAC Address to access Internet
Please guide me.
i want allow and block website by physical address in squid.
how can i do ?
but with ip4 i already done.