this post was submitted on 07 Jul 2024
78 points (98.8% liked)

Selfhosted

40120 readers
1553 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
 

I want my self hosted things to use https. For example, I have Jellyfin installed via docker, and I want it to use https instead of http.

I don't care about necessarily doing this the "right" way, as I won't be making Jellyfin or any other service public, and will only be using it on my local network.

What is the easiest way to do this? Assume everything I host is in docker. Also a link to a tutorial would be great.

Thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] hperrin@lemmy.world 55 points 4 months ago (6 children)

The easiest way to do it is to do it the right way with LetsEncrypt. The hardest way to do it is the wrong way, where you create your own CA, import it as a root CA into all of the machines you’ll be accessing your servers from, then create and sign your own certs using your CA to use in your servers.

[–] khorak@lemmy.dbzer0.com 18 points 4 months ago

This, letsencrypt with dns challenge, https://desec.io/ to manage the dns records https://github.com/go-acme/lego or traefik to manage the certificates and do the dns challenges for you.

[–] TCB13@lemmy.world 14 points 4 months ago (1 children)

Yes, LetsEncrypt with DNS-01 challenge is the easiest way to go. Be it a single wildcard for all hosts or not.

Running a CA is cool however, just be aware of the risks involved with running your own CA.

You’re adding a root certificate to your systems that will effectively accept any certificate issued with your CA’s key. If your PK gets stolen somehow and you don’t notice it, someone might be issuing certificates that are valid for those machines. Also real CA’s also have ways to revoke certificates that are checked by browsers (OCSP and CRLs), they may employ other techniques such as cross signing and chains of trust. All those make it so a compromised certificate is revoked and not trusted by anyone after the fact.

[–] Findmysec@infosec.pub 4 points 4 months ago* (last edited 4 months ago) (1 children)

Running a CA is cool however, just be aware of the risks involved with running your own CA.

All they say that if the private key is stolen then you're screwed. Think about it, if an attacker can:

  1. Get into your network.
  2. Presumably bypass key-based ssh/container runtime protections
  3. Access pod/VM which is running the CA
  4. Bypass default MAC settings (Apparmor on debian, SELinux on RHEL)
  5. Steal private key without you knowing from your logs

You have a much bigger problem my friend

[–] TCB13@lemmy.world 1 points 4 months ago* (last edited 4 months ago)

While I agree with you, an attacker may not need to go to such lengths in order to get the PK. The admin might misplace it or have a backup somewhere in plain text. People aren't also prone to look to logs and it might be too late when they actually noticed that the CA was compromised.

Managing an entire CA safely and deploying certificates > complex; Getting let's encrypt certificates using DNS challenges > easy;

[–] scrubbles@poptalk.scrubbles.tech 9 points 4 months ago

Tried that once. It was not a fun route to go down. If let's encrypt ever dies it anything fine, I'll look into it again. Until then, let's encrypt all the way

[–] Findmysec@infosec.pub 7 points 4 months ago (1 children)

why is creating one's own CA the wrong way? I don't want to have to pay cloudflare or porkbun to run HTTPS at home

[–] hperrin@lemmy.world 0 points 4 months ago* (last edited 4 months ago) (1 children)

Because you have to manage it on your server and all your own machines, and it doesn’t provide any value if your server is hacked. It actually makes you less safe if your server is hacked, because then you can consider every machine that has that CA as compromised. There’s no reason to use HTTPS if you’re running your own CA. If you don’t trust your router, you shouldn’t trust anything you do on your network. Just use HTTP or use a port forward to localhost through ssh if you don’t trust your own network.

You don’t have to pay anyone to use HTTPS at home. Just use a free subdomain and HTTP validation for certbot.

[–] irotsoma@lemmy.world 3 points 4 months ago

I agree that it's the wrong way, but not because of any of this other than the first half of the first sentence.

It's the hard/wrong way because it means you are having to be responsible for securing the root cert private keys and because most people will do it wrong and set up a root cert with the ability to sign not just tls certs, and that's where the problems can occur if the keys are compromised and you've set up all of your machines to trust it.

But it's also not true that you shouldn't use HTTPS or that you should trust your own network, not because of the router, but because of the devices. People don't control their devices anymore. Many home automation devices, nanny cams, security devices, water leak detectors, etc., contain firmware that is poorly configured and can easily expose your network traffic if it's not encrypted. Not to mention a lot of apps these days on smartphones are Trojans for spyware, Temu, WeChat, etc.

And as for cost, you can get a domain name for a few dollars per year or as mentioned, a subdomain from something like a DDNS service, so it definitely can be totally free to do it the right way.

[–] mhzawadi@lemmy.horwood.cloud 4 points 4 months ago

I use the OVH plugin to get a wildcard cert for my homelab, that way I can spin up anything and its covered by the cert.

Also, Proxmox and PFSense use the OVH let's encrypt plugin to be secured as well

[–] philpo@feddit.de 3 points 4 months ago

Yeah. Exactly how I do it. .casa domain to distinguish it from my other domains, DNS challenge and I am good.

Proxmox and OPN Sense work with it themselves, for everything else I use NPM on Proxmox. Couldn't be more happy with that solution.