Skip to content

Be able to disable the certificate verification in the curl library #13460

Open
@T00mm

Description

@T00mm

Problem

While spinning up development images that don't have our enterprise CA included we get the following error on any cargo command that needs to contact the crates-io registry

Caused by:
    download of config.json failed
Caused by:
    [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)

Normally you can bypass this by adding insecure to the cURL config file or by setting an environmental variable but the Easy library of cURL limits the environmental variables to a very limited set which SSL_VERIFY_PEER is not one of.

Would it be possible to be able to set the ssl_verify_peer option as well through the Cargo.toml config?

Proposed Solution

  1. An option in the config with verify_peer set to true as default
pub struct CargoHttpConfig {
...
    pub no_verify_peer: Option<bool>,
...
}
  1. Add code the the handle
pub fn configure_http_handle(config: &Config, handle: &mut Easy) -> CargoResult<HttpTimeout> {
...
    if let Some(no_verify_peer) = http.no_verify_peer {
        handle.ssl_verify_peer(!no_verify_peer)?;
    }
...

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkingArea: networking issues, curl, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions