arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iptables problem solving
#4
You didn't read what I have posted... Well.

Opening port 22 only and then setting your INPUT chain to DROP will NOT WORK! You need additional rules.

The order of how you execute the iptables rules also matters. You first opened port 22 and then said to DROP all traffic. The last rules in this case overrides all rules set before. So you get disconnected.

You need to use emergency SSH to setup the firewall properly. First setup the chains and to DROP then open ports as needed and setup further rules that allow automatic replies to connections you have initialized.

It is all described in the topic I linked in my previous post: https://post4vps.com/Thread-Basic-secure...h-iptables


Basically the script you need to run to do everything in a single run is:
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT

Run this from a emergency SSH session or emergency VNC - NOT FROM THE VPS DIRECTLY! After running it you can attempt to connect.
[Image: zHHqO5Q.png]
lockThread Closed 


Messages In This Thread
iptables problem solving - by chanalku91 - 07-22-2019, 07:35 AM
RE: iptables problem solving - by Mashiro - 07-22-2019, 09:55 AM
RE: iptables problem solving - by chanalku91 - 07-22-2019, 11:29 AM
RE: iptables problem solving - by Mashiro - 07-22-2019, 12:04 PM
RE: iptables problem solving - by chanalku91 - 07-22-2019, 12:25 PM
RE: iptables problem solving - by Mashiro - 07-22-2019, 12:30 PM
RE: iptables problem solving - by deanhills - 07-22-2019, 05:05 PM
RE: iptables problem solving - by chanalku91 - 07-22-2019, 12:38 PM
RE: iptables problem solving - by deanhills - 07-28-2019, 03:51 AM

Possibly Related Threads…
Thread
Author
Replies
Views
Last Post
2,510
10-14-2019, 01:31 PM
Last Post: hamed
3,464
07-29-2019, 05:02 AM
Last Post: humanpuff69

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting