๐Ÿšง (Alpha stage software) Binary that supports remote filesystem and process operations. ๐Ÿšง

Related tags

Utilities rust
Overview

distant

Crates.io Docs.rs

Binary to connect with a remote machine to edit files and run programs.

๐Ÿšง (Alpha stage software) This program is in rapid development and may break or change frequently! ๐Ÿšง

Details

The distant binary supplies both a server and client component as well as a command to start a server and configure the local client to be able to talk to the server.

Installation

Prebuilt Binaries

If you would like a pre-built binary, check out the releases section.

Building from Source

If you have cargo installed, you can directly download and build the source via:

cargo install distant

Alternatively, you can clone this repository and build from source following the build guide.

Examples

Launch a remote instance of distant by SSHing into another machine and starting the distant executable:

# Connects to my.example.com on port 22 via SSH to start a new session
distant launch my.example.com

# After the session is established, you can perform different operations
# on the remote machine via `distant action {command} [args]`
distant action copy path/to/file new/path/to/file
distant action run -- echo 'Hello, this is from the other side'

License

This project is licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or apache-license) MIT license (LICENSE-MIT or mit-license) at your option.

Comments
  • Not able to launch distant on my linode instance

    Not able to launch distant on my linode instance

    Hey there Chip!

    Huge thanks for this tool. Really looking forward to what it offers for those of us that do our dev work on linode/digitalocean/etc instances.

    I'm having an issue just getting the server to launch.

    While ssh'd into my remote instance:

    > distant launch <my_instance_ip> --log-level trace                                                                                                                                        
    
    ERROR [distant] Exiting due to error: <my_user>@<my_instance_ip>: Permission denied (publickey).
    

    I thought at this point it'd just launch distant for me to then connect to from my local machine (using a pub/priv key auth via ssh).

    Are there other things required in my ~/.ssh/sshconfig perhaps?

    question 
    opened by megalithic 24
  • Support `distant manager register` for Linux, FreeBSD, MacOS, and Windows

    Support `distant manager register` for Linux, FreeBSD, MacOS, and Windows

    Looking over at https://stackoverflow.com/questions/61671013/how-to-make-rust-run-gracefully-in-the-background-and-daemonize, the four platforms I want to support are

    Thought is that distant manager register will detect the operating system and then generate and install needed files to run the manager as a daemon on each platform. I don't yet know if I need to use windows-service-rs with the manager to support Windows.

    Some of these require elevated privileges. Some also distinguish between user-level and system-level daemons. We'd want to support both, defaulting towards user-level?

    enhancement 
    opened by chipsenkbeil 10
  • No such file or directory

    No such file or directory

    I downloaded the distant binary on the remote and put it on $PATH. Then

    distant launch -i path/to/identity_file.pem -u user ec2-i-p-ad-dr.ap-south-1.compute.amazonaws.com
    

    This commands exits 0. I can see that distant is running on the server by logging in via normal ssh and seeing pidof distant

    The when I run distant action system-info locally, I get

    ERROR [distant] Exiting due to error: No such file or directory (os error 2)
    
    bug wontfix pending-closure 
    opened by p00f 8
  • Windows support without WSL?

    Windows support without WSL?

    Do you plan to ever support Windows without using WSL?

    It would be wonderful to launch on my Windows instance in KVM and run distant.nvim from the Linux host, the exact opposite of WSL.

    What is currently preventing a native Windows build?

    enhancement help wanted tests refactor 
    opened by chase 8
  • Implement pluggable retry logic at raw transport level

    Implement pluggable retry logic at raw transport level

    Some types of retry to consider: https://docs.microsoft.com/en-us/azure/architecture/patterns/retry

    EternalTerminal implemented a BackedReader and BackedWriter: https://eternalterminal.dev/howitworks/

    enhancement 
    opened by chipsenkbeil 6
  • Provide ARM binary

    Provide ARM binary

    I think that remote development for the Raspberry Pi exosystem is a big usecase for this project, but I sadly have not been able to compile a binary myself. I am probably just too stupid and inexperienced, but I could not get any distant binary to run on the Pi, regardless of which toolchain and target I compiled it with, aarch64-unknown-linux-gnu, aarch64-unknow-linux-musl, arm-unknown-linux-gnueabihf, ... Either it does not compile at all or the binary is rejected on the Pi. Anyways, that is not really anyones problem but mine, but an ARM binary would be really helpful for a lot of people I think.

    question 
    opened by mdietrich16 5
  • Support defaulting launch & proc-run to use $SHELL with option for --no-shell otherwise

    Support defaulting launch & proc-run to use $SHELL with option for --no-shell otherwise

    At least for launch (proc-run may not be necessary), being able to take advantage of the path assigned to a user would be handy.

    Testing with ssh <host> echo '$SHELL' resulted in the right shell being printed, so that environment variable is available. It looks like the majority of shells support <shell> -l for login and <shell> -c <command> to run a command as non-login. Doesn't look like you can run a login shell and execute a command, but I don't think a login shell is necessary to get the path configured for the specific user as non-login will still source files like ~/.bashrc and others.

    Anyway, idea here is to default to attempting to run distant over ssh using $SHELL -c distant ... to have appropriate environment variables established. If --no-shell is provided, then we wouldn't wrap in a $SHELL call.

    Doing this for proc-run may not make sense as any environment given to the distant binary is passed on to its children; so, just providing launch with $SHELL should pass on the results to the children as well.

    enhancement breaking 
    opened by chipsenkbeil 5
  • Support ssh2 transportation to not require distant server binary

    Support ssh2 transportation to not require distant server binary

    Looking through ssh2-rs, we may be able to implement all of the current features of distant purely from a mixture of sftp and exec. There are a couple of gotchas that I think should be okay:

    1. We have to provide a mode like 644 for file operations (but capable of read/write/append for files over sftp channel)
    2. Reading a directory with a depth > 1 will require multiple calls (expensive)
    3. Running a proxy for a process is a bit different; I think I use exec and then can read stdout from the channel (see discussion), write stdin to the channel, and read stderr from this
    4. Still need to manage a proc list, but it would map to a series of channels, each dedicated to running a singular process
    5. System info would probably be unsupported as we're using info baked into our Rust binary instead of reading directly from the syste

    Authentication may be the hardest part and there's some good discussion here regarding KeyboardInteractivePrompt and userauth_password.

    enhancement 
    opened by chipsenkbeil 5
  • Full shell support

    Full shell support

    distant shell would be the command to launch a connection to the remote machine.

    In terms of manipulating the local tty, we could use crossterm or termion, maybe? Not sure how to simulate the buffer on the other side where the programs are being run (like vim). Would need to look at mosh as an example.

    enhancement 
    opened by chipsenkbeil 5
  • Supports for nvim-tree over distant

    Supports for nvim-tree over distant

    Hi, I'm trying to enhance nvim-tree by using distant. Obviously, to fetch file trees of the directory in the remote machine.

    I already passed simple test by abstracting file system API (luv.xxx and distant API).

    However, the problem was:

    1. nvim-tree uses per-file stat query (e.g., luv.fs_stat(filepath)) in the local machine (see this). However, this is inefficient in the case of distant because the latency caused by multiple network transactions (# of files in the directory) between the local and remote machine. To solve the problem, distant needs to fetch the metadata of all files in the target directory so that only one network transaction happens.

    2. nvim-tree requires access permission for each file (e.g., luv.fs_access(filepath, 'R')) (see this). However, distant only fetches whether the file is readonly or not. I found that in the rust library, functions corresponding to luv.fs_access(filepath, 'R') did not exist according to this page. However, we might be able to use mode() (I'm new to Rust language and I'm not sure). Like 1, we need to do this by only one network transaction.

    BTW, it seems that this issues is related to here. But, instead of batching commands, this issue insists that we need client query to fetch metadata of all files in the directory.

    opened by allencho1222 4
  • Upgrading to new openssl-sys crate fails to link for Lua module

    Upgrading to new openssl-sys crate fails to link for Lua module

    See example here: https://github.com/chipsenkbeil/sample-cdylib-wezterm-ssh A working version (maybe?) is here: https://github.com/chipsenkbeil/sample-cdylib-wezterm-ssh/tree/WorkingVersion

    I'm not sure why having wezterm be an indirect dependency and the main library also being a member versus having a top-level consumer of the library would fix this. It may be a false positive as Rust could be filtering out some of the code.

    Failure

    During linking, I see this on Intel and M1 Macs:

       Compiling main-lib v0.1.0 (/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/main-lib)
         Running `rustc --crate-name main_lib --edition=2018 main-lib/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --emit=dep-info,link -C opt-level=z -Clto -C codegen-units=1 -C metadata=702ba97a81d567ca --out-dir /Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps -L dependency=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps --extern helper_lib=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps/libhelper_lib-e6ab167d0119fbeb.rlib --extern mlua=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps/libmlua-e3ea2a11946416a7.rlib -C link-arg=-undefined -C link-arg=dynamic_lookup -L native=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib -L native=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib -L native=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/libssh-rs-sys-3cdd6e33e90fc2f0/out -Lnative=/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/libssh2-sys-0184ac85c61617d0/out/build`
    error: linking with `cc` failed: exit status: 1
      |
      = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/chipsenkbeil/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps/main_lib.main_lib.6fwq71c4-cgu.0.rcgu.o" "-o" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps/libmain_lib.dylib" "-Wl,-exported_symbols_list,/var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/list" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs" "-L" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/deps" "-L" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib" "-L" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib" "-L" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/libssh-rs-sys-3cdd6e33e90fc2f0/out" "-L" "/Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/libssh2-sys-0184ac85c61617d0/out/build""-L" "/Users/chipsenkbeil/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/liblibssh2_sys-bd9b1e21d051066b.rlib" "/var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/libopenssl_sys-c28c6e425d8aa49c.rlib" "/var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/liblibssh_rs_sys-46abeff4fe401922.rlib" "/Users/chipsenkbeil/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-160a7dd17f2dc334.rlib" "-lz""-lc" "-liconv" "-lssl" "-lcrypto" "-lz" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-undefined" "dynamic_lookup"
      = note: ld: warning: duplicate symbol '_BIO_ADDR_family' in:
                  /var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/libopenssl_sys-c28c6e425d8aa49c.rlib(libcrypto-lib-bio_addr.o)
                  /Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib/libcrypto.a(libcrypto-lib-bio_addr.o)
              ld: warning: duplicate symbol '_BIO_ADDRINFO_family' in:
                  /var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/libopenssl_sys-c28c6e425d8aa49c.rlib(libcrypto-lib-bio_addr.o)
                  /Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib/libcrypto.a(libcrypto-lib-bio_addr.o)
    
              ......... (bunch more warnings about duplicate symbols)
    
              ld: warning: duplicate symbol '_ossl_property_free' in:
                  /var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/libopenssl_sys-c28c6e425d8aa49c.rlib(libcrypto-lib-property_parse.o)
                  /Users/chipsenkbeil/projects/sample-cdylib-wezterm-ssh/target/release/build/openssl-sys-9f63f7f8648ac00a/out/openssl-build/install/lib/libcrypto.a(libcrypto-lib-property_parse.o)
              ld: reference to symbol (which has not been assigned an address) _ossl_property_parse_init in '_context_init' from /var/folders/fm/5_7nb1k97tqgxf4n03_2kj780000gn/T/rustcbNtGQH/libopenssl_sys-c28c6e425d8aa49c.rlib(libcrypto-lib-context.o) for architecture x86_64
              clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    help wanted 
    opened by chipsenkbeil 4
  • Support connecting to manager by id

    Support connecting to manager by id

    Rather than having to provide a pipe name and/or unix domain socket path, having a manager id would be even easier as it could default to a name or path if we want to hard-code.

    E.g. distant repl --manager-id 123 would translate into distant repl --unix-socket /tmp/distant_123.sock or distant repl --pipe distant_123.

    Alternatively, using the manager id could work in conjunction with #2 by looking for available services that are distant, checking their ids, and connecting to the write one.

    enhancement 
    opened by chipsenkbeil 0
  • Support standalone mode for repl

    Support standalone mode for repl

    Currently, every cli client option requires the manager. It's still a good idea to support direct connections when desired where we can control the reconnection policy.

    e.g.

    distant client repl --standalone distant://server:8080
    

    By the nature of the repl supporting a format already, we can reuse that to support json and shell auth approaches.

    enhancement 
    opened by chipsenkbeil 0
  • Support generated config file

    Support generated config file

    Support generating a config file that is fully commented. One option is to have a static file that we pull in using the include_str! macro. The other is to have a custom rendering function that takes in a default instance of the root config struct and also writes comments.

    The former is faster to produce, but it means that we need to keep our default config impl in sync with the file. That may mean replacing default with a OnceCell of the config where we clone parts of it.

    The latter is more difficult since serde doesn't support comments. We'd need to write a custom writer into a toml_edit::Document instead of supporting serde's serialize option in order to include comments.

    enhancement 
    opened by chipsenkbeil 1
  • Add password auth as alternative to static-key

    Add password auth as alternative to static-key

    opened by chipsenkbeil 1
  • Verify timed shutdown still works

    Verify timed shutdown still works

    image

    I noticed this happen while playing around with launching on Windows. Neither is being logged, so I don't know if the shutdown timer was ever reactivated. I know that it does work, but maybe there's an edge case missed.

    bug 
    opened by chipsenkbeil 0
Releases(v0.20.0-alpha.3)
Owner
Chip Senkbeil
Chip Senkbeil
prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage.

prelate-rs is an idiomatic, asynchronous Rust wrapper around the aoe4world API. Very much a WIP at this stage. Project Status We currently support the

William Findlay 4 Dec 29, 2022
Prints the absolute path of all regular files in an unmounted btrfs filesystem image.

btrfs-walk-tut Prints the absolute path of all regular files in an unmounted btrfs filesystem image. Learning about btrfs: Btrfs Basics Series This re

Nishal Kulkarni 2 Feb 3, 2022
๐Ÿ“ฎ load, write, and copy remote and local assets

axoasset This library offers read, write, and copy functions, for local and remote assets given a string that contains a relative or absolute local pa

axo 7 Jan 25, 2023
Mobile safari / webview remote debugging and e2e testing libraries

Canter (WIP) (WIP) Mobile safari / webview remote debugging and e2e testing libraries. Developed for safari/webview e2e testing on iPhone. Works only

Han Lee 9 Aug 16, 2022
Remoc ๐Ÿฆ‘ โ€” Remote multiplexed objects and channels for Rust

Remoc ?? โ€” remote multiplexed objects and channels Remoc makes remote interaction between Rust programs seamless and smooth. Over a single underlying

ENQT GmbH 98 Dec 21, 2022
๐ŸŒฒ Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 26 Dec 17, 2022
Remote Secret Editor for AWS Secret Manager

Barberousse - Remote Secrets Editor About Usage Options Printing Editing Copying RoadMap 1.0 1.1 Future About A project aimed to avoid downloading sec

Mohamed Zenadi 18 Sep 28, 2021
Incremental, multi-version remote backup tool for block devices.

bsync Incremental, multi-version remote backup tool for block devices. The on-disk backup format is a SQLite database and I've been dogfooding this on

Heyang Zhou 7 Aug 21, 2022
M8 remote display - Rust

RM8 Remote display for the Dirtywave M8 I first tried M8WebDisplay then discovered m8c and decided to use it as a starting point for my own version in

Alex Boussinet 30 Dec 31, 2022
The system for remote workers to prevent their family members from interrupting conference calls

onair The system for remote workers to prevent their family members from interrupting conference calls. The system is designed to automatically detect

Yushi OMOTE 6 Sep 21, 2022
Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient.

Bolt โšก Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient. Quick start ??โ€??

0xHiro 6 Mar 26, 2023
Postgres proxy which allows tools that don't natively supports IAM auth to connect to AWS RDS instances.

rds-iamauth-proxy rds-proxy lets you make use of IAM-based authentication to AWS RDS instances from tools that don't natively support that method of a

Gold Fig Labs Inc. 10 Nov 7, 2022
โœจ๐ŸฅžThe magic pancakes cli currently supports one command

โœจ ?? Magic Pancakes The magic pancakes cli currently supports one command: $ pancakes generate Installing $ cargo build --release $ cargo install --pa

Kevin Rodrรญguez 3 May 6, 2022
A group of Rust projects for interacting with and producing software bill of materials (SBOMs).

sbom-rs A group of Rust projects for interacting with and producing software bill of materials (SBOMs). Examples cargo-sbom Create a SPDX SBOM for a C

Paul Sastrasinh 2 Jul 10, 2023
bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux!

bustd: Available memory or bust! bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux! Features Small memory usage! bust

Pop!_OS 8 Oct 6, 2022
Fox Ear is a Linux process behavior trace tool powered by eBPF

Fox Ear Fox Ear is a Linux process behavior trace tool powered by eBPF. Banner image by Birger Strahl on Unsplash. Features Log process and its subpro

Rui Li 77 Dec 5, 2022
Thin wrapper around [`tokio::process`] to make it streamable

This library provide ProcessExt to create your own custom process

null 4 Jun 25, 2022
Creates a DLL that runs a payload once injected into a process.

Educational purposes only Don't use this project maliciously. Prerequisites Install rust Install windows toolchain Setup Run cargo run --bin builder -

RadonCoding 3 Aug 27, 2022
A memory-based evasion technique which makes shellcode invisible from process start to end.

phantom A memory-based evasion technique which makes shellcode invisible from process start to end. Motivation ShellGhost Offensive Edition, and rust!

B1-TEAM 5 Sep 15, 2023