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.
I have recently installed a new server with Debian 8 (previously been using Ubuntu and Debian 7).
I have added only 1 or 2 iptables rules on INPUT chain only, not FORWARD or OUTPUT and then added default DROP policy.
What i've found, for some reason i can ping an internal IP (eg. router, or another server) but i cannot ping anything externally nor connect either internal or external via http, dns, etc (hostname or IP).
The rules are (3rd all rule being, for lo interface):
Hopefully your server only has one interface. If not the you need to add to the firewall rules which interface the rule should apply to. Looking at your rules you only allow a non-routed IP to your system via ssh.
Maybe you could give this a try
Code:
*filter
:INPUT DROP [26408:5102000]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [922:110412]
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m conntrack --ctstate NEW -s 192.168.2.0/24 -p tcp --dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m conntrack --ctstate NEW -j ACCEPT
COMMIT
Also check your routing table to ensure all your routes are correct;
Your rules were not/are not Stateful based. Which means while you allowed everything out you were only allowing 22 back in locally. By switching to Stateful (what I have supplied) your return traffic is allowed because of the ESTABLISHED,RELATED rule.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.