···44444545(* from https://golang.org/src/crypto/x509/root_bsd.go *)
4646let openbsd_location = "/etc/ssl/cert.pem"
4747-4847let freebsd_location = "/usr/local/share/certs/ca-root-nss.crt"
49485049let macos_keychain_location =
···8382 if Sys.win32 then windows_trust_anchors ()
8483 else
8584 (* NixOS is special and sets "NIX_SSL_CERT_FILE" as location during builds *)
8686- match Sys.getenv_opt "NIX_SSL_CERT_FILE" with
8787- | Some x ->
8585+ match
8686+ (Sys.getenv_opt "SSL_CERT_FILE", Sys.getenv_opt "NIX_SSL_CERT_FILE")
8787+ with
8888+ | Some x, _ ->
8989+ Log.info (fun m -> m "using %s (from SSL_CERT_FILE)" x);
9090+ detect_one x
9191+ | _, Some x ->
8892 Log.info (fun m -> m "using %s (from NIX_SSL_CERT_FILE)" x);
8993 detect_one x
9090- | None -> (
9494+ | None, None -> (
9195 let cmd = Bos.Cmd.(v "uname" % "-s") in
9296 let* os = Bos.OS.Cmd.(run_out cmd |> out_string |> success) in
9397 match os with
+2-1
lib/ca_certs.mli
···1313val trust_anchors : unit -> (string, [> `Msg of string ]) result
1414(** [trust_anchors ()] detects the root CAs (trust anchors) in the operating
1515 system's trust store. On Unix systems, if the environment variable
1616- [NIX_SSL_CERT_FILE] is set, its value is used as path to the trust anchors.
1616+ [SSL_CERT_FILE] is set, its value is used as path to the trust anchors.
1717+ Otherwise, if [NIX_SSL_CERT_FILE] is set, its value is used.
1718 The successful result is a list of pem-encoded X509 certificates. *)
-1
test/tests.ml
···1818 type t = X509.Validation.validation_error
19192020 let pp = X509.Validation.pp_validation_error
2121-2221 let equal a b = compare a b = 0 (* TODO relies on polymorphic equality *)
2322 end in
2423 (module M : Alcotest.TESTABLE with type t = M.t)