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.
  • ? 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.

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

    If you own a domain, which you do, you can get wildcard certs from Let's Encrypt using a DNS challenge. Most (all?) popular reverse proxies can do this either natively or via an addon/module, you just need to use a supported DNS provider.

    1 Reply Last reply
    0
    • ? Guest

      Cool. Follow up question: Do I generate the cert once and distribute the same private key to all the servers I'm running? I'm guessing not, but does that mean I run the certbot command on every server?

      ptz@dubvee.orgP This user is from outside of this forum
      ptz@dubvee.orgP This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #12

      I have a single Nginx setup which is the frontend for all my web services. So I only need to deploy it there (and to its HA partner). My renewal script just scp's it to the secondary and does an nginx -s reload on both.

      I do generate separate certs/keys for my non-web servers, but there's only two of those.

      You could also, if you wanted, just generate one cert and distribute it and its key to everything with a script or other automation tool (Ansible is what I used to use).

      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.

        mouse@midwest.socialM This user is from outside of this forum
        mouse@midwest.socialM This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #13

        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
                }
        }
        
        E T C M S 5 Replies 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.

          lemmchen@feddit.orgL This user is from outside of this forum
          lemmchen@feddit.orgL This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #14

          Some form of domain and a DNS server (router or Pi-Hole) in your LAN

          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.

            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
            #15

            Reverse proxy + DNS-challenge wildcard cert for your domain. The end. Super easy to set up and zero maintenance. Adding a new service is just a couple clicks in your reverse proxy and you’re done.

            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.

              zebragoose@sh.itjust.worksZ This user is from outside of this forum
              zebragoose@sh.itjust.worksZ This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #16

              I did follow this guide from Techno Tim, he uses cloudflare but you can go with Lets encrypt aswell

              https://www.youtube.com/watch?v=liV3c9m_OX8

              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
                        }
                }
                
                E This user is from outside of this forum
                E This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #17

                thank you for providing such a thorough reply, good shit

                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
                          }
                  }
                  
                  T This user is from outside of this forum
                  T This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #18

                  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!

                  mouse@midwest.socialM S 2 Replies 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
                            }
                    }
                    
                    C This user is from outside of this forum
                    C This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #19

                    I do the same!

                    I have a provider that is not supported by caddy, but I can still use it via duckdns delegation!

                    https://github.com/caddy-dns/duckdns?tab=readme-ov-file#challenge-delegation

                    Challenge delegation

                    To obtain a certificate using ACME DNS challenges, you'd use this module as described above. But, if you have a different domain (say, my.example.com) CNAME'd to your Duck DNS domain, you have two options:

                    1. Not use this module: Use a module matching the DNS provider for my.example.com.
                    2. Delegate the challenge to Duck DNS.
                    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.

                      ? Offline
                      ? Offline
                      Guest
                      wrote on last edited by
                      #20

                      +1 for the letsencrypt wildcard with DNS verification, been using this for years. with dehydrated (https://github.com/dehydrated-io/dehydrated) you can automate renewing the certs, pretty convenient.

                      One thing i didn't see mentioned yet - you can also easily create a wildcard for a subdomain of your domain, e.g. *.local.example.com.
                      Most DNS providers let you define something like _acme-challenge.local IN TXT ... so you don't even need to define an extra zone for local.example.com.
                      Probably makes no big difference, but i like it ^^

                      4 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.

                        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
                        #21

                        I'll mention this as no one has yet but you can be your own CA. Tools like mkcert make it easy

                        https://github.com/FiloSottile/mkcert

                        This is potentially more hassle (than using public DNS) as you have to get your CA certs onto every device. However it may be suitable depending on the situation.

                        F 1 Reply Last reply
                        0
                        • ? Guest

                          +1 for the letsencrypt wildcard with DNS verification, been using this for years. with dehydrated (https://github.com/dehydrated-io/dehydrated) you can automate renewing the certs, pretty convenient.

                          One thing i didn't see mentioned yet - you can also easily create a wildcard for a subdomain of your domain, e.g. *.local.example.com.
                          Most DNS providers let you define something like _acme-challenge.local IN TXT ... so you don't even need to define an extra zone for local.example.com.
                          Probably makes no big difference, but i like it ^^

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

                          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 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.

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

                            The most straightforward thing to do, on a private LAN, is to make all your own certs, from a custom root cert, and then manually install that cert as "trusted" on each machine. If none of the machines on this network need to accessed from outside the LAN, then you're golden.

                            1 Reply Last reply
                            1
                            • 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!

                              mouse@midwest.socialM This user is from outside of this forum
                              mouse@midwest.socialM This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #24

                              Unfortunately that's one area I am bad with, I tend to use reverse_proxy for most such as Baikal running with the ckulka/baikal Docker image (which runs Nginx or Apache), otherwise I only static sites.

                              I'd start by looking at Baikal's config for Apache and Nginx, https://sabre.io/baikal/install/ and comparing to the directives for Caddy, https://caddyserver.com/docs/caddyfile/directives and

                              Since it uses PHP, it will need that, https://caddyserver.com/docs/caddyfile/patterns#php

                              Upon my searches I came across this, it talks about running Baikal with Caddy specifically. https://github.com/caddyserver/caddy/issues/497

                              I hope that this provided some helpful directions.

                              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.

                                mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
                                mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #25

                                LetsEncrypt.

                                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.

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

                                  With certbot there's probably a plugin to do it automatically, but if you just want to get something working right now you can run the following to manually run a dns challenge against your chosen domain names and get a cert for any specified. This will expire in ~3 months and you'll need to do it again, so I'd recommend throwing it in a cron job and finding the applicable certbot-dns-dnsprovider plugin that will make it run without your input. Once you have it working you can extract the certs from /etc/letsencrypt/live on most systems. Just be aware that the files there are going to be symlinks so you'll want to copy them before tarballing them to move other machines.

                                  certbot --preferred-challenges dns --manual certonly -d *.mydomain.tld -d mydomain.tld -d *.local.mydomain.tld

                                  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.

                                    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
                                    #27

                                    I just:

                                    1. Have my router setup with DNS for domains I want to direct locally, and point them to:
                                    2. Have a reverse proxy that has auto- certbot behavior (caddy) connected to the cloud flair API
                                    3. Navigation I do within my local network to these domains gives me real certificates.
                                    C L 2 Replies Last reply
                                    0
                                    • douglasg14b@lemmy.worldD [email protected]

                                      I just:

                                      1. Have my router setup with DNS for domains I want to direct locally, and point them to:
                                      2. Have a reverse proxy that has auto- certbot behavior (caddy) connected to the cloud flair API
                                      3. Navigation I do within my local network to these domains gives me real certificates.
                                      C This user is from outside of this forum
                                      C This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #28

                                      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 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
                                                }
                                        }
                                        
                                        M This user is from outside of this forum
                                        M This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #29

                                        The advice I needed and have not been able to find. I could kiss you. Or at least give you a fond nod.

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

                                          I just:

                                          1. Have my router setup with DNS for domains I want to direct locally, and point them to:
                                          2. Have a reverse proxy that has auto- certbot behavior (caddy) connected to the cloud flair API
                                          3. Navigation I do within my local network to these domains gives me real certificates.
                                          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
                                          #30

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

                                          douglasg14b@lemmy.worldD 1 Reply Last reply
                                          0
                                          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