I posted this in "Advanced Support" because I believe it needs an answer in a realm beyond Basic. [Not whether the question or answer is "basic", but that Expert advice is better (ie better than "not expert") on this one.]
If I setup a simple iptables firewall from common advice off the Internet (copied in various websites too) it uses a rule...
- Code: Select all
iptables -I INPUT 1 -i lo -j ACCEPT
(Alternatively, it could be -A appended.)
That rule is in the INPUT CHAIN (under a DROP Policy).
(That rule is common to many setups that I've seen.)
So, under the 3 rules setup...
A.
(List all rules iptables man page S = Print the rules in a chain or all chains)
- Code: Select all
# iptables -S
-P INPUT DROP
-P FORWARD DROP
-P OUTPUT ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
Then if I...
B.
(List all rules (also) iptables man page L = List the rules in a chain or all chains)
- Code: Select all
# iptables -L
Chain INPUT (policy DROP)
target........ prot . opt .. source ...... destination
ACCEPT .. all .... -- .... anywhere .. anywhere ..........ctstate RELATED,ESTABLISHED
ACCEPT .. all .... -- .... anywhere .. anywhere
DROP ...... all ... -- ..... anywhere .. anywhere .......... ctstate INVALID
Chain FORWARD (policy DROP)
target........ prot . opt .. source ...... destination
Chain OUTPUT (policy ACCEPT)
target........ prot . opt .. source ...... destination
Notice:
1.
Why does the man page (essentially) indicate it will show the same thing but then produces different outputs? That is puzzling to a Viewer (me).
(That is a bugbear for man to deal with, and not really requiring an answer I suppose.)
2.
The "L" listing shows the rule: ACCEPT...all...anywhere...anywhere. Woops! Not good!
That's the result of the Loopback rule that I gave at the top of the post. It appears to be "accepting" EVERYTHING!
Now, if I remove the rule from the tables/firewall there is no APPARENT break in web use; I continue with my access. (That is, I am not blocked/hindered from doing anything - at least up till now.) [Yes; I restarted the iptables service.]
So the subsequent OBVIOUS question is, "What is the loopback rule for, exactly?".
Rather than a plain or standard response from COMMON knowledge here I would rather you test that for yourself first.
>> If the rule IS creating a "hole" then I want to know about it properly.
>> If the rule is NOT doing ANYTHING of value then it is unnecessary, is it not?
>> It may be something else. [In other words, the iptables DO work properly somehow, and - despite the above description of an anomaly - working knowledge is understood properly by advanced Users. However, it does present confusion (as described).]
(Note, if you respond you are speaking to a virtual Novice.)
Regards,