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

Cert file naming makes Copy function in ssh_runner.go break #20080

Open
Chasarr opened this issue Dec 10, 2024 · 1 comment
Open

Cert file naming makes Copy function in ssh_runner.go break #20080

Chasarr opened this issue Dec 10, 2024 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Chasarr
Copy link

Chasarr commented Dec 10, 2024

What Happened?

One of my certificates used on my system is called my_cert(1).crt. This naming does not work, since the Copy function in ssh_runner.go tries to run scp += fmt.Sprintf(" && sudo touch -d \"%s\" %s", mtime.Format(layout), dst). This makes Bash run sudo touch -d "2024-12-10 14:39:09.586983523 +0100" /usr/share/ca-certificates/my_cert(1).pem, which is an invalid command, since the parenthesis needs to be preceded by a backslash like this:
sudo touch -d "2024-12-10 14:39:09.586983523 +0100" /usr/share/ca-certificates/my_cert\(1\).pem

This can of course be resolved by changing the name of the cert file.

I would attempt to fix this myself, but I am unfortunately not a go developer.

Attach the log file

I don't think the entire log is necessary to paste here due to me finding out the cause of the bug myself, and I don't feel like sanitizing the output from secret environment variables and such. The line with the error goes as follows:

❌ Exiting due to GUEST_CERT: Failed to setup certs: Copy /home/chasar/.minikube/certs/my_cert(1).crt: sudo mkdir -p /usr/share/ca-certificates && sudo scp -t /usr/share/ca-certificates && sudo touch -d "2024-12-10 14:39:09.586983523 +0100" /usr/share/ca-certificates/my_cert(1).pem: Process exited with status 2
output: bash: -c: line 1: syntax error near unexpected token (' bash: -c: line 1: sudo mkdir -p /usr/share/ca-certificates && sudo scp -t /usr/share/ca-certificates && sudo touch -d "2024-12-10 14:39:09.586983523 +0100" /usr/share/ca-certificates/my_cert(1).pem'

Operating System

Other

Driver

None

@Ritikaa96
Copy link

cert files are important and need to have valid name, I think if we follow recommended approach this can be avoided.. Still this can create some issues and need to be looked at.
/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants