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

Vendir is failing to fetch content if private-key does not have newline at the end #350

Closed
kumaritanushree opened this issue Jan 8, 2024 · 0 comments · Fixed by #349
Closed
Assignees
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed

Comments

@kumaritanushree
Copy link
Contributor

kumaritanushree commented Jan 8, 2024

What steps did you take:
Steps to reproduce the issue:
-> Copy the content from file ~/.ssh/id_rsa (assuming this is the private key file on your system)
-> encode the key by running cmd: pbpaste | base64
-> create vendir.yml

apiVersion: v1
kind: Secret
metadata:
  name: http-auth
data:
  ssh-privatekey:  <paste encoded value of private-key>
---
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: vendor
  contents:
  - path: dump
    git:
      url: git@github.com:carvel-dev/vendir.git
      ref: origin/develop
      secretRef:
        name: http-auth

-> run vendir sync and you will see the error:

Load key "/Users/ktanushree/code_work/test-repo/.vendir-tmp/incoming/git-auth/private-key": invalid format
  git@github.com: Permission denied (publickey).
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.

vendir: Error: Syncing directory 'vendor':
  Syncing directory 'dump' with git contents:
    Fetching git repository:
      Git [fetch origin main]: exit status 128 (stderr: Load key "/Users/ktanushree/code_work/test-repo/.vendir-tmp/incoming/git-auth/private-key": invalid format
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
)

Note: pbpaste does not add new line but if you will use cat instead of pbpaste you will see newline will get added to your private key. You can try same steps just encode your private key by running command: cat ~/.ssh/id_rsa | base64. This will work fine.

What happened:
[A small description of the issue]

What did you expect:
Vedir should work fine with/without newline in privatekey.

Anything else you would like to add:
Git actually does not work if privatekey does not have newline at the end. So add newline when vendir is writing privateKey in file. Private key with multiple newline also accepted by git.

Environment:

  • vendir version (execute vendir --version):
  • OS (e.g. from /etc/os-release):

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@kumaritanushree kumaritanushree added bug This issue describes a defect or unexpected behavior carvel-triage This issue has not yet been reviewed for validity labels Jan 8, 2024
@kumaritanushree kumaritanushree self-assigned this Jan 8, 2024
@renuy renuy changed the title Vedir is failing to fetch content if private-key does not have newline at the end Vendir is failing to fetch content if private-key does not have newline at the end Jan 9, 2024
@renuy renuy added carvel-accepted This issue should be considered for future work and that the triage process has been completed and removed carvel-triage This issue has not yet been reviewed for validity labels Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants