5

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

top 6 comments
sorted by: hot top controversial new old
[-] rikudou@lemmings.world 1 points 1 year ago

Changing the port seems like a pointless step, just disallow access from everywhere and allow only from select IPs. Port scanners will scan all open ports and will detect that it's ssh, regardless of port number.

[-] PlexSheep@feddit.de 2 points 1 year ago

Agreed. Security through obscurity is a fallacy.

If OP just wants to use it himself, a good idea might be to setup a VPN service and only allow the other services to be used from the VPN. That can be done with wire guard and a reverse proxy for example.

[-] animist@lemmy.one -2 points 1 year ago

While I do completely agree, changing ports is more about getting rid of low-hanging fruit so some script kiddie doesn't get into 22. But again I do agree with everything you said.

[-] rikudou@lemmings.world 2 points 1 year ago

Just firewall the port and there's no difference for your hypothetical script kiddies. Don't ever do security by obscurity.

[-] PlexSheep@feddit.de 1 points 1 year ago

Of you have Skript kiddies logging in successfully on 22, you have way different problems.

Of course, changing a port number is not a good security improvement even in the realm of security through obscurity.

[-] baltakatei@sopuli.xyz 1 points 1 year ago* (last edited 1 year ago)

Maybe try out FreedomBox? freedombox is a Debian package which automatically sets up apache2, firewalld, fail2ban and Letʼs Encrypt. It also automatically adds pre-canned configuration files for applications you install with it (e.g. Mediawiki, WordPress, Matrix, Postfix/Dovecot). The theoretical goal of FreedomBox is to allow anyone to set up a webserver and administer it via a webUI. So, although I would say itʼs not quite there yet for command-line-illiterate users, I have found the software useful as a turnkey server to see what makes certain web applications tick, albeït in mostly vanilla form.

For example, after installing a new app like WordPress, you could examine what exactly the FreedomBox scripts changed in the /etc/apache2/ or /etc/fail2ban/ configuration files.

this post was submitted on 11 Jul 2023
5 points (100.0% liked)

Selfhosted

40153 readers
215 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