Skip to content

Cannot install chart on private Artifactory registry with self-signed cert #7140

Closed

Description

@tychedelia

We are using the Artifactory Helm plugin on Artifactory version 6.13.1. When installing a chart in a repository via helm install, the following error occurs:

» helm install --generate-name helm-virtual/foo
Error: failed to download "helm-virtual/foo" (hint: running `helm repo update` may help)

This repository was added with a specified CA file:

» helm repo add helm-virtual $ARTIFACTORY_URL/artifactory/helm-virtual --username $USER --password $PASS --ca-file=/tmp/artifactory.crt
"helm-virtual" has been added to your repositories

This is confirmed by checking ~/.helm/repository/repositories.yaml.

By changing the following to be hard coded, I can get past this error:

diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go
index 89abfb1c..f19196dd 100644
--- a/pkg/getter/httpgetter.go
+++ b/pkg/getter/httpgetter.go
@@ -89,8 +89,8 @@ func NewHTTPGetter(options ...Option) (Getter, error) {
 }

 func (g *HTTPGetter) httpClient() (*http.Client, error) {
-       if (g.opts.certFile != "" && g.opts.keyFile != "") || g.opts.caFile != "" {
-               tlsConf, err := tlsutil.NewClientTLS(g.opts.certFile, g.opts.keyFile, g.opts.caFile)
+       if true {
+               tlsConf, err := tlsutil.NewClientTLS(g.opts.certFile, g.opts.keyFile, "/tmp/artifactory.crt")
                if err != nil {
                        return nil, errors.Wrap(err, "can't create TLS config for client")
                }

Output of helm version:

» helm version
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}

Output of kubectl version:

» kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

Version
OpenShift Master:
v3.11.0+3a34b96-217
Kubernetes Master:
v1.11.0+d4cacc0
OpenShift Web Console:
v3.11.0+ea42280

Activity

  1. bacongobbler commented on Dec 3, 2019

    @bacongobbler
    Member

    What happens if you run helm install --generate-name helm-virtual/foo --ca-file /tmp/artifactory.crt?

    Can you show what's in your repositories.yaml? I recall there being a similar ticket raising that helm wasn't loading configuration from repositories.yaml, so that configuration wasn't being loaded during helm install.

  2. added
    bug
    on Dec 3, 2019
  3. tychedelia commented on Dec 3, 2019

    @tychedelia
    ContributorAuthor

    Adding the --ca-file doesn't appear to help, unfortunately. Here's the output:

    » helm install --generate-name helm-virtual/foo --ca-file /tmp/artifactory.crt --debug
    install.go:148: [debug] Original chart version: ""
    Error: Get https://artifactory.domain.local/artifactory/helm-virtual/namespace/project/foo-0.1.0.tgz: x509: certificate signed by unknown authority
    helm.go:76: [debug] Get https://artifactory.domain.local/artifactory/helm-virtual/namespace/project/foo-0.1.0.tgz: x509: certificate signed by unknown authority

    Here's my lightly edited repositories.yaml:

    » more ~/.helm/repository/repositories.yaml
    apiVersion: v1
    generated: "2019-11-18T08:10:04.905525-08:00"
    repositories:
    - caFile: ""
      cache: /Users/jmcelwain/.helm/repository/cache/stable-index.yaml
      certFile: ""
      keyFile: ""
      name: stable
      password: ""
      url: https://kubernetes-charts.storage.googleapis.com
      username: ""
    - caFile: ""
      cache: /Users/jmcelwain/.helm/repository/cache/local-index.yaml
      certFile: ""
      keyFile: ""
      name: local
      password: ""
      url: http://127.0.0.1:8879/charts
      username: ""
    - caFile: /tmp/artifactory.crt
      cache: /Users/jmcelwain/.helm/repository/cache/helm-virtual-index.yaml
      certFile: ""
      keyFile: ""
      name: helm-virtual
      password: ***
      url: http://artifactory.domain.local/artifactory/helm-virtual
      username: ***
  4. tychedelia commented on Dec 4, 2019

    @tychedelia
    ContributorAuthor

    I've identified the location for the fix and will submit a patch today, if that's okay with y'all.

  5. bacongobbler commented on Dec 4, 2019

    @bacongobbler
    Member

    SGTM!

  6. hickeyma commented on Jan 10, 2020

    @hickeyma
    Contributor

    @jmcelwain did you get a chance to push the PR?

  7. tychedelia commented on Jan 10, 2020

    @tychedelia
    ContributorAuthor

    @hickeyma Yes, it's here: #7164

  8. added a commit that references this issue on May 8, 2020
  9. github-actions commented on Sep 24, 2020

    @github-actions

    This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

  10. bacongobbler commented on Nov 19, 2020

    @bacongobbler
    Member

    closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions