-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Better Ansible compatibility #929
Comments
I know this is really basic code, but this appears to work for me; /*
Copyright 2017 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"github.com/gravitational/teleport/tool/tsh/common"
)
import (
"os"
"path"
)
func main() {
cmd_line_orig := os.Args[1:]
cmd_line := []string{}
switch path.Base(os.Args[0]) {
case "ssh":
cmd_line = append([]string{"ssh"}, cmd_line_orig...)
case "scp":
cmd_line = append([]string{"scp"}, cmd_line_orig...)
default:
cmd_line = cmd_line_orig
}
common.Run(cmd_line, false)
} I then created a symlink for ssh and scp; ln -snf /usr/local/bin/tsh /usr/bin/ssh
ln -snf /usr/local/bin/tsh /usr/bin/scp Ran a couple of very basic tests. All of them were successful. |
@nikatjef woo! thanks, exactly what I was thinking about. And you tried this under ansible, correct? |
I don't use ansible, but I did test the commands as basic SSH and SCP commands, including using batch commands to SSH and a single recursive directory copy with SCP. |
so the only thing i need to do to make ansible work with teleport is this? ln -snf /usr/local/bin/tsh /usr/bin/ssh if not, what else do i need to set ? |
* Fix menu bug that adds features unto existing features * Add missing top spacing for OSS Account view * Update e-ref
* Fix menu bug that adds features unto existing features * Add missing top spacing for OSS Account view * Update e-ref
Currently, if you want to use Ansible with Teleport, you have to configure OpenSSH client
ssh
to use Teleport auth via an agent. This is not hard, but introduces extra moving parts.A much cooler way to do this would be to have
tsh
behave exactly likessh
. So imagine you have a symlink:Now, when you execute
/usr/bin/ssh
you're actually executingtsh
andtsh
by looking at it's arg[0] can seessh
in there and assumetsh ssh
was given. This would make Ansible work natively via tsh without having the agents run around.Assigning for myself as a small weekend project.
The text was updated successfully, but these errors were encountered: