Live data from Hacker News

I close SSH port 22 (and what I use instead)

michelebologna.net

1–10 of 106 posts

Re: I close SSH port 22 (and what I use instead)

#2
I would go with something like:

  seed=`date +%s%N`; ( echo "secretknock-20260811|$seed"|sha512sum  ; echo $seed ) | xargs nc -u 192.168.1.1
It is not secure as hmac and it can be 'trivially' brute forced, but don't require extra tools (probably nc not always readily available).

On other hand if threat vector includes network monitor with ability to replay i would use wireguard to wrap ssh traffic.

Re: I close SSH port 22 (and what I use instead)

#5
> and why it is not enough on its own

Nothing is good enough on its own.

Geoblocking, fail2ban, port obscurity, SSH keys, limiting logins to specific usernames, not using your public internet nickname, putting things behind CloudFlare tunnels or WireGuard, wildcard DNS obscurity, 2FA... There are many options.

Defense in depth is the only way to put services on the internet.

Re: I close SSH port 22 (and what I use instead)

#7
post #4

Is this actually practically reducing the attack surface? We're replacing a battle hardened service with a random one that has the ability to manipulate the firewall rules.

A sensible observation. In theory, the entire codebase for a simple HMAC knock knock ought to be tiny and easy to harden with multiple rounds of human and LLM review.

The goal should be to have your complex layers sitting in front of simpler, easier-to-review lines of defence. Once you get to something like an open connection to ssh, the potential attack surface would be orders of magnitude larger, even though it’s more mature and closely scrutinised.

Re: I close SSH port 22 (and what I use instead)

#9
post #5

> and why it is not enough on its own Nothing is good enough on its own. Geoblocking, fail2ban, port obscurity, SSH keys, limiting logins to specific usernames, not using your public internet nickname, putting things behind CloudFlare tunnels or WireGuard, wildcard DNS obscurity, 2FA... There are many options. Defense in depth is the only way to put services on the internet.

> Geoblocking, fail2ban

I use both on one port 22 host. Not much actually touches the server: maybe 5 hosts a day get banned. Meanwhile, China and the Netherlands are forever getting blocked and logged by geoblocking.

I check the 24h log window by country most business days. Some days China leads, other days the Netherlands pulls ahead. Almost never are any other countries close to those two.

Re: I close SSH port 22 (and what I use instead)

#10
Glad to see fwknop mentioned. Back when the idea of port knocking emerged, there was a lot of criticism about it. Then this came out, and not many seemed to notice.

This was before WireGuard and Tailscale, so the main option for remote access was IPsec or OpenVPN, which are both more complicated than most people want to deal with.

Post reply on HN