this post was submitted on 14 Jun 2023
15 points (94.1% liked)

Selfhosted

39158 readers
380 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 all! For the longest time I've had a server that hosts some things (eg Syncthing), but is only available via SSH tunneling.

I've been thinking of self-hosting more things like Nextcloud and Vaultwarden. I can keep my SSH tunneling setup but it might make it difficult to do SSL.

How do you manage the security of having public-facing servers?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 1 year ago* (last edited 1 year ago) (1 children)

Here is my setup:

Cloudflare fronts all of my webserver traffic, and I have firewall rules in Cloudflare.

Then I have an OPNsense firewall that blocks a list of suspicious ips that updates automatically, and only allows port 80/443 connections from Cloudflare's servers. The only other port I have open is for Wireguard to access all of my internal services. This does not go through Cloudflare obviously, and I use a different domain for my actual IP. I keep Vaultwarden internal for extra safety.

Next I run every internet facing service in k3s in a separate namespace. This namespace has its own traefik reverse proxy separate from my internal services. This is what port 80/443 forwards to. The namespace has network policies that prevent any egress traffic to my local network. Every container in the WAN facing namespace runs as a user with no login permission to the host. I am also picky about what storage I mount in them.

If you can get through that you deserve my data I think.

[–] [email protected] 1 points 1 year ago (1 children)

I need to learn more about cloudflare. Do you have the guide for this setup!

[–] [email protected] 3 points 1 year ago (1 children)

Unfortunately no guide, just things I've pieced together myself over the years.

Cloudflare is probably the easiest and most intuitive part of the setup though, you can setup dns/proxy/firewall rules very intuitively, and I'm sure there are plenty of guides out there.

[–] [email protected] 3 points 1 year ago (2 children)

Becarefull not everything is allowed true clousflare. I believe officialy only web content is. So having nextcloud behind it for example to upload and download files. Is as far as i am aware against the TOS.

[–] [email protected] 3 points 1 year ago (2 children)

@kylian0087 @hib It used to be but the updated TOS removed the mention of file types and it seems that using media traffic is allowed as per the latest TOS.

[–] [email protected] 1 points 1 year ago

Oh that is really nice! Time to make some changes in then!

[–] [email protected] 1 points 1 year ago

I was looking into this for Plex the other day. There's some conflicting information on the internet right now. From what I can tell, large non-HTML content still seems to be against their ToS, unless you're an Enterprise customer or serving the files/media with CloudFlare's R2 or Stream services. I hope I'm wrong though, if someone can confirm.

This post from CloudFlare explains the recent changes to their ToS, and the CDN ToS appears to disallow media or large file content.

[–] chonk 1 points 1 year ago

To clarify, that is only the Cloudflare Tunnel service that has the "only do web traffic" ToS rule. Tunnel is their service that eliminates the need for port forwarding from your home network.

My understanding is that cloudflare DNS can also be a reverse proxy for you and still provide some benefit your security (though, unlike the tunnel service, you do need to expose ports from your home network to the internet).