lee_mcr
Member
OP
- Joined:
- Sep 2024
- Posts:
- 242
- From:
- Manchester, UK
Right then, I have gone and done a proper numpty thing. Was tightening up some rules on my Hostinger VPS, thought I was being clever with a default drop, and now I cannot SSH in. Provider console works, thank god, but I would rather not rebuild from scratch. I had:
iptables -P INPUT DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
...or so I thought. Clearly I missed something because the packet counter on that rule is not moving. Console shows I am locked out. Any ideas before I make it worse? Cheers lads
Honey badger don't care... about downtime
kate3
Member
- Joined:
- Jul 2024
- Posts:
- 208
- From:
- Utrecht, NL
Correct. Your ESTABLISHED,RELATED rule is also missing, or your ordering is wrong. Without -I lo -j ACCEPT, local services break. Without the conntrack rule, return SSH traffic dies.
Virtualization tax: some OpenVZ hosts intercept iptables in the host kernel and your rules behave differently. Hostinger uses KVM so you have full netfilter, but that also means full rope to hang yourself.
Check from console:
iptables -L -n -v --line-numbers
Look for rule 1. If your DROP is rule 1 and lo is rule 5, traffic hits the floor first.
virsh list --all | wc -l: 47
pieter_rtm
Member
- Joined:
- Jul 2024
- Posts:
- 195
- From:
- Rotterdam, NL
Steps to fix, to be honest:
1. Console in.
2. `iptables -F`
3. `iptables -P INPUT ACCEPT`
4. Add rules in correct order: lo first, then established, then ports, then drop.
5. `apt install iptables-persistent` or equivalent.
6. Save. Test from second session before closing console.
As said: ordering matters. Your drop policy is the last rule, not the first. Bullet lists prevent this.
Containers before it was cool
kenji3
Member
- Joined:
- Jul 2024
- Posts:
- 138
- From:
- Osaka, JP
Lo first, drop last. Learned that the hard way too
conbini > datacenter snacks