-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Labels
Description
haproxy-consul-connect/haproxy/spoe.go
Lines 45 to 47 in 556c75e
| _, err = cert.Verify(x509.VerifyOptions{ | |
| Roots: cfg.CAsPool, | |
| }) |
Verifying certificates is not providing intermediates that may be present. That means it will only work in the Primary DC and even then it will only work for CA providers that choose to sign directly with their root key. (In the future this will likely be zero providers!).
The easiest thing to do is to follow the code in our SDK here: https://github.com/hashicorp/consul/blob/fd3c56ff68829821da4be139185c0a96938e1929/connect/tls.go#L265
At a high level it:
- Parses the certificate given by the client as a bundle - the first certificate present is always the leaf, any other certificates presented are assumed to be intermediates, either from the current CA or cross-signed by previous CAs during a rotation.
- Add the intermediates, if any to an intermediates x509.Pool
- Call verify with the roots and intermediates etc.