this post was submitted on 11 Jul 2023
26 points (96.4% liked)

Selfhosted

40246 readers
944 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:

  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!

founded 1 year ago
MODERATORS
 

Hi there, I've been reading up on selfhosting for a couple of weeks now and I got my feet wet with a couple of things.

However, before really getting serious with it, I feel I need to get down the basics and make sure that my server will not end up a security hazard. My final goal would be to self-host my socials (Mastodon, Lemmy, Matrix) - just for myself.

What basic security do I need to have in place, considering these services? I'll be running this on a VPS and so far I consider the following: disable password login (login with ssh key only) then set up nginx, fail2ban, and a basic firewall. I'd try to close all ports that are not required for the services I run. I'll also change ssh port from 22 to something else and close port 22 as well.

Would this be a sufficient basis, or am I missing something crucial?

Bonus question: do you know of good tutorials to learn the above stuff? I've been following the guides on DigitalOcean (e.g. https://www.digitalocean.com/community/tutorials/how-to-protect-an-nginx-server-with-fail2ban-on-ubuntu-20-04) and they seem decent enough - but I think I'll need to get into more depth than that :)

you are viewing a single comment's thread
view the rest of the comments
[–] EncryptKeeper@lemmy.world 1 points 1 year ago* (last edited 1 year ago) (1 children)

Your plan is solid. The important thing is that you configure those things correctly, but you’re following guides so that should be ok. It’s on a VPS so there’s no threat to your home network, and none of those services pose a significant risk to you even if they were compromised so there’s no reason to go overboard.

If I had any further advice to give it’d be:

  • Change any default usernames and passwords that any of your apps/databases use.

  • Use randomly generated passwords for all service accounts. So that if you do find yourself compromised, they don’t then know a password that you’ve reused somewhere else (like your email account).

  • Run those services using something like Docker with no access to each other.

  • Utilize your VPS provider’s cloud firewall if they have one. If you’re paying for a cheap VM, it shouldn’t need to deal with all the general firewalling from the internet. VPS providers often have free cloud firewalls you can offload that work to.

[–] german@pawb.social 1 points 1 year ago

Docker is the way to go. More often than not self-hosted stuff already has docker instructions, and by design it doesn’t mount your entire drive or give access to really anything on your system unless defined explicitly, even networks are isolated iirc. OP, get educated on what docker is and what flags it has so you can easily see what has access to what before even spinning something up.