databricks / click

The "Command Line Interactive Controller for Kubernetes"
Apache License 2.0
1.49k stars 84 forks source link

builder error: MAC verification failed during PKCS12 import #206

Open libratiger opened 2 years ago

libratiger commented 2 years ago
[WARN] Couldn't find/load context xxx@kubernetes, now no current context. Error: Reqwest error: builder error: MAC verification failed during PKCS12 import (wrong password?)

version: Click 0.6.2

nicklan commented 2 years ago

hrmm, thanks for the report. i'm assuming this context works with kubectl? does the pkcs12 file used for auth require a password perhaps? click doesn't support that (i haven't actually even verified that's a possibility).

if so we could probably have click prompt you for it as needed.

libratiger commented 2 years ago

Yes, it works with kubectl, I do not know the pkcs12 file.

fabracht commented 1 year ago

Hi. I'm having the same issue here. Apparently I there's a simple workaround. I'm running minikube version: v1.30.1, on a MacOS 13.3.1 arm64. This is the output of context:

[none] [none] [none] > context
 Context    Api Server Address      
════════════════════════════════════
 minikube   https://127.0.0.1:49814 
────────────────────────────────────

When I try context minikube, I get: [WARN] Couldn't find/load context minikube, now no current context. Error: Reqwest error: builder error: MAC verification failed during PKCS12 import (wrong password?)

I'm using Click 0.6.2.

The error seems to originate here: describe/k8s.rs line 132

    let pfx = p12::PFX::new(&cert_pem.contents, &key_der, None, "", "")
        .ok_or_else(|| ClickError::ConfigFileError("Could not parse pkcs12 data".to_string()))?;

    let pkcs12der = pfx.to_der();

    Identity::from_pkcs12_der(&pkcs12der, "").map_err(|e| e.into())

Setting the password value to something gets me through the context minikube command. But when trying to access any resources I get:

Reqwest error: error sending request for url (https://127.0.0.1:49814/apis/batch/v1/jobs?): error trying to connect: The certificate was not trusted.

And that's as far as I got. Hope it helps. Thanks