Skip to content

Commit 782a3c7

Browse files
committed
caddytls: Don't publish HTTPS record for CNAME'd domain (fix #6922)
1 parent 1735730 commit 782a3c7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/caddytls/ech.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ func (dnsPub ECHDNSPublisher) PublisherKey() string {
630630
func (dnsPub *ECHDNSPublisher) PublishECHConfigList(ctx context.Context, innerNames []string, configListBin []byte) error {
631631
nameservers := certmagic.RecursiveNameservers(nil) // TODO: we could make resolvers configurable
632632

633+
nextName:
633634
for _, domain := range innerNames {
634635
zone, err := certmagic.FindZoneByFQDN(ctx, dnsPub.logger, domain, nameservers)
635636
if err != nil {
@@ -660,6 +661,14 @@ func (dnsPub *ECHDNSPublisher) PublishECHConfigList(ctx context.Context, innerNa
660661
var nameHasExistingRecord bool
661662
for _, rec := range recs {
662663
if rec.Name == relName {
664+
// CNAME records are exclusive of all other records, so we cannot publish an HTTPS
665+
// record for a domain that is CNAME'd. See #6922.
666+
if rec.Type == "CNAME" {
667+
dnsPub.logger.Warn("domain has CNAME record, so unable to publish ECH data to HTTPS record",
668+
zap.String("domain", domain),
669+
zap.String("cname_value", rec.Value))
670+
continue nextName
671+
}
663672
nameHasExistingRecord = true
664673
if rec.Type == "HTTPS" && (rec.Target == "" || rec.Target == ".") {
665674
httpsRec = rec

0 commit comments

Comments
 (0)