Skip to content

Commit 8d8b356

Browse files
author
Lin Liu
committed
CP-311896: ldaps feature sync with trusted certs
- Add `ldaps` as one of the trusted certs purpose - Bump up `external_auth_set_ldaps` API version according to master - Get trusted certs dir by consts instead of hardcode Signed-off-by: Lin Liu <lin.liu01@citrix.com>
1 parent ad94af6 commit 8d8b356

6 files changed

Lines changed: 30 additions & 21 deletions

File tree

ocaml/idl/datamodel_certificate.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ let certificate_type =
3737
let certificate_purpose =
3838
Enum
3939
( "certificate_purpose"
40-
, [("licensing", "Trusted certificates that are for licensing purpose.")]
40+
, [
41+
("licensing", "Trusted certificates that are for licensing purpose.")
42+
; ( "ldaps"
43+
, "Trusted certificates that are for LDAPS connections to external \
44+
authentication services."
45+
)
46+
]
4147
)
4248

4349
let t =

ocaml/idl/datamodel_common.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Datamodel_roles
1010
to leave a gap for potential hotfixes needing to increment the schema version.*)
1111
let schema_major_vsn = 5
1212

13-
let schema_minor_vsn = 902
13+
let schema_minor_vsn = 903
1414

1515
(* Historical schema versions just in case this is useful later *)
1616
let rio_schema_major_vsn = 5

ocaml/idl/datamodel_host.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,7 @@ let external_auth_set_ldaps =
20492049
~lifecycle:
20502050
[
20512051
( Published
2052-
, "26.6.0-next"
2052+
, "26.12.0-next"
20532053
, "This call enables or disables LDAPS for external authentication on \
20542054
the host"
20552055
)
@@ -2060,21 +2060,21 @@ let external_auth_set_ldaps =
20602060
param_type= Ref _host
20612061
; param_name= "host"
20622062
; param_doc= "The host whose LDAPS configuration should be set"
2063-
; param_release= numbered_release "26.6.0-next"
2063+
; param_release= numbered_release "26.12.0-next"
20642064
; param_default= None
20652065
}
20662066
; {
20672067
param_type= Bool
20682068
; param_name= "ldaps"
20692069
; param_doc= "Whether to enable or disable LDAPS"
2070-
; param_release= numbered_release "26.6.0-next"
2070+
; param_release= numbered_release "26.12.0-next"
20712071
; param_default= None
20722072
}
20732073
; {
20742074
param_type= Bool
20752075
; param_name= "force"
20762076
; param_doc= "Force the operation even if already in the desired state"
2077-
; param_release= numbered_release "26.6.0-next"
2077+
; param_release= numbered_release "26.12.0-next"
20782078
; param_default= Some (VBool false)
20792079
}
20802080
]

ocaml/idl/datamodel_pool.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ let external_auth_set_ldaps =
665665
~lifecycle:
666666
[
667667
( Published
668-
, "26.6.0-next"
668+
, "26.12.0-next"
669669
, "This call enables or disables LDAPS for external authentication on \
670670
all hosts in the pool"
671671
)
@@ -676,21 +676,21 @@ let external_auth_set_ldaps =
676676
param_type= Ref _pool
677677
; param_name= "pool"
678678
; param_doc= "The pool whose LDAPS configuration should be set"
679-
; param_release= numbered_release "26.6.0-next"
679+
; param_release= numbered_release "26.12.0-next"
680680
; param_default= None
681681
}
682682
; {
683683
param_type= Bool
684684
; param_name= "ldaps"
685685
; param_doc= "Whether to enable or disable LDAPS"
686-
; param_release= numbered_release "26.6.0-next"
686+
; param_release= numbered_release "26.12.0-next"
687687
; param_default= None
688688
}
689689
; {
690690
param_type= Bool
691691
; param_name= "force"
692692
; param_doc= "Force the operation even if already in the desired state"
693-
; param_release= numbered_release "26.6.0-next"
693+
; param_release= numbered_release "26.12.0-next"
694694
; param_default= Some (VBool false)
695695
}
696696
]

ocaml/idl/schematest.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
33
(* BEWARE: if this changes, check that schema has been bumped accordingly in
44
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
55

6-
let last_known_schema_hash = "2d8501063ef6b243facc24a3dbdc2a5d"
6+
let last_known_schema_hash = "d07be505e5b74fbe2b069bd8247da1a9"
77

88
let current_schema_hash : string =
99
let open Datamodel_types in

ocaml/xapi/extauth_plugin_ADwinbind.ml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,29 @@ let tdb_tool = !Xapi_globs.tdb_tool
8989

9090
let domain_krb5_dir = Filename.concat Xapi_globs.samba_dir "lock/smb_krb5"
9191

92-
(* Legacy certificates folder *)
93-
let certs_dir = "/etc/stunnel/certs"
92+
let ca_bundle_for_purpose purpose =
93+
Printf.sprintf "%s/%s-%s.pem" Constants.trusted_certs_by_purpose_dir
94+
Constants.trusted_certs_root_prefix purpose
9495

95-
let ldaps_ca_bundle = "/etc/trusted-certs/ca-bundle-ldaps.pem"
96+
let ldaps_ca_bundle = ca_bundle_for_purpose "ldaps"
9697

97-
let general_ca_bundle = "/etc/trusted-certs/ca-bundle-general.pem"
98+
let general_ca_bundle = ca_bundle_for_purpose "general"
9899

99-
(** Return the best available CA bundle/cert path, in priority order:
100-
ldaps-specific bundle > general bundle > legacy certs dir.
100+
(** Return the best available CA bundle path, in priority order:
101+
ldaps-specific bundle > general bundle.
101102
Returns [None] if none exist. *)
102-
103103
let ca_bundle_path () =
104-
[ldaps_ca_bundle; general_ca_bundle; certs_dir]
105-
|> List.find_opt Sys.file_exists
104+
[ldaps_ca_bundle; general_ca_bundle] |> List.find_opt Sys.file_exists
106105

107106
let assert_ca_exists = function
108107
| true ->
109108
ca_bundle_path ()
110109
|> Option.to_result
111-
~none:(gen_ex E_NO_CERTS "No certs to setup TLS connection to DC")
110+
~none:
111+
(gen_ex E_NO_CERTS
112+
"No certs to setup TLS connection to DC. Note: ldaps does not \
113+
support non-CA certs"
114+
)
112115
|> maybe_raise
113116
|> ignore
114117
| false ->

0 commit comments

Comments
 (0)