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

feat(remoteaccess): support easier ssh port-forwarding for users #419

Merged
merged 6 commits into from
Jan 13, 2025

Conversation

reubenmiller
Copy link
Owner

@reubenmiller reubenmiller commented Jan 13, 2025

Minor improvements to the c8y remoteaccess command to make it easier for users to start ssh port-forwarding (in various ways).

  • c8y remoteaccess connect ssh - New -L <[bind_address:]port:host:hostport> flag which is used to pass to the ssh -L port-forwarding flag. But it also supports a short-form, -L <port> or -L <local_port>:<remote_port>

  • c8y remoteaccess connect run - Inherits the parent's environment variables so it behaves the same as being run manually by the user in the shell

Examples

# Example 1: Setup ssh port forwarding, 127.0.0.1:1883 (remote) to 1883 (local)
c8y remoteaccess connect ssh --device 12345 --user admin -L 1883:127.0.0.1:1883

# Example 2: Setup ssh port forwarding, 127.0.0.1:1883 (remote) to 1883 (local)
c8y remoteaccess connect ssh --device 12345 --user admin -L 1883

# Example 3: Setup ssh port forwarding, 127.0.0.1:1883 (remote) to 1884 (local)
c8y remoteaccess connect ssh --device 12345 --user admin -L 1884:1883

# Example 4: Setup ssh port forwarding using custom ssh command call
c8y remoteaccess connect run --device rpi5-abcdef01 --configuration passthrough -- ssh -p %p -L 1885:127.0.0.1:1883 -o ServerAliveInterval=120 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@127.0.0.1

@reubenmiller reubenmiller changed the title feat(remoteaccess): support easier ssh port-forwarding feat(remoteaccess): support easier ssh port-forwarding for users Jan 13, 2025
@reubenmiller reubenmiller merged commit 5405187 into v2 Jan 13, 2025
4 checks passed
@reubenmiller reubenmiller deleted the feat-cra-improvements branch January 13, 2025 21:36
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