Skip to content

Commit e741775

Browse files
committed
Update certificate dirs and file names on FreeBSD
FreeBSD contains a canonical certstore managed by certctl(8) since 12.2 located in the base system (/etc/ssl), search there first. Alternatively, a user can populate a custom store in distbase (/usr/local/etc/ssl) with certctl(8) which shall be queried if the former does not exist. At last, there is a store for OpenSSL from the ports (/usr/local/openssl) outside of certctl(8)'s reach. Within these there can be also a bundle in parallel to a hashed directory. This fixes #20 and fixes #37
1 parent a03745e commit e741775

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,13 @@ const CERTIFICATE_DIRS: &[&str] = &[
140140
"/etc/pki/tls/certs", // Fedora, RHEL
141141
];
142142

143+
// see manpage of certctl(8): https://man.freebsd.org/cgi/man.cgi?query=certctl&sektion=8
144+
// see security/openssl* ports
143145
#[cfg(target_os = "freebsd")]
144146
const CERTIFICATE_DIRS: &[&str] = &[
145-
"/etc/ssl/certs", // FreeBSD 12.2+,
146-
"/usr/local/share/certs", // FreeBSD
147+
"/etc/ssl/certs",
148+
"/usr/local/etc/ssl/certs",
149+
"/usr/local/openssl/certs",
147150
];
148151

149152
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
@@ -177,7 +180,12 @@ const CERTIFICATE_FILE_NAMES: &[&str] = &[
177180
];
178181

179182
#[cfg(target_os = "freebsd")]
180-
const CERTIFICATE_FILE_NAMES: &[&str] = &["/usr/local/etc/ssl/cert.pem"];
183+
const CERTIFICATE_FILE_NAMES: &[&str] = &[
184+
"/etc/ssl/cert.pem",
185+
"/usr/local/etc/ssl/cert.pem",
186+
"/usr/local/openssl/cert.pem",
187+
"/usr/local/share/certs/ca-root-nss.crt",
188+
];
181189

182190
#[cfg(target_os = "dragonfly")]
183191
const CERTIFICATE_FILE_NAMES: &[&str] = &["/usr/local/share/certs/ca-root-nss.crt"];

0 commit comments

Comments
 (0)