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

Getting NODE_TOKEN with custom password protected ssh-key leads to too verbose NODE_TOKEN env var #420

Open
1 of 2 tasks
sebastianstephan opened this issue Nov 11, 2023 · 0 comments

Comments

@sebastianstephan
Copy link

When fetching the NODE_TOKEN from first server with --ssh-key, the output in NODE_TOKEN also contains console output from the command itself where it asks for the passphrase.

Why do you need this?

It's a small bug, because it brakes the automated scripts of k3sup and makes me edit the NODE_TOKEN env var after fetching it.

Expected Behaviour

When fetching the NODE_TOKEN of the first server in the generated planned script via:

export NODE_TOKEN=$(k3sup node-token --host hostname.local --user myuser --ssh-key ~/mykeyfile)

I get a proper NODE_TOKEN

Current Behaviour

Currently, the console outputs:

$ export NODE_TOKEN=$(k3sup node-token --host hostname.local --user myuser --ssh-key ~/mykeyfile)
Fetching: /etc/rancher/k3s/k3s.yaml
Remote: hostname.local:22

It then expects the passphrase for the key file but does not write that. I only saw it because the cursor turned into a key. After I typed the correct key, I get something back.
But echoing the $NODE_TOKEN is giving me:

$ echo $NODE_TOKEN
Enter passphrase for '/Users/myuser/mykeyfile':
K10dxxxxxxxxxxxxxxxxxxxxxx9c5816b8c7xxxxxxxxxx09f::server:a2xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Somehow the output, that is expected to be shown in the terminal in sent to the env var.

Possible Solution

Steps to Reproduce

  1. Create a setup script via k3sup plan with --ssh-key filled with password protected private key
  2. run the install of the first server
  3. fetch the NODE_TOKEN with --ssh-key inserted with passphrase protected private key file
  4. echo the $NODE_TOKEN env var

Your Environment

  • k3sup version:
0.13.3
  • What Kubernetes distribution, client and server version are you using?
kubectl version
  • What OS or type or VM are you using for your cluster? Where is it hosted? (for k3sup install/join):

  • Operating System and version (e.g. Linux, Windows, MacOS):

uname -a
Darwin MyMBP 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020 arm64
cat /etc/os-release
cat: /etc/os-release: No such file or directory

Do you want to work on this?

Subject to design approval, are you willing to work on a Pull Request for this issue or feature request?

  • Yes
  • No
@sebastianstephan sebastianstephan changed the title Getting NODE_TOKEN with custom ssh-key leads to too verbose NODE_PORT Getting NODE_TOKEN with custom ssh-key leads to too verbose NODE_TOKEN Nov 11, 2023
@sebastianstephan sebastianstephan changed the title Getting NODE_TOKEN with custom ssh-key leads to too verbose NODE_TOKEN Getting NODE_TOKEN with custom password protected ssh-key leads to too verbose NODE_TOKEN env var Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant