SSH and Iptables

This forum is for discussion about general software issues.

SSH and Iptables

Postby toniozz » Wed Apr 15, 2020 11:11 pm

Hi,

It's not an issue on Arch ARM but i can't find the answer on the web. I manage my RPi (it's a web server) with SSH without an other way to connect to. In order to improve security, i want to setup iptables. I have studied the different rules to implement (network guidelines, ...) and i'm ready to configure it. But if i do: iptables -P INPUT DROP, i can't access to the server with SSH and i don't want to lose my access (the only way to resolve the issue in this case is to access the SD card with QEMU).
Anyone faced with this problem ?

Thanks
Antoine
toniozz
 
Posts: 4
Joined: Tue Aug 27, 2019 7:15 pm

Re: SSH and Iptables

Postby summers » Thu Apr 16, 2020 3:44 pm

well I use nftables. But concept is similar. You need to accept port 22 on the input chain before you drop everything on input. Now don't recall how you order rules in iptables, but it will be in the documentation. You'll also want to accept related and established connections, so you can get replies to inet queries. This should be described in most iptables howto, its all fairly standard.
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: SSH and Iptables

Postby toniozz » Thu Apr 16, 2020 7:50 pm

Hi,

Thank you ! I will apply your advice. Yes, i saw that the order of the rules is highly important. That's why i post this question before do anything.

Antoine
toniozz
 
Posts: 4
Joined: Tue Aug 27, 2019 7:15 pm


Return to General

Who is online

Users browsing this forum: No registered users and 47 guests