Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. How do I use HTTPS on a private LAN without self-signed certs?

How do I use HTTPS on a private LAN without self-signed certs?

Scheduled Pinned Locked Moved Selfhosted
selfhosted
51 Posts 37 Posters 196 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W [email protected]

    for every single subdomain, on desktop. firefox mobile does not even remember the decision. HA Android straight out refuses it, and thats not a local problem but a relatively known problem in the community

    F This user is from outside of this forum
    F This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #38

    Import it into the trust store in the browser/OS. It should be the same operation for a self-signed cert and a CA that isn't subordinate to the standard internet root CAs.

    If you can't import your own root CA cert then you're probably screwed on both fronts and are going to have to use a public CA that's subordinate to a commonly trusted root CA.

    1 Reply Last reply
    0
    • F [email protected]

      Running your own CA is essentially still a form of self signed. Though it will work better for some use cases (at the cost of more complexity)

      I This user is from outside of this forum
      I This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #39

      I know what you mean but using real self-signed certificates (i.e. no CA at all) with modern browsers causes so many issues I find them unusable.

      1 Reply Last reply
      0
      • W [email protected]

        for every single subdomain, on desktop. firefox mobile does not even remember the decision. HA Android straight out refuses it, and thats not a local problem but a relatively known problem in the community

        N This user is from outside of this forum
        N This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #40

        Just create a wildcard domain certificate !

        I access all my services in my lan through https://servicename.home.lab/ I just had to add the rootCA certificat (actually the intermediate certificate) into my trust store on every device. That's what they actually do, just in automated way !

        Never had an issue to access my services with my self-signed certs, neither on Android, iOS, windows, linux ! Everything served from my server via my reverse proxy of choice (Treafik).

        However I do remember that there was something of importance to make my Android device accept the certificate (something in certificate itself and the extension).

        If you're interested I can send you the snipped of a book to fully host your own CA :). It's a great read and easy to follow !

        W 1 Reply Last reply
        0
        • C [email protected]

          FYI, all the certs you generate are public record, so it might be a good idea to use a wildcard route in Caddy. That will make it only generates one cert, so no one can find your internal domain names. Especially if your Caddy instance is accessible from the Internet, and you’re expecting external connections not to be able to access domains with only internal DNS records

          douglasg14b@lemmy.worldD This user is from outside of this forum
          douglasg14b@lemmy.worldD This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #41

          That's a good call out.

          There are a few things I do right now:

          1. All of my public DNS entries for the certs point at cloudflare, not my IP.
          2. My internal Network DNS resolver will resolve those domains to an internal address
          3. I drop all connections to those domains in cloudflare with rules
          4. In caddy, I drop all connections that come from a non-internal IP range for all internal services
          5. I use tailscale to avoid having to have routes from the Internet into my internal services for when I'm not at home.
          6. For externally accessible routes, I have entirely separate configurations that proxy access to them. And external DNS still points to cloudflare, which has very restrictive rules on allowable connections.
          1 Reply Last reply
          0
          • L [email protected]

            When somebody says they "just" reverse the polarity of the navigational deflector array and channel power directly from the warp core.

            douglasg14b@lemmy.worldD This user is from outside of this forum
            douglasg14b@lemmy.worldD This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #42

            In this case I run pfSense instead of my ISP provided router. This allows me to have my own DNS resolver, which I can then resolve various domains to internal addresses.

            All devices on my network point to my router for DNS allowing them to resolve internal addresses from all of these.

            L 1 Reply Last reply
            0
            • ? Guest

              Maybe this is more of a home lab question, but I'm utterly clueless regarding PKI and HTTPS certs, despite taking more than one class that goes into some detail about how the system works. I've tried finding guides on how to set up your own CA, but my eyes glaze over after the third or fourth certificate you have to generate.

              Anyway, I know you need a public DNS record for HTTPS to work, and it struck me recently that I do in fact own a domain name that I currently use as my DNS suffix on my LAN. Is there a way I can get Let's Encrypt to dole out a wildcard certificate I can use on the hosts in my LAN so I don't have to fiddle with every machine that uses every service I'm hosting? If so, is there a guide for the brain dead one could point me to? Maybe doing this will help me grock the whole PKI thing.

              R This user is from outside of this forum
              R This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #43

              Not sure if anyone else mentioned this, but you can just redirect traffic on your local LAN with an ad blocker like pihole ( I currently use adguardhome podman instance )

              Basically, it rewrites any calls to your outside domain from within your local network, back to your local web server. As long as the site is setup with the certificate there, you’re good.

              Then setup a Nina nginx reverse proxy and you’re golden. Regular site outside LAN, internal site inside LAN.

              1 Reply Last reply
              0
              • douglasg14b@lemmy.worldD [email protected]

                In this case I run pfSense instead of my ISP provided router. This allows me to have my own DNS resolver, which I can then resolve various domains to internal addresses.

                All devices on my network point to my router for DNS allowing them to resolve internal addresses from all of these.

                L This user is from outside of this forum
                L This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #44

                Thanks, I'll lookup pfSense. But straightforward host mapping has worked for me in the past with this router and others. It worked great on my old Cisco DSL router 25 years ago. So simple and straightforward, it should just freaking work. sigh

                1 Reply Last reply
                0
                • mouse@midwest.socialM [email protected]

                  I use Caddy for this. I'll leave links to the documentation as well as a few examples.

                  Here's the documentation for wildcard certs.
                  https://caddyserver.com/docs/automatic-https#wildcard-certificates

                  Here's how you add DNS providers to Caddy without Docker.
                  https://caddy.community/t/how-to-use-dns-provider-modules-in-caddy-2/8148

                  Here's how you do it with Docker.
                  https://github.com/docker-library/docs/tree/master/caddy#adding-custom-caddy-modules

                  Look for the DNS provider in this repository first.
                  https://github.com/caddy-dns

                  Here's documentation about using environment variables.
                  https://caddyserver.com/docs/caddyfile/concepts#environment-variables

                  Docker

                  A few examples of Dockerfiles. These will build Caddy with DNS support.

                  DuckDNS

                  FROM caddy:2-builder AS builder
                  RUN xcaddy build --with github.com/caddy-dns/duckdns
                  
                  FROM caddy:2
                  COPY --from=builder /usr/bin/caddy /usr/bin/caddy
                  

                  Cloudflare

                  FROM caddy:2-builder AS builder
                  RUN xcaddy build --with github.com/caddy-dns/cloudflare
                  
                  FROM caddy:2
                  COPY --from=builder /usr/bin/caddy /usr/bin/caddy
                  

                  Porkbun

                  FROM caddy:2-builder AS builder
                  RUN xcaddy build --with github.com/caddy-dns/porkbun
                  
                  FROM caddy:2
                  COPY --from=builder /usr/bin/caddy /usr/bin/caddy
                  

                  Configure DNS provider

                  This is what to add the the Caddyfile, I've used these in the examples that follow this section.
                  You can look at the repository for the DNS provider to see how to configure it for example.

                  DuckDNS

                  https://github.com/caddy-dns/cloudflare?tab=readme-ov-file#caddyfile-examples

                  tls {
                  	dns duckdns {env.DUCKDNS_API_TOKEN}
                  }
                  

                  CloudFlare

                  https://github.com/caddy-dns/cloudflare?tab=readme-ov-file#caddyfile-examples
                  Dual-key

                  tls {
                  	dns cloudflare {
                  		zone_token {env.CF_ZONE_TOKEN}
                  		api_token {env.CF_API_TOKEN}
                  	}
                  }
                  

                  Single-key

                  tls {
                  	dns cloudflare {env.CF_API_TOKEN}
                  }
                  

                  PorkBun

                  https://github.com/caddy-dns/porkbun?tab=readme-ov-file#config-examples
                  Global

                  {
                  	acme_dns porkbun {
                  			api_key {env.PORKBUN_API_KEY}
                  			api_secret_key {env.PORKBUN_API_SECRET_KEY}
                  	}
                  }
                  

                  or per site

                  tls {
                  	dns porkbun {
                  			api_key {env.PORKBUN_API_KEY}
                  			api_secret_key {env.PORKBUN_API_SECRET_KEY}
                  	}
                  }
                  

                  Caddyfile

                  And finally the Caddyfile examples.

                  DuckDNS

                  Here's how you do it with DuckDNS.

                  *.example.org {
                          tls {
                                  dns duckdns {$DUCKDNS_TOKEN}
                          }
                  
                          @hass host home-assistant.example.org
                          handle @hass {
                                  reverse_proxy home-assistant:8123
                          }
                  }
                  

                  Also you can use environment variables like this.

                  *.{$DOMAIN} {
                          tls {
                                  dns duckdns {$DUCKDNS_TOKEN}
                          }
                  
                          @hass host home-assistant.{$DOMAIN}
                          handle @hass {
                                  reverse_proxy home-assistant:8123
                          }
                  }
                  

                  CloudFlare.

                  *.{$DOMAIN} {
                          tls {
                  	        dns cloudflare {env.CF_API_TOKEN}
                          }
                  
                          @hass host home-assistant.{$DOMAIN}
                          handle @hass {
                                  reverse_proxy home-assistant:8123
                          }
                  }
                  

                  Porkbun

                  *.{$DOMAIN} {
                          tls {
                  	        dns porkbun {
                  			api_key {env.PORKBUN_API_KEY}
                  			api_secret_key {env.PORKBUN_API_SECRET_KEY}
                  	        }
                          }
                  
                          @hass host home-assistant.{$DOMAIN}
                          handle @hass {
                                  reverse_proxy home-assistant:8123
                          }
                  }
                  
                  S This user is from outside of this forum
                  S This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #45

                  I did basically this w/ Cloudflare, and it worked perfectly. I used to do ACME requests, but this is simpler and doesn't require me to route traffic into my LAN. I now expose a handful of services, but I used to have to expose all services for TLS cert renewal to work.

                  1 Reply Last reply
                  0
                  • T [email protected]

                    Thanks for being so detailed!

                    I use caddy for straightforward https, but every time I try to use it for a service that isn't just a reverse_proxy entry, I really struggle to find resources I understand... and most of the time the "solutions" I find are outdated and don't seem to work. The most recent example of this for me would be Baikal.

                    Do you have any recommendations for where I might get good examples and learn more about how do troubleshoot and improve my Caddyfile entries?

                    Thanks!

                    S This user is from outside of this forum
                    S This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #46

                    Baikal

                    Ah, PHP, there's your problem. 😀

                    Honestly, I just proxy to a separate nginx server to handle the PHP bits, it's not worth cluttering up my nice, clean Caddy setup with that nonsense.

                    1 Reply Last reply
                    0
                    • 4 [email protected]

                      If you are really looking for hassle-free this is it. LetsEncrypt root certificates are already trusted by most devices so when your friends come over and wanna control the media library or whatever you don’t need to install your locally hosted CA’s self-signed certificates on their phone.

                      Also certbot and a cron or systemd timer is all you need; people have rolled all these fancy solutions but I say keep it simple.

                      S This user is from outside of this forum
                      S This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #47

                      Adding to this, the eff certbot website has really great noob-friendly instructions which really helped me get set up.

                      1 Reply Last reply
                      0
                      • N [email protected]

                        Just create a wildcard domain certificate !

                        I access all my services in my lan through https://servicename.home.lab/ I just had to add the rootCA certificat (actually the intermediate certificate) into my trust store on every device. That's what they actually do, just in automated way !

                        Never had an issue to access my services with my self-signed certs, neither on Android, iOS, windows, linux ! Everything served from my server via my reverse proxy of choice (Treafik).

                        However I do remember that there was something of importance to make my Android device accept the certificate (something in certificate itself and the extension).

                        If you're interested I can send you the snipped of a book to fully host your own CA :). It's a great read and easy to follow !

                        W This user is from outside of this forum
                        W This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #48

                        Just create a wildcard domain certificate !

                        that's what I do already, but yeah I haven't added it to the trust store so far, only on linux for git and curl

                        If you're interested I can send you the snipped of a book to fully host your own CA :). It's a great read and easy to follow !

                        that would be interesting, thanks for the offer. but according to plan I don't want to host a full-on CA, just make the CA cert, store them at a restricted place, and build other certs on top of it for use by nginx

                        N 1 Reply Last reply
                        0
                        • ? Guest

                          Maybe this is more of a home lab question, but I'm utterly clueless regarding PKI and HTTPS certs, despite taking more than one class that goes into some detail about how the system works. I've tried finding guides on how to set up your own CA, but my eyes glaze over after the third or fourth certificate you have to generate.

                          Anyway, I know you need a public DNS record for HTTPS to work, and it struck me recently that I do in fact own a domain name that I currently use as my DNS suffix on my LAN. Is there a way I can get Let's Encrypt to dole out a wildcard certificate I can use on the hosts in my LAN so I don't have to fiddle with every machine that uses every service I'm hosting? If so, is there a guide for the brain dead one could point me to? Maybe doing this will help me grock the whole PKI thing.

                          const_void@lemmy.mlC This user is from outside of this forum
                          const_void@lemmy.mlC This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #49

                          HAProxy + Cloudflare

                          1 Reply Last reply
                          0
                          • W [email protected]

                            Just create a wildcard domain certificate !

                            that's what I do already, but yeah I haven't added it to the trust store so far, only on linux for git and curl

                            If you're interested I can send you the snipped of a book to fully host your own CA :). It's a great read and easy to follow !

                            that would be interesting, thanks for the offer. but according to plan I don't want to host a full-on CA, just make the CA cert, store them at a restricted place, and build other certs on top of it for use by nginx

                            N This user is from outside of this forum
                            N This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #50

                            If you change your mind someday, just send me a PM !

                            1 Reply Last reply
                            0
                            • ? Guest

                              Maybe this is more of a home lab question, but I'm utterly clueless regarding PKI and HTTPS certs, despite taking more than one class that goes into some detail about how the system works. I've tried finding guides on how to set up your own CA, but my eyes glaze over after the third or fourth certificate you have to generate.

                              Anyway, I know you need a public DNS record for HTTPS to work, and it struck me recently that I do in fact own a domain name that I currently use as my DNS suffix on my LAN. Is there a way I can get Let's Encrypt to dole out a wildcard certificate I can use on the hosts in my LAN so I don't have to fiddle with every machine that uses every service I'm hosting? If so, is there a guide for the brain dead one could point me to? Maybe doing this will help me grock the whole PKI thing.

                              F This user is from outside of this forum
                              F This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #51

                              I used to do what you do, just sub-domains for everything. I eventually set up an internal CA for *.lan and install the CA cert on all devices.

                              It's actually more secure, since I dont rely on a third-party for certs and have full control over pinning.

                              1 Reply Last reply
                              0
                              • System shared this topic on
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups