int ssl_store_load_ca_from_buf(struct cafile_entry *ca_e, char *cert_buf, int append);
int ssl_store_load_locations_file(char *path, int create_if_none, enum cafile_type type);
int __ssl_store_load_locations_file(char *path, int create_if_none, enum cafile_type type, int shuterror);
+const char *ha_default_cert_dir();
extern struct cert_exts cert_exts[];
extern int (*ssl_commit_crlfile_cb)(const char *path, X509_STORE *ctx, char **err);
return retval;
}
+/*
+ * return the default verify cert directory.
+ *
+ * It might provided by the SSL library or set in an environment variable
+ * (commonly SSL_CERT_DIR)
+ */
+const char *ha_default_cert_dir()
+{
+ const char *dir = NULL;
+ const char *certdir_varname = X509_get_default_cert_dir_env();
+
+ if (certdir_varname)
+ dir = getenv(certdir_varname);
+ if (dir == NULL)
+ dir = X509_get_default_cert_dir();
+
+ return dir;
+}
+
/*
* Try to load a ca-file from disk into the ca-file cache.
* <shuterror> allows you to to stop emitting the errors.
}
if (strcmp(path, "@system-ca") == 0) {
- dir = X509_get_default_cert_dir();
+ dir = ha_default_cert_dir();
if (!dir) {
if (!shuterror)
ha_alert("Couldn't get the system CA directory from X509_get_default_cert_dir().\n");
#if defined(USE_OPENSSL) && (HA_OPENSSL_VERSION_NUMBER < 0x3000000fL)
memprintf(&ptr, "%s\nSSL library FIPS mode : %s", ptr, FIPS_mode() ? "yes" : "no");
#endif
- memprintf(&ptr, "%s\nSSL library default verify directory : %s", ptr, X509_get_default_cert_dir());
+ memprintf(&ptr, "%s\nSSL library default verify directory : %s", ptr, ha_default_cert_dir());
memprintf(&ptr, "%s\nSSL library supports :", ptr);
for (i = CONF_TLSV_MIN; i <= CONF_TLSV_MAX; i++)
if (methodVersions[i].option)