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

ssh proxy route connection by ssh options SendEnv ? #40

Open
kelify opened this issue Apr 19, 2024 · 3 comments
Open

ssh proxy route connection by ssh options SendEnv ? #40

kelify opened this issue Apr 19, 2024 · 3 comments

Comments

@kelify
Copy link

kelify commented Apr 19, 2024

i want to use that porject as a ssh router , my mutli backend or upstream linux server has a same user account. so i am going to use client command like that "ssh user@proxy_address -p 2222 -o SendEnv=upstream_addr -o SendEnv=upsream_port " to connect the proxy server ,and than the server will route connection by env . how to do that at this project?

@jonathanMelly
Copy link

jonathanMelly commented Apr 19, 2024

hi, here is how I would translate your situation with the use I make of this project:

ssh user_upstreamIdentifier@proxy_address -p 2222

with following impl:

func FindUpstreamByUsername(username string) (string, error) {
	parts := strings.Split(username, "_")
	if len(parts) == 2 {
		host := parts[1]
		if host == "upstream1" {
                      return "10.0.0.5" // or net.LookupHost(host)...
                }
	}
	return "", errors.New("access denied")
}

@kelify
Copy link
Author

kelify commented Apr 19, 2024

hi, thranks for your answer, but my background is my upstreams server have a same account for login. in your example, that username actually pass to upstream server is difference. can you have some method to impl my purpose?

@jonathanMelly
Copy link

hi, thranks for your answer, but my background is my upstreams server have a same account for login. in your example, that username actually pass to upstream server is difference. can you have some method to impl my purpose?

Ok from what I understand of your requirement and this project what you want is not possible as sshr is "just tunneling" the network traffic (incl. original username) to a host...

@tsurubee am I right ?

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

2 participants