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: sshnp pure dart for direct ssh #443

Merged
merged 27 commits into from Sep 12, 2023
Merged

Conversation

gkc
Copy link
Contributor

@gkc gkc commented Sep 10, 2023

- What I did

  • support the pure-dart SSHClient for forward ssh
  • use ephemeral ssh keys for forward ssh tunnel. these are generated on the daemon side which obviates the requirement to have ssh-keygen available on the client side when using forward ssh (which will be the default behaviour once sshnoports v4.0.0 is released)
  • configurable --idle-timeout for tunnel connections
  • optionally apply local port forwarding from localSshOptions to the initial (tunnel) forward ssh connection (new --add-forwards-to-tunnel flag in sshnp)
  • configurable --ephemeral-permissions option on daemon to control what hosts and ports can be forwarded to on the forward tunnel connections (because the forward ssh tunnel connections use ephemeral keys and thus are constrained to be able to literally nothing other than connect, by default)
  • added --local-sshd-port option to sshnpd for installations which are using non-standard sshd ports, and accordingly also added --remote-sshd-port option to sshnp
  • fixed a couple of bugs which had crept into trunk for forward ssh. Next we need to add to the e2e test pack in order to prevent any more regressions in the future.

- How I did it
See messages on the individual commits in the PR

- How to verify it

  • Existing e2e tests pass
  • Manual tests of forward ssh pass

- fix: fix a couple of bugs when using direct ssh which were introduced over the past month in the trunk branch
  - use 'localhost' for the host to ssh to in the SSHNP return value / output string
  - do not start sshrv when fetching host and port from sshrvd; do so only when using reverse ssh
- refactor: move some shared constants into new file, common/defaults.dart
- refactor: move some shared functions to common/utils.dart (generating ssh keys, adding to authorized_keys file and removing from authorized_keys file)
- feat: add pure dart sshclient support to sshnp for direct ssh
- feat: add `remoteSshdPort` and `idleTimeout` parameters to SSHNP
- feat: add `localSshdPort` to SSHNPD
- feat: add ephemeral keys support for direct ssh
…rt` (2) connect as `remoteUsername`

fix: bug fix to `directSshViaExec` - fix the local port forwarding directive to use `remoteSshdPort` not `localSshdPort`
feat: bin/sshnp : print the result to stderr if the result is SSHNPFailed
feat: add `Future<void> get done` to SSHNP which completes when the SSHNP instance is no longer doing anything
feat: added `allowed` property to SSHNPArg
feat: added `sshClient` property to SSHNP; added 'ssh-client' to sshnp's params
feat: bin/sshnp: now awaits sshnp.done if a non-failure result
fix: fix bug introduced during refactoring of authorized_keys file management: ensure sessionId is written to authorized_keys when adding ephemeral public keys
fix: make ci work again, maybe?
…gher to eliminate dependency analysis warnings from version 3.3.7
… writing to authorized_keys

refactor: rename `addPublicKeyToAuthorizedKeys` in common/utils.dart to `addEphemeralKeyToAuthorizedKeys`
refactor: rename `removeFromAuthorizedKeys` in common/utils.dart to `removeEphemeralKeyFromAuthorizedKeys`
test: reverted test.sh
XavierChanth
XavierChanth previously approved these changes Sep 11, 2023
@gkc gkc marked this pull request as ready for review September 12, 2023 10:50
@gkc gkc merged commit 27dbcce into trunk Sep 12, 2023
12 checks passed
@gkc gkc deleted the feat/sshnp-pure-dart-for-direct-ssh branch September 12, 2023 10:53
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.

None yet

2 participants