Skip to content

Commit 889b83c

Browse files
authored
Merge pull request xapi-project#4454 from lindig/private/christianlin/CA-355629
CA-355629 use hostname for CN in host cert
2 parents 3227a23 + 7ca6ea4 commit 889b83c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ocaml/xapi/xapi_host.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ let install_server_certificate ~__context ~host ~certificate ~private_key
14911491
replace_host_certificate ~__context ~type':`host ~host write_cert_fs
14921492

14931493
let _new_host_cert ~dbg ~path : X509.Certificate.t =
1494-
let name, ip =
1494+
let ip_as_string, ip =
14951495
match Networking_info.get_management_ip_addr ~dbg with
14961496
| None ->
14971497
let msg = Printf.sprintf "%s: failed to get management IP" __LOC__ in
@@ -1501,8 +1501,9 @@ let _new_host_cert ~dbg ~path : X509.Certificate.t =
15011501
ip
15021502
in
15031503
let dns_names = Networking_info.dns_names () in
1504+
let cn = match dns_names with [] -> ip_as_string | dns :: _ -> dns in
15041505
let ips = [ip] in
1505-
Gencertlib.Selfcert.host ~name ~dns_names ~ips path
1506+
Gencertlib.Selfcert.host ~name:cn ~dns_names ~ips path
15061507

15071508
let reset_server_certificate ~__context ~host =
15081509
let dbg = Context.string_of_task __context in

0 commit comments

Comments
 (0)