@@ -278,7 +278,7 @@ func (t *TLS) publishECHConfigs() error {
278
278
// if all the (inner) domains have had this ECH config list published
279
279
// by this publisher, then try the next publication config
280
280
if len (serverNamesSet ) == 0 {
281
- logger .Debug ("ECH config list already published by publisher for associated domains" ,
281
+ logger .Debug ("ECH config list already published by publisher for associated domains (or no domains to publish for) " ,
282
282
zap .Uint8s ("config_ids" , configIDs ),
283
283
zap .String ("publisher" , publisherKey ))
284
284
continue
@@ -299,7 +299,7 @@ func (t *TLS) publishECHConfigs() error {
299
299
err := publisher .PublishECHConfigList (t .ctx , dnsNamesToPublish , echCfgListBin )
300
300
if err == nil {
301
301
t .logger .Info ("published ECH configuration list" ,
302
- zap .Strings ("domains" , publication . Domains ),
302
+ zap .Strings ("domains" , dnsNamesToPublish ),
303
303
zap .Uint8s ("config_ids" , configIDs ),
304
304
zap .Error (err ))
305
305
// update publication history, so that we don't unnecessarily republish every time
@@ -389,27 +389,33 @@ func loadECHConfig(ctx caddy.Context, configID string) (echConfig, error) {
389
389
return echConfig {}, nil
390
390
}
391
391
metaBytes , err := storage .Load (ctx , metaKey )
392
- if err != nil {
392
+ if errors .Is (err , fs .ErrNotExist ) {
393
+ logger .Warn ("ECH config metadata file missing; will recreate at next publication" ,
394
+ zap .String ("config_id" , configID ),
395
+ zap .Error (err ))
396
+ } else if err != nil {
393
397
delErr := storage .Delete (ctx , cfgIDKey )
394
398
if delErr != nil {
395
- return echConfig {}, fmt .Errorf ("error loading ECH metadata (%v) and cleaning up parent storage key %s: %v" , err , cfgIDKey , delErr )
399
+ return echConfig {}, fmt .Errorf ("error loading ECH config metadata (%v) and cleaning up parent storage key %s: %v" , err , cfgIDKey , delErr )
396
400
}
397
- logger .Warn ("could not load ECH metadata; deleted its config folder" ,
401
+ logger .Warn ("could not load ECH config metadata; deleted its folder" ,
398
402
zap .String ("config_id" , configID ),
399
403
zap .Error (err ))
400
404
return echConfig {}, nil
401
405
}
402
406
var meta echConfigMeta
403
- if err := json .Unmarshal (metaBytes , & meta ); err != nil {
404
- // even though it's just metadata, reset the whole config since we can't reliably maintain it
405
- delErr := storage .Delete (ctx , cfgIDKey )
406
- if delErr != nil {
407
- return echConfig {}, fmt .Errorf ("error decoding ECH metadata (%v) and cleaning up parent storage key %s: %v" , err , cfgIDKey , delErr )
407
+ if len (metaBytes ) > 0 {
408
+ if err := json .Unmarshal (metaBytes , & meta ); err != nil {
409
+ // even though it's just metadata, reset the whole config since we can't reliably maintain it
410
+ delErr := storage .Delete (ctx , cfgIDKey )
411
+ if delErr != nil {
412
+ return echConfig {}, fmt .Errorf ("error decoding ECH metadata (%v) and cleaning up parent storage key %s: %v" , err , cfgIDKey , delErr )
413
+ }
414
+ logger .Warn ("could not JSON-decode ECH metadata; deleted its config folder" ,
415
+ zap .String ("config_id" , configID ),
416
+ zap .Error (err ))
417
+ return echConfig {}, nil
408
418
}
409
- logger .Warn ("could not JSON-decode ECH metadata; deleted its config folder" ,
410
- zap .String ("config_id" , configID ),
411
- zap .Error (err ))
412
- return echConfig {}, nil
413
419
}
414
420
415
421
cfg .privKeyBin = privKeyBytes
@@ -700,7 +706,7 @@ nextName:
700
706
// HTTPS and SVCB RRs: RFC 9460 (https://www.rfc-editor.org/rfc/rfc9460)
701
707
Scheme : "https" ,
702
708
Name : relName ,
703
- TTL : 1 * time .Minute , // TODO: for testing only
709
+ TTL : 5 * time .Minute , // TODO: low hard-coded value only temporary; change to a higher value once more field-tested and key rotation is implemented
704
710
Priority : 2 , // allows a manual override with priority 1
705
711
Target : "." ,
706
712
Params : params ,
0 commit comments