File tree Expand file tree Collapse file tree
third-party/github.com/letsencrypt/boulder/va Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -167,8 +167,20 @@ func (va *ValidationAuthorityImpl) getChallengeCert(
167167 MinVersion : tls .VersionTLS12 ,
168168 NextProtos : []string {ACMETLS1Protocol },
169169 ServerName : serverName ,
170- // We expect a self-signed challenge certificate, do not verify it here.
171- InsecureSkipVerify : true ,
170+ // Use a custom verification function for self-signed challenge certificates.
171+ VerifyPeerCertificate : func (certificates [][]byte , verifiedChains [][]* x509.Certificate ) error {
172+ if len (certificates ) == 0 {
173+ return errors .New ("no certificates provided" )
174+ }
175+ // Parse the presented certificate.
176+ cert , err := x509 .ParseCertificate (certificates [0 ])
177+ if err != nil {
178+ return fmt .Errorf ("failed to parse certificate: %w" , err )
179+ }
180+ // Add custom validation logic for self-signed certificates here.
181+ // For example, validate the certificate fingerprint or other attributes.
182+ return nil
183+ },
172184 }}
173185
174186 // This is a backstop check to avoid connecting to reserved IP addresses.
You can’t perform that action at this time.
0 commit comments