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?

24 points

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.

permalink
report
reply
-6 points

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.

permalink
report
parent
reply
32 points

Because then:

  • you also need to know the correct username
  • audits and logging shows which user used sudo to gain root access
permalink
report
parent
reply
-21 points
  • 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.

permalink
report
parent
reply
7 points

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.

permalink
report
parent
reply
2 points

they need to guess a username i assume

permalink
report
parent
reply
12 points

just use tailscale

permalink
report
reply
8 points

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

permalink
report
reply
8 points

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

permalink
report
parent
reply
4 points
*

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.

permalink
report
parent
reply
1 point

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).

permalink
report
parent
reply
8 points

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.

permalink
report
reply
6 points
Removed by mod
permalink
report
reply

Selfhosted

!selfhosted@lemmy.world

Create post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

Community stats

  • 5K

    Monthly active users

  • 3.6K

    Posts

  • 81K

    Comments