How to get local SSL and use your public domain for local internal subdomains?
from ComradeMiao@lemmy.dbzer0.com to selfhosted@lemmy.world on 19 Dec 15:18
https://lemmy.dbzer0.com/post/33697974

For instance how can I use my *.domain.com SSL certs and NPM to route containers to a subdomain without exposing them? The main domain is exposed.

#selfhosted

threaded - newest

just_another_person@lemmy.world on 19 Dec 15:27 next collapse

If you have wildcard certs, you just install them everywhere your services are running.

As far as redirects go, you just 302 redirect from one host to another.

Unless you’re asking about resolving hosts on your internal network and public ones differently, which is a lot more complicated than you probably want to deal with if you’re already kind of lost. Just setup a VPN to your internal network and be done with it. Otherwise setup a local DNS resolver to bridge your public DNS and local requests.

wildbus8979@sh.itjust.works on 19 Dec 15:37 next collapse

You can use the DNS verification method. Either using nsupdate with bind or what ever protocol your DNS provider and favorite ACME (certbot, acme, lego, etc) utility supports. As long as your DNS server is publically reachable that will work, even if the subdomain itself doesn’t exist publically.

just_another_person@lemmy.world on 19 Dec 16:09 next collapse

This is specifically info about LetsEncrypt, not general SSL.

wildbus8979@sh.itjust.works on 19 Dec 16:11 next collapse

Yes my answer is for use with Let’s Encrypt.

fine_sandy_bottom@lemmy.federate.cc on 19 Dec 22:19 collapse

I don’t really understand what you’re getting at. The answer to OPs question is to use letsencrypt like everyone else.

just_another_person@lemmy.world on 19 Dec 22:25 collapse

They literally didn’t mention LE at all.

SSL is not LetsEncrypt, if you didn’t know.

Max_P@lemmy.max-p.me on 20 Dec 05:33 next collapse

To add: a lot of cert providers also offer ACME so while the primary user of ACME is LetsEncrypt, you can use the same tech and validations as LetsEncrypt on other vendors too.

[deleted] on 20 Dec 07:08 collapse
.
thumdinger@lemmy.world on 19 Dec 18:52 collapse

This is what I do as well. I have a public DNS record for my internal reverse proxy IP (no need to expose my public IP and associate it with my domain). I let NPM reach out to the DNS provider to complete verification challenge using an account token, NPM can then get a valid cert from Let’s Encrypt and nothing is exposed. All inbound traffic on 80/443 remains blocked as normal.

fine_sandy_bottom@lemmy.federate.cc on 19 Dec 22:21 collapse

This is the way.

Vastly superior to local dns.

ag10n@lemmy.world on 19 Dec 15:41 next collapse

freecodecamp.org/…/docker-nginx-letsencrypt-easy-…

wildbus8979@sh.itjust.works on 19 Dec 15:52 collapse

OP is asking for cases where you don’t want to allow the service (or reverse proxy) to be accessible via the web.

ag10n@lemmy.world on 19 Dec 15:57 next collapse

public domain for internal services

I guess they need a CA then

smallstep.com/docs/step-ca/

wildbus8979@sh.itjust.works on 19 Dec 15:58 collapse

They do not. See my other reply about DNS verification.

ag10n@lemmy.world on 19 Dec 16:05 collapse

Your response clearly states publicly accessible DNS. A CA does not require anything public for local SSL and can work in conjunction with whatever service they want for that which is public.

wildbus8979@sh.itjust.works on 19 Dec 16:09 collapse

Fair, I don’t know why I read OPs post as asking for let’s encrypt certs. Internal CA is indeed an option.

NeoNachtwaechter@lemmy.world on 19 Dec 15:58 collapse

As I understand it, OP just wants to hide (=remove) the subdomains from the public URLs.

[deleted] on 19 Dec 15:45 next collapse
.
digdilem@lemmy.ml on 19 Dec 15:56 next collapse

How we’ve done it recently:

  1. Put domain on cloudflare or another registrar that supports an API. Generate a token with the right privs.
  2. Use certbot with the cloudflare plugin, and that token, and generate whatever certs you need within that domain using the DNS01 method.

No need to have port 80 open to the world, no need for a reverse proxy, no need for NAT rules to point it to the right machine, no need to even have DNS set up for the hostname. All of that BS is removed.

The token proves your authentication and LetsEncrypt will generate the certs.

slazer2au@lemmy.world on 19 Dec 16:54 next collapse

Split DNS on your LAN?

Only records permitted to be access on your LAN are responded by a local DNS server. While public DNS still available for your public facing services.

Your wildcard cert will work for both situations as the browser only cares the sni matches the Url in your address bar.

bigdickdonkey@lemmy.ca on 19 Dec 22:05 collapse

I’m using this right now but I’m switching to having all my services under one domain and blocking non internal ips. Technically someone can access your site by providing the host manually, althought it’s unlikely since they would need to know it

derek@infosec.pub on 20 Dec 15:33 collapse

Would you expanding in this concern? I’m not sure I understand but I’d like to.

mhzawadi@lemmy.horwood.cloud on 19 Dec 16:59 next collapse

I have that setup, my domain is hosted by OVh and they have an API that you can use to get a wildcard certificate with.

At home I run pihole and that has some sites in as local IPs, but if you look the same site up from OVH you would get an internet IP

Lem453@lemmy.ca on 20 Dec 05:15 next collapse

I do exactly this with traefik.

ie: Seafile.domain.com

Vaultwarden.local.domain.com

I followed this guide: youtu.be/liV3c9m_OX8

GoMati@lemmy.world on 20 Dec 06:28 collapse

I recommend this one instead: youtu.be/n1vOfdz5Nm8

Same guy, just fresh version of Traefik 😁

possiblylinux127@lemmy.zip on 20 Dec 06:46 collapse

You need a DNS service that works with Let’s encrypt

ComradeMiao@lemmy.dbzer0.com on 20 Dec 14:24 collapse

NPM is in my post…

MangoPenguin@lemmy.blahaj.zone on 20 Dec 14:31 next collapse

Then you’re all set, issue certs over DNS-01 challenge in NPM, and create records in your local DNS server that point to the NPM IP for each domain you want to use.

possiblylinux127@lemmy.zip on 20 Dec 17:03 collapse

I don’t get it. Npm is a package manager. It doesn’t handle certificates.

You need a DNS service like route 53 (AWS) or similar where let’s encrypt connects via an API and creates the DNS token.

coolie4@lemmy.world on 20 Dec 21:51 collapse

OP isn’t referring to the package manager. They’re talking about Nginx Proxy Manager

possiblylinux127@lemmy.zip on 20 Dec 21:58 collapse

Oh

That makes sense. We need to stop making two things use the same acronym. Its like people saying HA for home assistant without realizing that HA is normally used for high availability.