Skip to content

Commit 864ff01

Browse files
author
Lin Liu
committed
CP-311259: Use tls lib to configure cipher suites
Signed-off-by: Lin Liu <lin.liu01@citrix.com>
1 parent 9ba6837 commit 864ff01

11 files changed

Lines changed: 31 additions & 14 deletions

File tree

dune-project

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@
645645
(= :version))
646646
(uuid
647647
(= :version))
648+
(tls
649+
(= :version))
648650
(xapi-consts
649651
(= :version))
650652
xapi-inventory
@@ -660,6 +662,18 @@
660662
(= :version))
661663
(odoc :with-doc)))
662664

665+
(package
666+
(name tls)
667+
(synopsis "TLS policy types and format-specific string renderers")
668+
(description
669+
"Provides TLS policy types and renderers for GnuTLS priority strings and OpenSSL cipher lists.")
670+
(depends
671+
(ocaml
672+
(>= "4.14"))
673+
(dune
674+
(>= "3.0"))
675+
(odoc :with-doc)))
676+
663677
(package
664678
(name sexpr))
665679

ocaml/libs/stunnel/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
forkexec
88
safe-resources
99
threads.posix
10+
tls
1011
unix
1112
uuid
1213
xapi-consts

ocaml/libs/stunnel/stunnel.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ let config_file ?(accept = None) config host port =
222222
)
223223
; [Printf.sprintf "connect=%s:%d" host port]
224224
; [
225-
"sslVersion = TLSv1.2"
226-
; "ciphers = " ^ Constants.good_ciphersuites
227-
; "curve = secp384r1"
225+
"sslVersion = " ^ Tls.Openssl.default_version
226+
; "ciphers = " ^ Tls.Openssl.default_ciphers
227+
; "curve = " ^ Tls.Openssl.default_curve
228228
]
229229
; ( match config with
230230
| None ->

ocaml/nbd/src/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
xapi-consts
2222
xapi-inventory
2323
xapi-types
24+
tls
2425
xen-api-client-lwt
2526
)
2627
)

ocaml/nbd/src/main.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ let init_tls_get_server_ctx ~certfile =
9292
let certfile = require_str "certfile" certfile in
9393
Some
9494
(Nbd_unix.TlsServer
95-
(Nbd_unix.init_tls_get_ctx ~curve:"secp384r1" ~certfile
96-
~ciphersuites:Constants.good_ciphersuites ()
95+
(Nbd_unix.init_tls_get_ctx ~curve:Tls.Openssl.default_curve ~certfile
96+
~ciphersuites:Tls.Openssl.default_ciphers ()
9797
)
9898
)
9999

ocaml/xapi-consts/constants.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,6 @@ let gencert = ref "/opt/xensource/libexec/gencert"
429429

430430
let openssl_path = ref "/usr/bin/openssl"
431431

432-
let good_ciphersuites =
433-
String.concat ":"
434-
["ECDHE-RSA-AES256-GCM-SHA384"; "ECDHE-RSA-AES128-GCM-SHA256"]
435-
436432
let verify_certificates_path = "/var/xapi/verify-certificates"
437433

438434
let python3_path = "/usr/bin/python3"

ocaml/xapi/dune

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
clock
8686
astring
8787
stunnel
88+
tls
8889
sexplib0
8990
sexplib
9091
sexpr
@@ -182,6 +183,7 @@
182183
sha
183184
str
184185
stunnel
186+
tls
185187
tapctl
186188
tar
187189
tar-unix
@@ -301,6 +303,7 @@
301303
rpclib.json
302304
rpclib.xml
303305
stunnel
306+
tls
304307
tgroup
305308
threads.posix
306309
tracing

ocaml/xapi/extauth_plugin_ADwinbind.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ let config_winbind_daemon domain_info =
920920
; "tls trust system cas = yes"
921921
; "tls verify peer = ca_and_name_if_available"
922922
; Printf.sprintf "tls ca directories = %s" certs_dir
923+
; Printf.sprintf "tls priority = %s" (Tls.Gnutls.default_policy ())
923924
; Printf.sprintf "winbind scan trusted domains = %s"
924925
scan_trusted_domains
925926
; "winbind use krb5 enterprise principals = yes"

ocaml/xapi/sparse_dd_wrapper.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ let dd_internal progress_cb base prezeroed verify_cert ?(proto = None) infile
122122
; "-size"
123123
; Int64.to_string size
124124
; "-good-ciphersuites"
125-
; Constants.good_ciphersuites
125+
; Tls.Openssl.default_ciphers
126126
]
127127
; ( if prezeroed then
128128
["-prezeroed"]

ocaml/xapi/xapi_stunnel_server.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ end = struct
5252
let open Printf in
5353
let cipher_options =
5454
[
55-
sprintf "ciphers = %s" Constants.good_ciphersuites
56-
; "curve = secp384r1"
57-
; "options = CIPHER_SERVER_PREFERENCE"
58-
; "sslVersion = TLSv1.2"
55+
sprintf "ciphers = %s" Tls.Openssl.default_ciphers
56+
; "curve = " ^ Tls.Openssl.default_curve
57+
; "options = " ^ Tls.Openssl.default_server_preference
58+
; "sslVersion = " ^ Tls.Openssl.default_version
5959
]
6060
in
6161
[

0 commit comments

Comments
 (0)