Any feedback from port knockers ? (en.m.wikipedia.org)
from rzr@lemmy.sdf.org to selfhosted@lemmy.world on 10 Sep 2023 13:38
https://lemmy.sdf.org/post/3655047

To mitigate the effort to maintain my personal server, I am considering to only expose ssh port to the outside and use its socks proxy to reach other services. is Portknocking enough to reduce surface of attack to the minimum?

#selfhosted

threaded - newest

tinsuke@lemmy.world on 10 Sep 2023 13:47 next collapse

Sounds like security through obscurity to me.

Highly susceptible to replay and man in the middle attacks.

If you’re gonna combine that with another authentication method (and you should), then I see little advantage over just going with the other auth method.

aksdb@feddit.de on 10 Sep 2023 16:18 next collapse

Sure? It certainly detracts bots that now don’t discover the SSH port anymore. Against a targeted attack it’s less useful, but that is a very hard problem in any case. If someone is out to get you specifically, it will be a tough battle.

ShortN0te@lemmy.ml on 10 Sep 2023 16:43 next collapse

Bots do not matter. They try just common know exploits. If your root password is not root you are fine.

SheeEttin@lemmy.world on 11 Sep 2023 01:44 collapse

Root login should be disabled, and ideally remote user auth should be key only, not password. And you should have a passphrase on your key.

ShortN0te@lemmy.ml on 11 Sep 2023 05:48 collapse

Should be

Why? Dont recite a blogpost to me explain it. Following blindly security practices you do not understqnd can be very dangerous.

Disableing the root login gains nothing in regarding security. If you have a secure key or a passwordthey attacker will not get in no matter what. And once a account is compromised it ia trivial to extract the sudo passwors with simple aliases.

Passwords can be as secure as keys. Yes be default a weak key is still more secure then a weak passwors. But if you have a strong password policy in place it does not matter. Most valid argument for keys is the ease of you

Having a passphrase on the key is for example for my usecase irrelevant. I run full disk encryption on every device. A passphrase on those keys would not gain me much security only more inconvenience.

486@kbin.social on 11 Sep 2023 06:21 collapse

Disableing the root login gains nothing in regarding security.

This is usually not the reason people recommend disabling root login. Since root is an anonymous account not tied to an actual person, in a corporate setting, you do not really know who used that account if you allow root login. If this is relevant for a personal home network is for you to decide. I would say there is not such a strong argument for it to be made in that setting.

ShortN0te@lemmy.ml on 11 Sep 2023 07:04 collapse

I absolutely agree with your. It can makes sence the disable it for access control, loging, auditing, etc. .

But when you look online or just in the comment section here lots of ppl actually recommend it as a security meassure against attackers. “Need to brute force the username as well”

zaphod@lemmy.ca on 11 Sep 2023 05:08 collapse

If you’re worried about bots just use a non-standard port and move on. I did that on my own VPS just to cut down on log chatter and I get absolutely zero ssh attack attempts after the change.

486@kbin.social on 11 Sep 2023 06:14 collapse

Highly susceptible to replay and man in the middle attacks.

fwknop isn't susceptible to either.

NeoNachtwaechter@lemmy.world on 10 Sep 2023 13:48 next collapse

In your SSH config, you should disallow root login and password authentication.

It is more secure than these tommyknockers :-) but you can do that additionally, if you feel like it.

dalz@fedi.alsd.eu on 10 Sep 2023 14:33 collapse

Why disallow root login? I always need root when I connect, and stealing the password by aliasing sudo/doas is trivial. It seems to me it would just make life harder for no benefit.

neoney@lemmy.neoney.dev on 10 Sep 2023 14:59 next collapse

they need to guess a username i assume

this_is_router@feddit.de on 10 Sep 2023 15:02 next collapse

Because then:

  • you also need to know the correct username
  • audits and logging shows which user used sudo to gain root access
ShortN0te@lemmy.ml on 10 Sep 2023 16:41 collapse
  • you also need to know the correct username

Use a secure password or key. Security by obscurity is no security.

  • audits and logging shows which user used sudo to gain root access

That is not the point that was made. Once access to sudo or root you already have lost.

False@lemmy.world on 10 Sep 2023 18:24 next collapse

You’re making it that much easier for someone to brute force logging in or to exploit a known vulnerability. If you have a separate root password (which you should) an attacker needs to get through two passwords to do anything privileged.

This has been considered an accepted best practice for 20+ years and there’s little reason not to do it anyways. You shouldn’t be running things as root directly regardless.

ShortN0te@lemmy.ml on 11 Sep 2023 06:01 collapse

When you have secure passwords kr key auth. Brute force is not a problem. What vulnerability are you talking about? Complete auth bypass? Then the username would be no problem either since you can just brute force usernames.

False@lemmy.world on 11 Sep 2023 15:35 collapse

Heartbleed was a thing that happened.

surewhynotlem@lemmy.world on 11 Sep 2023 00:45 next collapse

Security though obscurity, BY ITSELF, is not security. But it’s great at slowing attackers and thwarting automated scripts.

It’s bad security to ignore possible mitigations to a problem just because it isn’t as full fix.

randombullet@feddit.de on 11 Sep 2023 06:41 collapse

Defense in depth.

Anyone who’s certified NET+ or higher knows this.

ShortN0te@lemmy.ml on 11 Sep 2023 09:07 collapse

That video here: youtu.be/fKuqYQdqRIs?feature=shared

Does a great job actually explaining a lot of my points. And it is produced by an actual security auditor and researcher. Just because everyone is doing it does not make it a security benefit that matters.

PipedLinkBot@feddit.rocks on 11 Sep 2023 09:08 collapse

Here is an alternative Piped link(s):

piped.video/fKuqYQdqRIs?feature=shared

Piped is a privacy-respecting open-source alternative frontend to YouTube.

I’m open-source, check me out at GitHub.

NeoNachtwaechter@lemmy.world on 11 Sep 2023 03:50 collapse

Why disallow root login?

It is very easy to throw a dictionary at your port 22. It happens every few minutes. And they all try it with the username=root unless they know something better.

SheeEttin@lemmy.world on 10 Sep 2023 13:54 next collapse

I would only expose a VPN and use that to access the other services.

lemmyvore@feddit.nl on 10 Sep 2023 14:31 collapse

Why? There’s no downside to ssh, if anything it’s easier to set up.

Morgikan@lemm.ee on 10 Sep 2023 19:36 next collapse

A VPN would give you access to a network, but not necessarily the devices on that network. It adds another layer of security as the user not only has to have SSH credentials/keys, but they also have to have the same for the VPN. SSH and VPNs would really be used in conjunction with each other.

It’s onion security.

SheeEttin@lemmy.world on 11 Sep 2023 01:42 collapse

If you only want to provide ssh access to one host, sure. If you want to provide other services, on multiple hosts, then you’re either making it a jump box or a proxy, while a VPN would provide direct access (or at least as defined in the firewall and routing rules).

CriticalMiss@lemmy.world on 10 Sep 2023 14:10 next collapse

Other then the slowly increasing log file (if you use fail2ban for example), it will take thousands of years to actually hack you through this method as long as root auth is disabled and authentication is only via SSH keys, I wouldn’t worry about it.

It is possible to tighten the security of a machine to the point it is no longer usable. It is important to secure our devices but we cannot forget about convenience, so the trick is to tighten it but also make it so you don’t have to jump through a number of hoops till you get to your destination.

I for example, wouldn’t use your method because it would make it difficult to use some services I host from my phone.

Port knockers for the most part aren’t worrying. In an ideal situation, the only ports that should be open are 22, 80, 443 and using a reverse proxy to mask headers. (Poor configuration for example, go to Shodan and type bitwarden in the search bar and see how many people expose their instances to the world carelessly without an SSL cert) and the occasional UDP for game servers/media servers.

vzq@lemmy.blahaj.zone on 10 Sep 2023 14:09 next collapse

Have you met my friend Tailscale?

lilShalom@lemmy.basedcount.com on 10 Sep 2023 14:30 next collapse

I use a vps running openvps. Then i only allow ssh access from my vpn ip address.

xinaked@lemmy.world on 10 Sep 2023 15:34 next collapse

just use tailscale

Decronym@lemmy.decronym.xyz on 10 Sep 2023 16:25 next collapse

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

Fewer Letters More Letters
SSH Secure Shell for remote terminal access
SSL Secure Sockets Layer, for transparent encryption
UDP User Datagram Protocol, for real-time communications
VPN Virtual Private Network
VPS Virtual Private Server (opposed to shared hosting)

[Thread #128 for this sub, first seen 10th Sep 2023, 16:25] [FAQ] [Full list] [Contact] [Source code]

Auli@lemmy.ca on 10 Sep 2023 23:58 next collapse

What kind of port knocking just going to ports in sequence? Or someone wrote one that looks for a key signed and is supposedly not replayable.

Faceman2K23@discuss.tchncs.de on 11 Sep 2023 12:55 next collapse

I used to SSH into my server and proxy out from there. Then I learned how shit of a solution that is for daily use and set up a vpn like a normal person.

Chewy7324@discuss.tchncs.de on 12 Sep 2023 03:29 collapse

Instead of ssh I use wireguard directly. It’s a simple protocol based on public/private keys with great performance and security.

Wireguard is stateless and establishes connections really quickly on demand. This means the battery isn’t impacted even though it’s always on, since the VPN doesn’t have to maintain a constant connection. At least that’s the case if your routing only a specific subnet (e.g. 192.168.1.0/24 and not all traffic through it 0.0.0.0/0).