Skip to content

Commit

Permalink
Merge pull request #105 from davidB/bug/gke_access
Browse files Browse the repository at this point in the history
HACK accept invalid certs on mac OS X if validity > 825 days
  • Loading branch information
clux authored Dec 24, 2019
2 parents 21c3ce4 + c105c46 commit 2e4410e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ pub async fn create_client_builder(options: ConfigOptions) -> Result<(ClientBuil
let cert = Certificate::from_der(&ca.to_der().map_err(|e| Error::SslError(format!("{}", e)))?)
.map_err(Error::ReqwestError)?;
client_builder = client_builder.add_root_certificate(cert);
if std::env::consts::OS == "macos"
&& ca
.as_ref()
.not_before()
.diff(ca.not_after())
.map(|d| d.days.abs() > 824)
.unwrap_or(false)
{
client_builder = client_builder.danger_accept_invalid_certs(true);
}
}
}
match loader.p12(" ") {
Expand Down

0 comments on commit 2e4410e

Please sign in to comment.