Remote Access Service: Daemon with rshell/rexec Commands (fastn ssh in past) #2200
Replies: 3 comments 3 replies
-
|
@siddhantk232 I have created this discussion and would like your feedback on it. I am thinking of making this is the first release related to p2p in fastn. |
Beta Was this translation helpful? Give feedback.
-
🚀 Implementation Progress Update✅ Completed Foundation (100% Design Compliant)CLI Commands:
File Structure (Exact Spec): Security Model:
🏗️ Architecture EnhancementsModular Design:
Developer Testing Tools: # Direct P2P testing without file setup complexity
fastn-ssh listen --private-key "hex-content" --allowed "id52a,id52b"
fastn-ssh connect --private-key "hex-content" target-id52Enhanced Key Management:
🔨 Current Work: P2P Integration Next Phase: Implementing SSH protocol over fastn-p2p:
Missing Utilities Identified:
📊 Compliance Status
The implementation maintains strict compatibility with the original design while adding developer convenience layers. Ready for Status: Foundation complete, moving to P2P protocol implementation phase. |
Beta Was this translation helpful? Give feedback.
-
🔄 Design Update: SSH → Remote Access TerminologyI've updated the design to use cleaner fastn remote access terminology instead of SSH-specific language: Key Changes:
Why the change:
Updated design document: See original post ⬆️ (fully revised) The core functionality remains identical - just cleaner command names and consistent fastn terminology. Implementation continues with this updated design. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
fastnis now going to become an always on service. It will read forFASTN_HOMEand run things there.fastn initfastn initwill create theremotefolder and its conten# fastn Remote Access Service: Always-On Daemon with rshell/rexec Commandsfastnis now going to become an always on service. It will read forFASTN_HOMEand run things there.fastn initfastn initwill create theremotefolder and its content inFASTN_HOME. Subsequent attempt to init will fail with message saying it's already initialized.fastn daemonfastn daemonwill run in foreground mode, and will log to stdout. It is responsibility of OS specific services to handling logging to files, starting/restarting fastn daemon etc.For now it will only run remote access service.
Strict Mode
fastn initMUST be called beforefastn daemoncan work,fastn daemonwill not auto init.FASTN_HOMEThis would default to APPDIR[fastn] (OS dependent) if not found. It will contain:
fastn.lockfastn daemonwill try to acquire exclusive lock on this file. If it succeeds it will try to run, if not it will exist with error. This will help make sure at any time only onefastn daemonis running on the machine.Remote Access Service
The remote access service will listen on
FASTN_HOME/remote/remote.private-key, so other machines can connect using this key's ID52 to execute commands.remote/config.tomlfastn statusfastn statuswill tell you if the daemon is working. It will also tell you the id52 of your machine, in case you want to share it with others. This will also report if any remote sessions are ongoing right now.How To Use
With
fastn daemonrunning on a remote machine, you can use fastn remote access:fastn rshell <alias-or-id52>- Interactive remote shell (PTY mode)fastn rshell <alias-or-id52> <command>- Execute command in shell (PTY mode)fastn rexec <alias-or-id52> <command>- Execute command with separate stdout/stderr streams (for automation)PTY mode provides interactive terminal experience. Use
rexecwhen you need separate streams for automation or tools that require clean output parsing.All modes require your own id52 to be added in remote's
config.tomlwithallow-remote = true.Technical Stuff
fastn-daemoncratefastncrate will simply callfastn_daemon::runwhenfastn daemonis called. All logic will be in the daemon.CLI
For testing purpose, and to not have to compile entire
fastnto only seedaemondownstream changes, we will letfastn-daemonalso act as a binary. It will haverun(no command = run) andinitsub commands.fastn-remotefastn-daemonwill depend onfastn-remoteand call these methods:Server-side:
fastn_remote::init(fastn_home: &Path) -> ()fastn_remote::run(fastn_home: &Path) -> ()Client-side:
fastn_remote::rshell(fastn_home: &Path, target: &str, command: Option<&str>) -> ()fastn_remote::rexec(fastn_home: &Path, target: &str, command: &str) -> ()All are asynchronous functions in Rust, and later will be spawned on tasks.
Developer Testing CLI
fastn-remoteincludes a CLI binary for developer testing only of P2P remote access functionality without daemon setup. This is not intended for end users - usefastn rshell/rexeccommands instead.The testing CLI accepts key content directly for explicit P2P testing:
fastn-remote listen --private-key=<hex-content> --allowed=id52,comma-separated- Start remote access listenerfastn-remote rshell --private-key=<hex-content> <server-id52>- Interactive shell (PTY mode)fastn-remote rshell --private-key=<hex-content> <server-id52> <command>- Command with PTYfastn-remote rexec --private-key=<hex-content> <server-id52> <command>- Command with separate streamsAllow Dangerously
Initially I thought we should allow this in
remote/config.toml:But now I think if you need this kind of low level automation, use the developer testing CLI:
fastn-remote listen --private-key=<> --dangerously-allow-everyoneinstead of creating an insecure config exposed as part offastn-daemon/fastn.Historical Note
This design was originally conceived as "fastn SSH Service" using SSH terminology (
fastn ssh,allow-ssh, etc.). We've evolved to use fastn-specific remote access terminology (fastn rshell/rexec,allow-remote) for several reasons:rshell/rexecvs complex flag combinationsThe underlying protocol remains SSH-like (ID52 authentication, PTY/exec modes) but with cleaner command interface optimized for fastn workflows.t in
FASTN_HOME. Subsequent attempt to init will fail with message saying it's already initialized.fastn daemonfastn daemonwill run in foreground mode, and will log to stdout. It is responsibility of OS specific services to handling logging to files, starting/restarting fastn daemon etc.For now it will only run remote access service.
Strict Mode
fastn initMUST be called beforefastn daemoncan work,fastn daemonwill not auto init.FASTN_HOMEThis would default to APPDIR[fastn] (OS dependent) if not found. It will contain:
fastn.lockfastn daemonwill try to acquire exclusive lock on this file. If it succeeds it will try to run, if not it will exist with error. This will help make sure at any time only onefastn daemonis running on the machine.Remote Access Service
The remote access service will listen on
FASTN_HOME/remote/remote.private-key, so other machines can connect using this key's ID52 to execute commands.remote/config.tomlfastn statusfastn statuswill tell you if the daemon is working. It will also tell you the id52 of your machine, in case you want to share it with others. This will also report if any remote sessions are ongoing right now.How To Use
With
fastn daemonrunning on a remote machine, you can use fastn remote access:fastn rshell <alias-or-id52>- Interactive remote shell (PTY mode)fastn rshell <alias-or-id52> <command>- Execute command in shell (PTY mode)fastn rexec <alias-or-id52> <command>- Execute command with separate stdout/stderr streams (for automation)PTY mode provides interactive terminal experience. Use
rexecwhen you need separate streams for automation or tools that require clean output parsing.All modes require your own id52 to be added in remote's
config.tomlwithallow-remote = true.Technical Stuff
fastn-daemoncratefastncrate will simply callfastn_daemon::runwhenfastn daemonis called. All logic will be in the daemon.CLI
For testing purpose, and to not have to compile entire
fastnto only seedaemondownstream changes, we will letfastn-daemonalso act as a binary. It will haverun(no command = run) andinitsub commands.fastn-remotefastn-daemonwill depend onfastn-remoteand call its.init()and.run()methods. Both are asynchronous functions in Rust, and later will be spawned on a task on its own.Developer Testing CLI
fastn-remoteincludes a CLI binary for developer testing only of P2P remote access functionality without daemon setup. This is not intended for end users - usefastn rshell/rexeccommands instead.The testing CLI accepts key content directly for explicit P2P testing:
fastn-remote listen --private-key=<hex-content> --allowed=id52,comma-separated- Start remote access listenerfastn-remote rshell --private-key=<hex-content> <server-id52>- Interactive shell (PTY mode)fastn-remote rshell --private-key=<hex-content> <server-id52> <command>- Command with PTYfastn-remote rexec --private-key=<hex-content> <server-id52> <command>- Command with separate streamsAllow Dangerously
Initially I thought we should allow this in
remote/config.toml:But now I think if you need this kind of low level automation, use the developer testing CLI:
fastn-remote listen --private-key=<> --dangerously-allow-everyoneinstead of creating an insecure config exposed as part offastn-daemon/fastn.Historical Note
This design was originally conceived as "fastn SSH Service" using SSH terminology (
fastn ssh,allow-ssh, etc.). We've evolved to use fastn-specific remote access terminology (fastn rshell/rexec,allow-remote) for several reasons:rshell/rexecvs complex flag combinationsThe underlying protocol remains SSH-like (ID52 authentication, PTY/exec modes) but with cleaner command interface optimized for fastn workflows.
Beta Was this translation helpful? Give feedback.
All reactions