AlinsRan opened a new pull request, #14257:
URL: https://github.com/apache/apisix/pull/14257

   ### Description
   
   The Eureka discovery client always skipped certificate verification for 
`https` registries, and there was no option to turn it on.
   
   This PR adds `discovery.eureka.ssl_verify`. It defaults to `true`, as 
`ssl_verify` does in the consul discovery client. With verification on, the 
registry certificate is checked against `apisix.ssl.ssl_trusted_certificate`, 
and the registry hostname is sent as SNI. A failed handshake follows the 
existing fetch-error path, so the last fetched service list is kept. Setting 
`ssl_verify: false` restores the previous behavior. The option has no effect on 
`http` registries.
   
   Upgrade note: an `https` registry whose certificate is not trusted, or does 
not match the configured host, stops refreshing the service list. Before 
upgrading, either add the private CA to `apisix.ssl.ssl_trusted_certificate`, 
or set `ssl_verify: false`.
   
   The new `t/discovery/eureka-tls.t` covers four cases against local 
registries:
   
   - A trusted `https` registry populates the service list.
   - A registry that presents another host's certificate is rejected. This case 
fails on master.
   - The same mismatch is accepted with `ssl_verify: false`.
   - An `http` registry with `ssl_verify: true` populates the service list.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to