try_init_openssl_env_vars() breaks certificate validation (on FreeBSD)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- cryptography, security
Hướng nghiên cứu
The bug sits in the candidate directory list and environment setup in src/lib.rs, where try_init_openssl_env_vars() calls probe() and then sets SSL_CERT_DIR and SSL_CERT_FILE. Start by reading that probe logic and reproduce the FreeBSD case by checking which candidate directories contain a certs subdirectory. Done means the variables are only set to paths OpenSSL can actually use, verified by the sample program succeeding.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
try_init_openssl_env_vars() invokes probe() and then manipulates the process environment with SSL_CERT_DIR/SSL_CERT_FILE. This may happen on any system, but for me at least on FreeBSD, when the following condition is met:
https://github.com/alexcrichton/openssl-probe/blob/4221247cfad3e77b758bf9b6e4c3d91a557c429e/src/lib.rs#L31-L50
None of these directories contain a CAfile, but contain a dir CANDIDATE/certs which is not CApath. That path is being used to set SSL_CERT_DIR, OpenSSL picks up this empty directory and fails all validations.
Here on the example of FreeBSD:
For many years FreeBSD contains certctl(8) to manage the system truststore which is assembled from various sources into a CApath in /etc/ssl/certs. If one relies on OpenSSL's SSL_CTX_set_default_verify_paths() all is good.
certctl(8) includes by default these two paths with CA certificates:
/usr/share/certs/trusted: comes with the base system and contains all NSS CA certificate from Mozilla/usr/local/share/certs: is initially empty and allows an admin to drop off custom/enterprise CAs (which a do at work).
certcrtl rehash scans all of them and puts symlinks into /etc/ssl/certs, but since candidate_cert_dirs[] has ""/usr/local/share" before "/etc/ssl" an invalid value is set and all fails.
A sample main which fails:
use curl::easy::Easy;
fn main() {
openssl_probe::init_ssl_cert_env_vars();
let mut data = Vec::new();
let mut handle = Easy::new();
handle.url("https://www.rust-lang.org/").unwrap();
{
let mut transfer = handle.transfer();
transfer.write_function(|new_data| {
data.extend_from_slice(new_data);
Ok(new_data.len())
}).unwrap();
transfer.perform().unwrap();
}
}
Remove the first line in the main and you are good to go.
This causes problems with downstream consumers like git2-rs and then cargo. I will report the issue also downstream.
- Ngôn ngữ chính
- Rust
- Star
- 61
- Fork
- 23
- Merge trung bình
- 43 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rustls/openssl-probe
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
rustls/openssl-probe#50 · 4 bình luận ·
-
/etc/ssl/certs/ca-bundle.crt no longer discovered on LinuxCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
rustls/openssl-probe#48 · 2 bình luận ·
-
Support for WindowsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
rustls/openssl-probe#23 · 1 bình luận ·
-
Freebsd certs not foundCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
rustls/openssl-probe#20 · 2 bình luận ·
-
Is Android supported?Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
rustls/openssl-probe#8 · 6 bình luận ·
Tất cả issue của rustls/openssl-probe
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
pop-os/cosmic-settings#2296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jonathanong/no-mistakes#3431 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Eyevinn/open-live-ingest#36 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows YAML bind mounts fail path validation while equivalent --mount-dir CLI mounts succeedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
superradcompany/microsandbox#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày