Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
your internet firewall / router would be the place to do this, indeed if your squid server is an internal node than it's already implicitly "blocked" if you've not manually configutred your firewall to pass it through.
Also, ‘‘http_access allow’’ is a good idea. I'd setup both that and iptables, just in case. You never know whether a security bypass will be found in Squid; neither you know when you will need to alter iptables configuration in a complicated enough way to ruin your filter.
You can use http_port to specify which address you want Squid to listen on.
To use iptables as an additional layer of security on the box itself, you could use a rule which only allows IPs on your LAN to access Squid. It might look something like this:
But like acid_kewpie already said, it's kinda weird that you'd be needing to do stuff like this - unless your dedicated router/firewall is forwarding this port to the Squid box. If you explain to us what your actual network setup looks like, we'll be able to provide you with some better feedback.
Intrnet-----eth1(LinuxBOX)Public ip
LAN---------eth0(linuxBox)Private ip
I am using NAT to access internet from LAN, what I want to is block accessing default squid port from outside world on public ip. that's all
Pls. suggest now.
Well in that case the simplest thing would be to use http_port to tell Squid to only listen on the private IP. You could then follow that up with an iptables rule to make certain that hosts on the WAN side couldn't connect to Squid even if it was listening on that address.
Code:
iptables -I INPUT -p TCP -i eth1 --dport 3128 -m state --state NEW -j DROP
This will do what you want, but in all honesty it is much better to simply firewall all unwanted connections on the WAN side (whitelisting instead of blacklisting).
Or write it into an executable file in /etc/init.d directory and place a symlink (name must start with S) to it into /etc/rcS.d. The script will be called with single parameter ‘‘start’’.
No firewall on that box? That's scary. Is ssh server installed? I bet your server gets attacked constantly. You should take a look at your logs, I bet they are huge.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.