| Crates.io | sshbind |
| lib.rs | sshbind |
| version | 0.1.0 |
| created_at | 2025-03-06 14:31:25.833219+00 |
| updated_at | 2025-08-26 14:04:08.565089+00 |
| description | SSHBind is a Rust library that securely binds remote services behind multiple SSH jump hosts to a local socket, enabling seamless access with encrypted credential management, TOTP-based two-factor authentication, and automatic reconnection. |
| homepage | https://github.com/Xyhlon/SSHBind |
| repository | https://github.com/Xyhlon/SSHBind |
| max_upload_size | |
| id | 1581170 |
| size | 344,678 |
SSHBind is a Rust library that enables developers to programmatically bind services located behind multiple SSH connections to a local socket. This facilitates secure and seamless access to remote services, even those that are otherwise unreachable.
To build and use SSHBind, ensure the following dependencies are installed:
With Nix, building the project is straightforward:
nix build
Alternatively, using Cargo:
cargo build
SSHBind requires an encrypted YAML file containing the credentials for each host. This file should be encrypted using SOPS to ensure security.
Sample secrets.yaml Structure:
host:
username: your_username
password: your_password
totp_key: optional_base32_totp_key
host: The hostname or IP address of the target machine.username: The SSH username.password: The SSH password.totp_key: (Optional) The base-32 encoded key for TOTP 2FA.Ensure this file is encrypted with SOPS before use.
As a library, SSHBind exposes two primary functions:
bind: Establishes the binding of a remote service to a local socket.unbind: Removes the existing binding.Example Usage:
use sshbind::{bind, unbind};
fn main() {
let local_addr = "127.0.0.1:8000";
let jump_hosts = vec!["jump1:22".to_string(), "jump2:22".to_string()];
let remote_addr = "remote.service:80";
let sopsfile = "secrets.yaml";
// Bind the remote service to the local address
bind(local_addr, jump_hosts, remote_addr, sopsfile);
// ... use the bound service ...
// Unbind when done
unbind(local_addr);
}
For detailed API documentation and advanced usage, refer to the official documentation.
SSHBind is licensed under the MIT License. For more details, see the LICENSE file.
Dependencies of the code are subject to additional licenses as noted in the THIRD_PARTY_LICENSES folder.
Contributions are welcome! To contribute:
Please ensure your code adheres to the project's coding standards and includes appropriate tests.