Skip to content

Commit 8550769

Browse files
authored
CA-403767: verifyPeer can't use root CA for appliance cert check (#6187)
It is expected to use root CA certficate to verify an appliance's server certificate for a xapi outgoing TLS connection. Prior to this change, the related stunnel configurations are: "verifyPeer=yes", and "checkHost=<hostname>". The 'verifyPeer' option of stunnel doesn't treat the CA bundle as root CA certificates. The 'checkHost' option of stunnel only checks the host name against the one in server certificate. In other words, the issue is that the root CA based checking doesn't work for appliance. This change adds 'verifyChain' for the appliance to ensure the outgoing TLS connection from xapi will verify the appliance's server certificates by real root CA certificate.
2 parents 0472024 + 6f6cd81 commit 8550769

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

ocaml/libs/stunnel/stunnel.ml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -218,29 +218,29 @@ let config_file ?(accept = None) config host port =
218218
| None ->
219219
[]
220220
| Some {sni; verify; cert_bundle_path} ->
221-
[
222-
""
223-
; "# use SNI to request a specific cert. CAfile contains"
224-
; "# public certs of all hosts in the pool and must contain"
225-
; "# the cert of the server we connect to"
226-
; (match sni with None -> "" | Some s -> sprintf "sni = %s" s)
227-
; ( match verify with
221+
List.rev_append
222+
( match verify with
228223
| VerifyPeer ->
229-
""
224+
["verifyPeer=yes"]
230225
| CheckHost ->
231-
sprintf "checkHost=%s" host
232-
)
233-
; "verifyPeer=yes"
234-
; sprintf "CAfile=%s" cert_bundle_path
235-
; ( match Sys.readdir crl_path with
236-
| [||] ->
237-
""
238-
| _ ->
239-
sprintf "CRLpath=%s" crl_path
240-
| exception _ ->
241-
""
226+
[sprintf "checkHost=%s" host; "verifyChain=yes"]
242227
)
243-
]
228+
[
229+
""
230+
; "# use SNI to request a specific cert. CAfile contains"
231+
; "# public certs of all hosts in the pool and must contain"
232+
; "# the cert of the server we connect to"
233+
; (match sni with None -> "" | Some s -> sprintf "sni = %s" s)
234+
; sprintf "CAfile=%s" cert_bundle_path
235+
; ( match Sys.readdir crl_path with
236+
| [||] ->
237+
""
238+
| _ ->
239+
sprintf "CRLpath=%s" crl_path
240+
| exception _ ->
241+
""
242+
)
243+
]
244244
)
245245
; [""]
246246
]

0 commit comments

Comments
 (0)