uacme: wildcard-only domain breaks certificate path handling in hook.sh

Aperta Adatta ai principianti
#31,323 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
linux, shell
Ambito
backend, security

Direzione di ricerca

Inizia da net/uacme/files/hook.sh e /etc/init.d/acme, seguendo le righe individuate nel report relative alla costruzione dei percorsi e allo spostamento nell’area di staging. Controlla come uacme memorizza i certificati wildcard, quindi individua quali valori vengono usati per i percorsi del filesystem e quali vengono passati per l’emissione. Il lavoro è completato quando i certificati solo wildcard vengono installati e rinnovati senza percorsi errati, mentre il comportamento dei certificati non wildcard rimane invariato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

release/25.12

Describe the bug

With a wildcard-only certificate section such as:

config cert 'wildcard'
    option enabled '1'
    option validation_method 'dns'
    option key_type 'ec256'
    list domains '*.example.com'

/etc/init.d/acme sets main_domain='*.example.com', and /usr/lib/acme/hook (from net/uacme/files/hook.sh) uses main_domain verbatim for filesystem paths:

  • domain_dir="$state_dir/$main_domain" (hook.sh lines 91 and 96)
  • $state_dir/private/$main_domain/key.pem (line 22, 32)
  • $CERT_DIR/$main_domain.{crt,key,fullchain.crt,combined.crt,chain.crt} (lines 27-41)
  • link_certs() writes combined.cer, leaf_cert.pem, chain.crt into "$domain_dir" (lines 22-24)

uacme itself sanitizes the wildcard for storage and writes to $state_dir/example.com/ and $state_dir/private/example.com/. As a result the certificate is issued correctly but post-processing fails:

daemon.err hook[xxxx]: /usr/lib/acme/hook: line 22: can't create /etc/acme/*.example.com/combined.cer: nonexistent directory
daemon.err hook[xxxx]: /usr/lib/acme/hook: line 23: can't create /etc/acme/*.example.com/leaf_cert.pem: nonexistent directory
daemon.err hook[xxxx]: /usr/lib/acme/hook: line 24: can't create /etc/acme/*.example.com/chain.crt: nonexistent directory

Broken symlinks with a literal * in the name are also created under /etc/ssl/acme/:

/etc/ssl/acme/*.example.com.chain.crt      -> /etc/acme/*.example.com/chain.crt
/etc/ssl/acme/*.example.com.combined.crt   -> /etc/acme/*.example.com/combined.cer
/etc/ssl/acme/*.example.com.crt            -> /etc/acme/*.example.com/leaf_cert.pem
/etc/ssl/acme/*.example.com.fullchain.crt  -> /etc/acme/*.example.com/cert.pem
/etc/ssl/acme/*.example.com.key            -> /etc/acme/private/*.example.com/key.pem

The ACME issuance itself succeeds, but automatic installation / renewal post-processing does not complete, so consumers (e.g. uhttpd) never get the updated certificate links.

Expected behavior

Paths derived from the domain should be sanitized (strip a leading *.), while the original identifier is still passed to uacme for issuance. For non-wildcard domains the behavior must not change.

Workaround

List the apex first so main_domain contains no *:

list domains 'example.com' '*.example.com'

This avoids the broken paths, but changes the requested SAN set (adds the apex) and should not be required to use a wildcard certificate.

Suggested fix

In /etc/init.d/acme or in hook.sh, derive a sanitized name for path usage, e.g.:

cert_name="${main_domain#\*.}"

and use cert_name for domain_dir, the private key path and the /etc/ssl/acme symlink names, keeping main_domain for ACME arguments, logging and nftables rules. The same cleanup should be applied to the staging-move logic ($state_dir/private/$main_domain.staging, lines 117 and 219).

Environment

  • OpenWrt 25.12.6 (r33311-981c978eff), mediatek/filogic, aarch64_cortex-a53
  • uacme 1.8.1-r4
  • /etc/ssl/acme as CERT_DIR, default state_dir=/etc/acme
  • Reproduced with both a wildcard-only section and, previously, a staging certificate for the same name

Duplicate check

Searched openwrt/packages for uacme wildcard, hook.sh uacme: no matching report found.

Lingua principale
Makefile
Stelle
4.7k
Fork
4k
Merge medio
2g 12h
PR unite (30g)
287

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openwrt/packages

Tutte le issue di openwrt/packages

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.