8 releases
new 0.8.2 | Nov 2, 2024 |
---|---|
0.6.9 | Feb 23, 2024 |
0.6.6 | Apr 27, 2023 |
#1007 in Network programming
59KB
1.5K
SLoC
bodo_connect
- A library for mapping your hosts in the world wide web.
- A tool for connecting to any host of your map using ssh
It supports:
- Waking the host before connecting to it.
- Retry connection until ssh returns 0
- Automatic subnetwork detection for avoiding unneeded jump hosts
Installing
Install it with cargo install bodo_connect
.
Or build it simply by cloning this repo using cargo:
git clone https://github.com/topongo/bodo_connect
cd bodo_connect
cargo build --release
# execute it directly
target/release/bodoConnect
# or install it with cargo
cargo install --path .
NB
For legacy reasons, the binary for this crate is named bodoConnect
and not bodo_connect
.
Features
- cmd: (required for binary) actual binary in action
- serde: (required for binary) parse config file, json, yaml and toml are currently supported
- log: enable logging (it doesn't automatically set to level Debug, it must be manually done if the cmd feature is off)
- wake: enable waking hosts by either making a GET request or executing the
wol
command on the master host of the target network.
Command Usage
Usage: bodoConnect [OPTIONS] <HOST> [EXTRA]...
Arguments:
<HOST> Host to connect to
[EXTRA]... Extra argument(s), if no -S or -R is used, it will be passed to the remote machine as command
Options:
--networkmap <NETWORKMAP> Select different networkmap.json file
-w, --wake Wake host before connecting
-t, --tty Pass -t parameter to ssh (force tty allocation)
-d... Set verbosity level
-q, --quiet Don't log anything
-n, --dry Send to stdout the generated command without executing it
-R, --rsync [WIP] Creates rsync commands
-S, --sshfs [WIP] Creates sshfs commands
-l, --loop Retry connection until ssh returns 0
-h, --help Print help
-V, --version Print version
Networkmap
A little clarification on how a networkmap is structured:
NetworkMap
: a list ofSubnets
Subnet
:- An physical/abstract local network. It is identified by its
subdomain
and it contains a list ofhosts
(and optionally by a static external ip address,eip
).
- An physical/abstract local network. It is identified by its
Host
:- Identified by its
name
, that must be unique in the whole network map, it must contain:- An
ip
address - A
port
- A
user
- An
- It can contain also an
eport
.- If set, the host becomes the subnet
master
, so it is considered to be always powered on and exposed for incoming ssh connection from foreign hosts - There can only be one master host per subnet
- If set, the host becomes the subnet
- Identified by its
Waker
: an optional structure that defines how a host can be wakened. It supports:- http(s):
- GET method
POST method(coming soon)
- wol (wake on lan)
- http(s):
Example of a newtorkmap
Dependencies
~7–22MB
~273K SLoC