Is there a nftables translation of this? Or a preferred DIY Linux FW explainer (for idiots pref.)..
Iptables is an extremely flexible firewall utility built for Linux operating systems.
www.howtogeek.com
It's pretty simple and straight forward compared to other methods. Keeping the number of rules and the order in an efficient structure keeps thing running fast.
If you're hosting a server for something you can permit multiple ports in a single line or make a container/list to reference to simplify the rule. If you do the list option you don't have to remove / replace the rule to make changes and just add the additional port / IP to the list and it's immediate.
Since I edit them in notepad++ I have a script of commands that I run to strip the rules and reapply them from the text file. Doing it all from CLI and verifying things can be a bit tedious w/ multiple windows open for verification.
For monitoring from a terminal w/ the watch command you can get real time processing / packet counts
So, I make 3 "groups" of permit statements and then put the rules under those. Each rule gets processed from the top down. Permitting local things first to reduce lag from processing such as the loopback / LAN. For statistical reasons I break out things a bit more than you need to. I want to see the traffic patterns but not to the point of each granular packet.
Even though it's implied that if it doesn't match a rule by making the policies "DROP" it's nice to see a count by appending a DROP rule to see the hit count of what doesn't match. Seeing the DROP count can clue you into whether you're being attacked or not. It might also indicate if there's something on the inside trying to open access to a RCE / call home in a non-permitted fashion.
Few people realize though there are tons of bots scanning the internet for various reasons and if you don't lock things down properly you're leaking data to them.
I use Netwatch to see what's hitting my WAN and periodically check to see who's the most offensive. By blocking everything that didn't originate from the LAN and VPN all traffic it makes it easy to spot the number of packets of repeat hits like these.
The a whois will give you an idea of who is behind the IP
inetnum: 104.250.32.0 - 104.250.63.255
netname: KSYUNGLOBAL-HK
descr: Kingsoft Cloud Corporation Limited
country: HK
org: ORG-KCCL1-AP
admin-c: KCCL1-AP
tech-c: KCCL1-AP
abuse-c: AK1146-AP
status: ALLOCATED PORTABLE
remarks: --------------------------------------------------------
remarks: To report network abuse, please contact mnt-irt
remarks: For troubleshooting, please contact tech-c and admin-c
remarks: Report invalid contact via
www.apnic.net/invalidcontact
remarks: --------------------------------------------------------
mnt-by: APNIC-HM
mnt-lower: MAINT-KSYUNGLOBAL-HK
mnt-routes: MAINT-KSYUNGLOBAL-HK
mnt-irt: IRT-KSYUNGLOBAL-HK
last-modified: 2020-06-30T08:55:59Z
source: APNIC
There are websites though that can give you a reputation / report for that IP
www.abuseipdb.com
For a long time iptables have been a favorite tool for sysadmins. But nftables are recommended these days. Read to find out why.
linuxhandbook.com
For me it's a lot easier to deal with a short text file vs XML / JSON