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.

  • slazer2au
    link
    fedilink
    English
    1218 hours ago

    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
      link
      fedilink
      English
      113 hours ago

      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

  • @wildbus8979@sh.itjust.works
    link
    fedilink
    English
    14
    edit-2
    19 hours ago

    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.

    • @thumdinger@lemmy.world
      link
      fedilink
      English
      516 hours ago

      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
        link
        English
        113 hours ago

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

          • Max-P
            link
            fedilink
            English
            35 hours ago

            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.

  • Matt The Horwood
    link
    fedilink
    English
    418 hours ago

    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

  • DigitalDilemma
    link
    fedilink
    English
    319 hours ago

    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.

  • @just_another_person@lemmy.world
    link
    fedilink
    English
    0
    edit-2
    19 hours ago

    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.