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

Support native cmd for ssh/scp #711

Closed
vagetablechicken opened this issue Aug 25, 2020 · 7 comments
Closed

Support native cmd for ssh/scp #711

vagetablechicken opened this issue Aug 25, 2020 · 7 comments
Labels
difficulty/easy Indicates that a issue is easy to resolve. status/TODO Categorizes issue as we will do it. type/feature-request Categorizes issue as related to a new feature.
Milestone

Comments

@vagetablechicken
Copy link

Feature Request

Is your feature request related to a problem? Please describe:

Nope.
Describe the feature you'd like:

tiup cluster executor can use native ssh. That's nice. But it can only use "ssh"(in PATH). We can't define the command we want to use.

args := []string{"ssh", "-o", "StrictHostKeyChecking=no"}

Describe alternatives you've considered:
What if we use other ssh tools to connect the hosts? e.g. some ssh tools which contain security permissions.

Use alias could solve it. But it's not a good method.

I think supporting native cmd is a good way.
Teachability, Documentation, Adoption, Migration Strategy:

@vagetablechicken vagetablechicken added the type/feature-request Categorizes issue as related to a new feature. label Aug 25, 2020
@AstroProfundis AstroProfundis added difficulty/easy Indicates that a issue is easy to resolve. status/TODO Categorizes issue as we will do it. labels Aug 25, 2020
@AstroProfundis AstroProfundis added this to the v1.2.0 milestone Aug 25, 2020
@AstroProfundis
Copy link
Contributor

AstroProfundis commented Aug 25, 2020

I think we could support that by adding a new argument to specify the path of an alternative SSH executable binary, something like --ssh-path or so.

@vagetablechicken
Copy link
Author

I think we could support that by adding a new argument to specify the path of an alternative SSH executable binary, something like --ssh-path or so.

Agree entirely. I'd want --scp-path too. If --ssh-path/--scp-path is not specified, it will use "ssh"/"scp".

@9547
Copy link
Contributor

9547 commented Aug 28, 2020

if --ssh-path or --scp-path is specified, seem too much code has to refactor! Or should we set two global envars, such as TIUP_NATIVE_SSH_PATH to specify the alternative ssh executable binary, and fetch it before

args := []string{"ssh", "-o", "StrictHostKeyChecking=no"}

ssh := "ssh"

isExec := func(mode os.FileMode) bool { return mode&0111 == 0111 }
if env := os.Getenv(localdata.EnvNameNativeSSHPath); env != "" {
    if info, err := os.Stat(env); err == nil && !info.IsDir() && isExec(info.Mode()) {
        ssh = env
    }
}

args := []string{ssh, "-o", "StrictHostKeyChecking"}

@vagetablechicken
Copy link
Author

@9547 Good advice. It's not a universal need, so ENV is OK.

@lucklove
Copy link
Member

@9547 Do you have any interest on this? If so, you'd better do it after #699 been merged (in case of conflicts). Otherwise I will do it in #699

@9547
Copy link
Contributor

9547 commented Aug 31, 2020

@9547 Do you have any interest on this? If so, you'd better do it after #699 been merged (in case of conflicts). Otherwise I will do it in #699

I will send an PR tonight

@lucklove
Copy link
Member

@9547 Do you have any interest on this? If so, you'd better do it after #699 been merged (in case of conflicts). Otherwise I will do it in #699

I will send an PR tonight

Ok, then I'll not merge #699 util your PR is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/easy Indicates that a issue is easy to resolve. status/TODO Categorizes issue as we will do it. type/feature-request Categorizes issue as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants