### Install cargo-fuzz Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/fuzz/README.md Installs the cargo-fuzz tool, which is required for setting up and running fuzzing targets. ```sh cargo install --locked cargo-fuzz ``` -------------------------------- ### Custom SSH Agent Implementation Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/README.md Demonstrates how to implement a custom SSH agent by defining a struct that derives `Session` and handles `request_identities` and `sign` methods. It shows how to set up a listener for Unix domain sockets or named pipes and start the agent. ```rust use tokio::net::UnixListener as Listener; use ssh_agent_lib::error::AgentError; use ssh_agent_lib::agent::{Session, listen}; use ssh_agent_lib::proto::{Identity, SignRequest}; use ssh_key::{Algorithm, Signature}; #[derive(Default, Clone)] struct MyAgent; #[ssh_agent_lib::async_trait] impl Session for MyAgent { async fn request_identities(&mut self) -> Result, AgentError> { Ok(vec![ /* public keys that this agent knows of */ ]) } async fn sign(&mut self, request: SignRequest) -> Result { // get the signature by signing `request.data` let signature = vec![]; Ok(Signature::new( Algorithm::new("algorithm").map_err(AgentError::other)?, signature, ).map_err(AgentError::other)?) } } #[tokio::main] async fn main() -> Result<(), Box> { #[cfg(not(windows))] let socket = "ssh-agent.sock"; #[cfg(windows)] let socket = r"\\.\pipe\agent"; let _ = std::fs::remove_file(socket); // remove the socket if exists listen(Listener::bind(socket)?, MyAgent::default()).await?; Ok(()) } ``` -------------------------------- ### Sign Off Multiple Commits with Rebase Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/CONTRIBUTING.md Applies the 'Signed-off-by' line to a series of commits starting from the current branch's divergence point with 'main'. ```git git rebase --signoff main ``` -------------------------------- ### Connecting to an SSH Agent (Client) Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/README.md Shows how to connect to an existing SSH agent using the `ssh-agent-lib` client. It demonstrates how to establish a connection via a file path (Unix) or a named pipe (Windows) and retrieve the identities known by the agent. ```rust use service_binding::Binding; use ssh_agent_lib::client::connect; #[tokio::main] async fn main() -> Result<(), Box> { #[cfg(unix)] let mut client = connect(Binding::FilePath(std::env::var("SSH_AUTH_SOCK")?).try_into()?) #[cfg(windows)] let mut client = connect(Binding::NamedPipe(std::env::var("SSH_AUTH_SOCK")?).try_into()?) eprintln!( "Identities that this agent knows of: {:#?}", client.request_identities().await? ); Ok(()) } ``` -------------------------------- ### Set Git Hooks Path Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/CONTRIBUTING.md Configures Git to use the project's custom hooks for pre-commit checks. ```sh git config core.hooksPath scripts/hooks/ ``` -------------------------------- ### Run Fuzzing Target Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/fuzz/README.md Executes a specific fuzzing target, such as 'message_decode'. This command requires a nightly version of the Rust toolchain. ```sh cargo +nightly fuzz run message_decode ``` -------------------------------- ### Fuzzing Options Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/fuzz/README.md Provides options to modify the behavior of the `cargo fuzz run` command, including increasing parallelism and disabling sanitizers. ```sh # Increase parallelism --jobs N # Disable sanitizer (ssh-agent-lib does not use unsafe blocks) --sanitizer none ``` -------------------------------- ### SSH Agent Usage via Environment Variable Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/README.md Illustrates how to configure an OpenSSH client to use a custom SSH agent by setting the `SSH_AUTH_SOCK` environment variable. This allows transparent use of the custom agent for SSH connections. ```sh SSH_AUTH_SOCK=ssh-agent.sock ssh user@example.com ``` ```sh SSH_AUTH_SOCK=\\.\pipe\agent ssh user@example.com ``` -------------------------------- ### Sign Commit Automatically Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/CONTRIBUTING.md Appends a 'Signed-off-by' line to the commit message using Git's built-in functionality. ```git git commit --signoff ``` -------------------------------- ### Amend Last Commit with Signoff Source: https://github.com/wiktor-k/ssh-agent-lib/blob/main/CONTRIBUTING.md Adds a 'Signed-off-by' line to the most recent commit. ```git git commit --amend --signoff ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.