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: add proxyproto support #318

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bretello
Copy link
Contributor

@bretello bretello commented Jan 17, 2025

When using uptermd through a tcp reverse proxy, such as Traefik, the real IP address of ssh clients is masked by the proxy.

By leveraging the proxy protocol and goproxyproto, the correct addresscan be reported by uptermd.

This PR adds a --proxy-protocol flag to enable this feature.

An example traefik docker-compose configuration is also provided.

this is useful for scenarios in which uptermd is behind a proxy,
in order for it to properly show IP addresses associated with
ssh connections.

Also see https://github.com/haproxy/haproxy/blob/master/doc/proxy-protocol.txt
Comment on lines +104 to +106
if opt.ProxyProtocol {
sshln = &proxyproto.Listener{Listener: sshln}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could similarly wrap the wsln listener below, although in that case there are multiple methods in which the client's real IP address can reported (X-Forwarded-For and X-real-ip headers for example). So I excluded it as out of the scope for this PR.

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

Successfully merging this pull request may close these issues.

1 participant