Score:0

use local hostname to block all incoming traffic

cn flag

In order to prevent ssh and postfix unsollicited connections attempts on my server,
i was thinking of banning all traffic, but my ip adress; but the ip changes from time to time -

what doesn't change is my local hostname.

Although it can be impersonated, it doesnt resolve to anything (it is basically the name of the local computer), but i'm the only one to use it (no attacker could know it, without bruteforcing).


I tried to add my local hostname to iptable but it gives an error:

sudo iptables -A INPUT -m state --state NEW -s my_computer -j ACCEPT

iptables v1.8.5 (nf_tables): host/network `my_computer' not found


Is there a way that when attempting a ssh connection:
user@my_computer$ ssh [email protected]

would make the server recognize connection is from "my_computer" only authorize connection from host (with or without iptables)

Thank you for helping.

in flag
You may want to investigate a method known as "Port Knocking", which will do what you're looking for while also handling situations where your source IP might change.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.