137
you are viewing a single comment's thread
view the rest of the comments
[-] foggy@lemmy.world 53 points 2 years ago

Setup Fail2ban

Login only with SSH keys. MFA on SSH login. Use SSH proto 2.

Disable passwords, x11 forwarding, root logins

Reduce Idle timeout interval

Limit users' SSH access

That should be more than enough for the average use case.

[-] taladar@sh.itjust.works 12 points 2 years ago

Regular updates are definitely necessary too. Also, if you do limit SSH users to a chroot make sure you limit TCP (port) forwarding too.

[-] possiblylinux127@lemmy.zip 4 points 2 years ago

Containers can help lock services down if you do it right.

[-] MaggiWuerze@feddit.de 3 points 2 years ago
[-] foggy@lemmy.world 1 points 2 years ago

Yep. Use SSH keys, not just protocol.

On connection, it'll ask for your SSH password (this is different from the users password).

After that with something like authelia in place, you'll be asked for a 2fa code.

[-] MaggiWuerze@feddit.de 0 points 2 years ago

So, no. SSH can't do 2FA? I would need to set up Authelia and connect through that? I already use ssh keys instead of passwords to connect to my server

[-] lemmyreader@lemmy.ml 1 points 2 years ago

It is possible to have 2FA with a security key and ssh. Been on my to do list for some time to try it.

[-] foggy@lemmy.world 1 points 2 years ago

Yes it can. I literally have it set up right now.

When I connect to my vps I am promoted for the password for my SSH key. Only works on a machine that has the ssh key.

Then I need to use 2fa.

[-] MaggiWuerze@feddit.de 1 points 2 years ago

Ah, so it the asks for the TOTP provided by Authelia? I misunderstood, sorry. That's pretty cool. Do you maybe still have the guide you used to set that up?

this post was submitted on 20 Apr 2024
137 points (98.6% liked)

Selfhosted

62343 readers
890 users here now

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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

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

Questions? DM the mods!

founded 3 years ago
MODERATORS