mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	tls: Set a GetCertificate callback in the tls.Config (#2404)
A tls.Config must have Certificates or GetCertificate set, in order to be accepted by tls.Listen and quic.Listen.
This commit is contained in:
		
							parent
							
								
									f5aaa471de
								
							
						
					
					
						commit
						e14328b71b
					
				| @ -269,6 +269,13 @@ func MakeTLSConfig(configs []*Config) (*tls.Config, error) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return &tls.Config{ | 	return &tls.Config{ | ||||||
|  | 		// A tls.Config must have Certificates or GetCertificate | ||||||
|  | 		// set, in order to be accepted by tls.Listen and quic.Listen. | ||||||
|  | 		// TODO: remove this once the standard library allows a tls.Config with | ||||||
|  | 		// only GetConfigForClient set. | ||||||
|  | 		GetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) { | ||||||
|  | 			return nil, fmt.Errorf("all certificates configured via GetConfigForClient") | ||||||
|  | 		}, | ||||||
| 		GetConfigForClient: configMap.GetConfigForClient, | 		GetConfigForClient: configMap.GetConfigForClient, | ||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user