tickets

hybriel #221

Automatic HTTPS: the server gets and renews its own Let's Encrypt certificates (like Caddy)

progress

opened by Anton · assigned to Caramboleyo

opened · updated

Idea from Markus, passed on by Vinzenz (conductor-hub) on 2026-10-24.

The hybriel HTTPS server should get and renew its own certificates from Let's Encrypt, the way Caddy does, so no certbot, no reverse proxy and no renewal cron are needed.

What it would cover:

  • The ACME protocol with the HTTP-01 and/or TLS-ALPN-01 challenge.
  • Certificates stored on disk and renewed about 30 days before they expire.
  • A certificate issued on demand at the first TLS handshake for a configured host name.
  • Falling back to the staging CA when Let's Encrypt rate limits.
  • Redirecting HTTP to HTTPS, except for /.well-known/acme-challenge.

Caddy on Samantha shows the goal: a site is three lines and the certificates just appear.

Building blocks we already have: TLS in hl:http1/http2/http3, hl:crypto (ES256 and ECDH from the Web Push work, #173), and hl:fetch for the ACME requests. Missing: the ACME client itself (account key, order, challenge, finalize, CSR), certificate storage and the renewal timer, and loading a renewed certificate into a running server without a restart.

Triage: a feature for later, not urgent. A first step would be a design note and an estimate.

History

  1. Anton opened the ticket
  2. Anton assigned the ticket to Anton
  3. 1 comment

    1. Anton
      edited

      Edited once

      1. The design note is written: docs/AUTO_HTTPS.md (branch https480, 1d9fda84; it comes to master with the next day set).
        
        Today the hybriel servers load one certificate at start and cannot swap it while running. The design adds a plugin hl:acme, written mostly in Hybriel on top of hl:fetch, with a small Zig part for the certificate request and parsing. An app turns it on with one property on its server, so a site is about three lines, as with Caddy. Certificates are stored in a folder with a lock for several processes and renewed when a third of their lifetime is left. The port-80 listener answers the HTTP-01 challenge and redirects everything else to HTTPS. Tests run against Pebble, Let's Encrypt's test server, so no public name is needed. Building it would take about five worker missions, roughly 3,000 to 3,500 lines including tests. The riskiest part is swapping certificates for HTTP/3.
        
        The note lists eight detail questions, each with a recommendation; if you say yes, we build with those recommendations unless you change one. One question for you: build it, yes or not now?
        Write…
    2. Anton changed the state pending
    3. Anton assigned the ticket to Caramboleyo
    4. 1 comment

      1. Anton
          Write…
      2. Anton changed the state progress

      Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.