Skip to content

Commit 8b00c81

Browse files
authored
Don't use CRLs for pool internal host-host TLS communications (#6863)
As these TLS communications use 'verifyPeer=yes' actually while applying CRLs requires root CA certificates and 'verifyChain=yes'.
2 parents 4edb0d7 + 91dec39 commit 8b00c81

3 files changed

Lines changed: 29 additions & 10 deletions

File tree

ocaml/libs/stunnel/stunnel.ml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type verification_config = {
122122
sni: string option
123123
; verify: verify
124124
; cert_bundle_path: string
125+
; crl_dir: string option
125126
}
126127
127128
type t = {
@@ -140,17 +141,24 @@ let appliance =
140141
sni= None
141142
; verify= CheckHost
142143
; cert_bundle_path= "/etc/stunnel/xapi-stunnel-ca-bundle.pem"
144+
; crl_dir= Some crl_path
143145
}
144146
145147
let pool =
146148
{
147149
sni= Some "pool"
148150
; verify= VerifyPeer
149151
; cert_bundle_path= "/etc/stunnel/xapi-pool-ca-bundle.pem"
152+
; crl_dir= None
150153
}
151154
152155
let external_host ext_host_cert_file =
153-
{sni= None; verify= VerifyPeer; cert_bundle_path= ext_host_cert_file}
156+
{
157+
sni= None
158+
; verify= VerifyPeer
159+
; cert_bundle_path= ext_host_cert_file
160+
; crl_dir= None
161+
}
154162
155163
let debug_conf_of_bool verbose : string =
156164
if verbose then
@@ -219,7 +227,7 @@ let config_file ?(accept = None) config host port =
219227
; ( match config with
220228
| None ->
221229
[]
222-
| Some {sni; verify; cert_bundle_path} ->
230+
| Some {sni; verify; cert_bundle_path; crl_dir} ->
223231
List.rev_append
224232
( match verify with
225233
| VerifyPeer ->
@@ -234,14 +242,17 @@ let config_file ?(accept = None) config host port =
234242
; "# the cert of the server we connect to"
235243
; (match sni with None -> "" | Some s -> sprintf "sni = %s" s)
236244
; sprintf "CAfile=%s" cert_bundle_path
237-
; ( match Sys.readdir crl_path with
238-
| [||] ->
239-
""
240-
| _ ->
241-
sprintf "CRLpath=%s" crl_path
242-
| exception _ ->
243-
""
244-
)
245+
; Option.fold ~none:""
246+
~some:(fun crl_dir ->
247+
match Sys.readdir crl_dir with
248+
| [||] ->
249+
""
250+
| _ ->
251+
sprintf "CRLpath=%s" crl_dir
252+
| exception _ ->
253+
""
254+
)
255+
crl_dir
245256
]
246257
)
247258
; [""]

ocaml/libs/stunnel/stunnel.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type verification_config = {
4040
sni: string option
4141
; verify: verify
4242
; cert_bundle_path: string
43+
; crl_dir: string option
4344
}
4445

4546
(** Represents an active stunnel connection *)

ocaml/libs/stunnel/stunnel_client.mli

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ val get_verify_by_default : unit -> bool
1717
val set_verify_by_default : bool -> unit
1818

1919
val pool : unit -> Stunnel.verification_config option
20+
(** [pool ()] returns the configuration that's meant to be used to connect to
21+
other xapi hosts in the pool *)
2022

2123
val appliance : unit -> Stunnel.verification_config option
24+
(** [appliance ()] returns the configuration that's meant to be used to connect
25+
to appliances providing services, like WLB or a licensing server. *)
2226

2327
val external_host : string -> Stunnel.verification_config option
28+
(** [external_host path] returns the configuration that's meant to be used to connect to
29+
a xapi hosts outside the pool. This is useful, for example, to provide an
30+
update repository to download updates from. *)

0 commit comments

Comments
 (0)