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 remote access connections to devices #368

Merged
merged 23 commits into from
May 18, 2024

Conversation

reubenmiller
Copy link
Owner

@reubenmiller reubenmiller commented May 14, 2024

Add support for creating remote access configurations and connecting to passthrough connections via a local proxy.

This feature will replace c8ylp as it provides the proxy functionality with zero dependencies on python! The local proxy is actually very simple in golang (compared to python), and allows for a nicer integration with go-c8y-cli.

The local proxy part was added to go-c8y (but still in a feature branch), and the go-c8y-cli is just about getting input from the user and then using the local proxy.

The following functionality is implemented:

  • c8y remoteaccess connect ssh (stdio, TCP, socket all implemented)
  • c8y remoteaccess server
    • open browser to server address
  • Validate long ssh sessions (e.g. > 8 hours)
  • c8y remoteaccess configurations subcommands to manage existing connections
  • pipeline support (this requires another in-progress feature)
  • configuration completion
  • allow users to set a default ssh user
  • allow users to launch an additional command after starting the server and give the process access to the port number

Below shows an example of an ssh created with the new local proxy commands (without using c8ylp!)

% c8y remoteaccess connect ssh --device rpix-abcdef --user root
Starting interactive ssh session with 991210 (https://example.c8y.io)

Warning: Permanently added '[127.0.0.1]:63005' (ED25519) to the list of known hosts.
Linux rpix-abcdef 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May 14 21:26:43 2024 from 127.0.0.1
root@rpix-abcdef ~ # pwd
/root
root@rpix-abcdef ~ # exit
Connection to 127.0.0.1 closed.
2024/05/14 22:35:00 Connection closed: D: 127.0.0.1:63005, S: 192.168.68.58:63007
Duration: 9.753s

@reubenmiller reubenmiller marked this pull request as ready for review May 18, 2024 09:46
@reubenmiller reubenmiller merged commit ca1a1e8 into v2 May 18, 2024
4 checks passed
@reubenmiller reubenmiller deleted the feat-remote-access-client branch May 18, 2024 19:48
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