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

RSDK-10257 - Early return if tunnel destination port not allowed #4856

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cheukt
Copy link
Member

@cheukt cheukt commented Mar 14, 2025

maybe merge next week to allow for the rollout of config changes first.

example output

❯ viam machine part tunnel --part XXXX --destination-port 1010 --local-port 8888
Error: Tunneling to destination port 1010 not allowed.

@cheukt cheukt requested a review from benjirewis March 14, 2025 16:32
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Mar 14, 2025
@@ -1368,6 +1368,21 @@ func RobotsPartTunnelAction(c *cli.Context, args robotsPartTunnelArgs) error {
}

func tunnelTraffic(ctx *cli.Context, robotClient *client.RobotClient, local, dest int) error {
// don't block tunnel attempt if ListTunnels fails in any way - it may be unimplemented.
// TODO: early return if ListTunnels fails.
Copy link
Member Author

Choose a reason for hiding this comment

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

maybe do in a month

Copy link
Member

Choose a reason for hiding this comment

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

You don't want to this in actual robotClient.Tunnel? That way both the CLI and anyone trying to programmatically use robotClient.Tunnel both encounter early errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

issue is robotClient.Tunnel isn't called until the first connection is made. if robotClient.Tunnel is called, it'd error out immediately even without this change

Copy link
Member

Choose a reason for hiding this comment

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

Ah gotcha thanks for the explanation 🙏🏻 .

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Mar 14, 2025
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

LGTM

cli/client.go Outdated
}
}
if !allowed {
return errors.Errorf("tunneling to destination port %v not allowed", dest)
Copy link
Member

Choose a reason for hiding this comment

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

Could add a small message about ensuring traffic_tunnel_endpoints is set correctly on your machine.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants