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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Now to be safe that only internal network traffic to squid is allowed, do I need to make sure that I also add an interface switch? I mean , do I need to do
-i eth(internal) ?
I mean, can there be packets out on the internet which claim to be from my internal network?
Normally you shouldn't see IANA reserved addresses (192.168.) on the internet, but you may depending on your ISP and how they have things configured. However, I'd still strongly recommend that you specify the internel interface switch in the iptables rule to prevent unauthorized proxying.
i think in this situation,you don't need to add -i eth(internal interface) because in your iptables rule
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 3128 -j allowed
the source of packet allowed is : 192.168.1.0/24 ,and this source address isn't public address ip so not any packet from outside (internet) can come to your squid
Now to be safe that only internal network traffic to squid is allowed, do I need to make sure that I also add an interface switch? I mean , do I need to do
-i eth(internal) ?
I mean, can there be packets out on the internet which claim to be from my internal network?
thanks,
branden_burger
There could be, but enabling reverse-path filtering and/or the bogon filter will usually kill them off. Something's going to have to become severely broken for someone on the internet to be able to complete a TCP connection by spoofing a private network IP address, since as has been pointed out, these packets generally aren't allowed to cross the Internet--and your box is likely going to send it's handshake packets to your localnet instead of the Internet.
Stuff 1's in whichever of these you feel necessary (I wouldn't mess with lo's tho') to enable it. What will happen then is each packet arriving on an interface will be looked at briefly and if it wasn't supposed to have come from there, it'll be destroyed. There's a more detailed explanation hiding in /usr/src/linux/Documentation.
A *better/faster* way to deal with this issue is to simply drop in a rule at the end of your generic "apply 'em to all interfaces" rules section that will jump traffic to a chain of rules meant just for that interface. When I last checked, specifying an interface on a rule will make it only match traffic on that interface, but potentially all traffic can waste CPU time *attempting* to match against it. This can reduce the amount of overhead your system has to deal with during periods of heavy network load depending on how elegantly you've created your rules. (Either way, a chain named input_eth0 is kind of hard to misinterpret if you're up late at night trying to troubleshoot something) You can then be as particular as you want about each individual interface and what rules you wish to apply to it.
i think in this situation,you don't need to add -i eth(internal interface) because in your iptables rule
-A INPUT -s 192.168.1.0/255.255.255.0 -p tcp -m tcp --dport 3128 -j allowed
the source of packet allowed is : 192.168.1.0/24 ,and this source address isn't public address ip so not any packet from outside (internet) can come to your squid
IMHO, there is no good reason not to specify the interface here, especially since this is a squid proxy. By not doing so you are implicitly trusting that the IANA guidelines are strictly adhered to. In theory they should never be on the public internet, but in practice some ISPs use IANA private addresses for routers and other infrastructure. Plus in a shared subscriber line like cable internet, if you are on the same downstream network segment you'll very often see misconfigured systems using IANA reserved addresses which get filtered by upstream routers (sometimes). Along these lines, it's interesting to note that IANA reserved addresses make up a large number of the direct address resolution queries to the root DNS servers (which should *never* happen in theory...one because DNS is tiered and two because they're IANA reserved IPs). So I would strongly recommend specifying the interface or using rp_filter is a great idea as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.