Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported type of credentials provided, either SSH private key or username/password is supported (exit code 110) #1116

Open
SihengCui opened this issue Sep 28, 2022 · 10 comments
Labels
triage/support Indicates an issue that is a support question.

Comments

@SihengCui
Copy link

For private HTTP git repositories, the name references a secret in the namespace that contains username and password.

kind: Build
metadata:
  name: builder-zps9k-build-ktbvv
  namespace: default
  labels:
    openfunction.io/builder: builder-zps9k
  resourceVersion: '3629355'
spec:
  builder:
    image: openfunction/builder-go:latest
  output:
    credentials:
      name: push-secret
    image: "xxx"
  paramValues:
    - name: ENV_VARS
      value: FUNC_CLEAR_SOURCE=true#FUNC_GOPROXY=https://goproxy.cn#FUNC_NAME=HelloWorld#PORT=8080
  source:
    credentials:
      name: basic-user-pass
    revision: master
    url: http://bitbucket.xxx/xxx/serverless-example.git
  strategy:
    kind: ClusterBuildStrategy
    name: openfunction
kind: Secret
apiVersion: v1
metadata:
  name: basic-user-pass
  namespace: default
  annotations:
    tekton.dev/git-0: http://bitbucket.xxx
  resourceVersion: '3421673'
data:
  password: xxxx
  username: xxxx
type: kubernetes.io/basic-auth

Looking at the Pod, it is found that the container that pulls the code exist the following command
/ko-app/git ... --secret-path /workspace/shp-source-secret
I keep the container, cd to the /workspace/shp-source-secret and find that there are two files username and password,
when I manually execute /ko-app/git ... --secret-path /workspace/shp-source-secret , it also printUnsupported type of credentials provided, either SSH private key or username/password is supported (exit code 110).

Why, is my certificate format wrong?

@dheerajodha
Copy link
Contributor

dheerajodha commented Sep 29, 2022

I could be wrong but maybe this might help: #968 (comment)

@SaschaSchwarze0
Copy link
Member

@SihengCui when you created the secret, where xxxx plain text or base64 encoded ? It should be the latter, or you use stringData to provide plain-text and the Kubernetes will encode it. Above mentioned PR improves our documentation as passwords are not supported anymore, but instead it must be a token.

@SaschaSchwarze0 SaschaSchwarze0 added the triage/support Indicates an issue that is a support question. label Oct 5, 2022
@SihengCui
Copy link
Author

SihengCui commented Oct 10, 2022

@SihengCui when you created the secret, where xxxx plain text or base64 encoded ? It should be the latter, or you use stringData to provide plain-text and the Kubernetes will encode it. Above mentioned PR improves our documentation as passwords are not supported anymore, but instead it must be a token.

emmm.. Do you mean that the password field is filled with the token string? But the git repo is a private Bitbucket. It seems that there is only password. In this case, is there any way to pass the certification?

@SihengCui SihengCui reopened this Oct 10, 2022
@SaschaSchwarze0
Copy link
Member

I have never used BitBucket, but seems like will need some (doc?) changes based on https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/#Cloning-a-repository-with-an-access-token. @SihengCui can you try what happens when you put x-token-auth as username into the secret and your access token as password?

@SihengCui
Copy link
Author

SihengCui commented Oct 10, 2022

I have never used BitBucket, but seems like will need some (doc?) changes based on https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/#Cloning-a-repository-with-an-access-token. @SihengCui can you try what happens when you put x-token-auth as username into the secret and your access token as password?

There are something different with git repo using HTTP or HTTPS protocol.
I chose a non-existing domain as my repo address git.sihengcui.com.

url: http://git.sihengcui.com/scm/serverless-example.git

2022/10/10 08:46:24 Info: ssh (/usr/bin/ssh): OpenSSH_8.0p1, OpenSSL 1.1.1k  FIPS 25 Mar 2021
2022/10/10 08:46:24 Info: git (/usr/bin/git): git version 2.31.1
2022/10/10 08:46:24 Info: git-lfs (/usr/bin/git-lfs): git-lfs/2.13.3 (GitHub; linux amd64; go 1.17.5)
2022/10/10 08:46:24 /usr/bin/git clone -h
2022/10/10 08:46:24 /usr/bin/git submodule -h
2022/10/10 08:46:24 Unsupported type of credentials provided, either SSH private key or username/password is supported (exit code 110)

After that I just modified http to https.
url: https://git.sihengcui.com/scm/serverless-example.git
It did not prompt "Unsupported type".

2022/10/10 08:51:10 Info: ssh (/usr/bin/ssh): OpenSSH_8.0p1, OpenSSL 1.1.1k  FIPS 25 Mar 2021
2022/10/10 08:51:10 Info: git (/usr/bin/git): git version 2.31.1
2022/10/10 08:51:10 Info: git-lfs (/usr/bin/git-lfs): git-lfs/2.13.3 (GitHub; linux amd64; go 1.17.5)
2022/10/10 08:51:10 /usr/bin/git clone -h
2022/10/10 08:51:10 /usr/bin/git submodule -h
2022/10/10 08:51:10 /usr/bin/git clone --quiet --no-tags --single-branch --branch master --depth 1 -c credential.helper=store --file /tmp/cred-helper-file3502023043 -- https://git.sihengcui.com/scm/serverless-example.git /workspace/source
2022/10/10 08:51:11 fatal: unable to access 'https://git.sihengcui.com/scm/serverless-example.git/': Could not resolve host: git.sihengcui.com (exit code 128)

Could this be the cause ?

@SihengCui
Copy link
Author

SihengCui commented Oct 10, 2022

I have never used BitBucket, but seems like will need some (doc?) changes based on https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/#Cloning-a-repository-with-an-access-token. @SihengCui can you try what happens when you put x-token-auth as username into the secret and your access token as password?

I put access token as password. And success pull the private repository from my github. So I am sure the format of the secret is correct. When the url is replaced with http://bitbucket.xxxxx, even if the username and token are not replaced, a 401 authentication error should be returned instead of Unsupported type.

@SaschaSchwarze0
Copy link
Member

SaschaSchwarze0 commented Oct 19, 2022

From grooming:

@dheerajodha
Copy link
Contributor

dheerajodha commented Oct 27, 2022

Hi @SihengCui, if possible, can you help me by providing the exact yaml files you used as a step to reproduce this problem?
I want to try fixing this but I notice you've added a few 'xxx' in parts of the yaml file above and I'm not sure which values to add there.

@SihengCui
Copy link
Author

SihengCui commented Oct 28, 2022

Hi @SihengCui, if possible, can you help me by providing the exact yaml files you used as a step to reproduce this problem? I want to try fixing this but I notice you've added a few 'xxx' in parts of the yaml file above and I'm not sure which values to add there.

That's a private git address on an internal network. If you need to reproduce the problem, just request any of the HTTP repositories. NOT https

@dheerajodha
Copy link
Contributor

That's a private git address on an internal network. If you need to reproduce the problem, just request any of the HTTP repositories. NOT https

Awesome, I'll do that. Thank you!

HeavyWombat added a commit that referenced this issue Dec 22, 2022
Fixes: #1131

Ref: #1116

Check that basic auth is not used in combination with a HTTP endpoint.
HeavyWombat added a commit that referenced this issue Dec 22, 2022
Fixes: #1131

Ref: #1116

Check that basic auth is not used in combination with a HTTP endpoint.
HeavyWombat added a commit that referenced this issue Dec 22, 2022
Fixes: #1131

Ref: #1116

Check that basic auth is not used in combination with a HTTP endpoint.
HeavyWombat added a commit that referenced this issue Jan 4, 2023
Fixes: #1131

Ref: #1116

Check that basic auth is not used in combination with a HTTP endpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

3 participants