this post was submitted on 17 Sep 2023
12 points (80.0% liked)

Selfhosted

40218 readers
1026 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
 

Hey guys,

I finally come around and started the journey of self-hosting and decided to get a VPS. After securing it, by making login via public-key default, I installed CasaOS and instantly regretted it since it now can be reached freely from the internet. A while ago, I read that you can limit the incoming connection to only VPN and ssh. And configured a Wireguard-VPN on the server via pivpn. But the server can still be reached from the internet. So what do I have to do now? Is it even the right choice, or am I missing something? How do you guys secure your VPS?

you are viewing a single comment's thread
view the rest of the comments
[–] notepass@feddit.de 2 points 1 year ago (2 children)

You can set up firewall rules that limit connections to certain ports. For example, you can disallow connections to everything but port 22 (which ssh runs on) to only allow access to the ssh server from outside. Same with VPN.

Read up on ufw (or iptables if you want to do it lower level and have a drink on hand).

[–] TexMexBazooka@lemm.ee 0 points 1 year ago (1 children)
[–] notepass@feddit.de 1 points 1 year ago (1 children)

ufw makes it way nicer to use tho. I only use iptables as I have a configuration script I wrote way back in the day.

[–] TexMexBazooka@lemm.ee 1 points 1 year ago (1 children)

Yeah UFW is the way to go, but when you run into an embedded Linux device that only runs iptables and can only be accessed via ssh?

Well…. Keep that drink handy

[–] notepass@feddit.de 1 points 1 year ago (1 children)

Yes, but how often does that happen to the average person?

[–] TexMexBazooka@lemm.ee 1 points 1 year ago

Deity of choice willing, never lol

[–] algenza@sos.nekoweb.my.id 0 points 1 year ago (1 children)

@notepass@feddit.de @rmstyle@feddit.de Also, you can change the SSH port to something not 22. Some guide here. To connect to SSH, just use ssh -p PORT site.com

[–] notepass@feddit.de 1 points 1 year ago

You can, but you should configure your server in a way that this shouldn't be a security feature of your setup (e.g. key-auth as OP did). It does help to cut back on uninvited guests a lot tho.