mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 02:27:19 -04:00 
			
		
		
		
	caddytls: Don't publish HTTPS record for CNAME'd domain (fix #6922)
This commit is contained in:
		
							parent
							
								
									173573035c
								
							
						
					
					
						commit
						782a3c7ac6
					
				| @ -630,6 +630,7 @@ func (dnsPub ECHDNSPublisher) PublisherKey() string { | |||||||
| func (dnsPub *ECHDNSPublisher) PublishECHConfigList(ctx context.Context, innerNames []string, configListBin []byte) error { | func (dnsPub *ECHDNSPublisher) PublishECHConfigList(ctx context.Context, innerNames []string, configListBin []byte) error { | ||||||
| 	nameservers := certmagic.RecursiveNameservers(nil) // TODO: we could make resolvers configurable | 	nameservers := certmagic.RecursiveNameservers(nil) // TODO: we could make resolvers configurable | ||||||
| 
 | 
 | ||||||
|  | nextName: | ||||||
| 	for _, domain := range innerNames { | 	for _, domain := range innerNames { | ||||||
| 		zone, err := certmagic.FindZoneByFQDN(ctx, dnsPub.logger, domain, nameservers) | 		zone, err := certmagic.FindZoneByFQDN(ctx, dnsPub.logger, domain, nameservers) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @ -660,6 +661,14 @@ func (dnsPub *ECHDNSPublisher) PublishECHConfigList(ctx context.Context, innerNa | |||||||
| 		var nameHasExistingRecord bool | 		var nameHasExistingRecord bool | ||||||
| 		for _, rec := range recs { | 		for _, rec := range recs { | ||||||
| 			if rec.Name == relName { | 			if rec.Name == relName { | ||||||
|  | 				// CNAME records are exclusive of all other records, so we cannot publish an HTTPS | ||||||
|  | 				// record for a domain that is CNAME'd. See #6922. | ||||||
|  | 				if rec.Type == "CNAME" { | ||||||
|  | 					dnsPub.logger.Warn("domain has CNAME record, so unable to publish ECH data to HTTPS record", | ||||||
|  | 						zap.String("domain", domain), | ||||||
|  | 						zap.String("cname_value", rec.Value)) | ||||||
|  | 					continue nextName | ||||||
|  | 				} | ||||||
| 				nameHasExistingRecord = true | 				nameHasExistingRecord = true | ||||||
| 				if rec.Type == "HTTPS" && (rec.Target == "" || rec.Target == ".") { | 				if rec.Type == "HTTPS" && (rec.Target == "" || rec.Target == ".") { | ||||||
| 					httpsRec = rec | 					httpsRec = rec | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user