Calling openssl_env_init() on FreeBSD breaks certificate validation with the system default trutstore
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
Though, I have reported this upstream, but since git2-rs is a downstream consumer and effectively renders the process environment useless, therefore reporting here again.
init() calls openssl_env_init() in good spirit, but completely breaks certificate validation because openssl_probe::init_ssl_cert_env_vars() sets invalid environment variables. This directly affects cargo since it uses curl-rust which in turn uses system's OpenSSL.
FreeBSD has a system default truststore managed by certctl(8) which is wired with the system's OpenSSL. There is no need to override that in anyway unless the user wishes to. I have a working simple patch which solves the issue for FreeBSD. I cannot tell for other systems, but this call could be problematic somewhere else as well, thefore curl-rust adds an explict off-by-default config for it: https://github.com/alexcrichton/curl-rust/blob/da8ebac10b60458e73d32a9c5834b08c980d5b59/src/easy/handler.rs#L677
PS: I am a FreeBSD committer.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading init() and its call to openssl_env_init(), then inspect openssl_probe::init_ssl_cert_env_vars() and the curl-rust handler configuration linked in the issue. Reproduce certificate validation on FreeBSD with the system truststore and determine the expected behavior for the environment variables; done means validation works with the certctl-managed defaults without an unwanted override.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100