Pipeline is a secure local channel protocol implementation designed for AWS Nitro Enclaves communication. It provides a secure, encrypted communication channel between an enclave and its parent EC2 instance using VSOCK (Virtual Socket) protocol with cryptographic security.
Pipeline implements a client-server architecture for secure communication:
- Server Mode (
listen): Runs inside the enclave, listening for incoming connections - Client Mode (
run): Executes commands remotely via the secure channel - File Transfer: Secure file send/receive operations between host and enclave
- Directory Transfer: Recursive directory send/receive operations with full directory structure preservation
- VSOCK Communication: Uses AF_VSOCK sockets for enclave-to-host communication
- Cryptography: Implements secure channel encryption (likely using the
cryptographysubmodule) - Configuration: TOML-based configuration for flexible deployment
- CLI Interface: Command-line interface for all operations
- Rust 1.91.0 or later
- AWS Nitro Enclaves SDK (for enclave deployment)
- Access to an EC2 instance with Nitro Enclave support
# Clone the repository
cd pipeline
# Build the project
cargo build --release
# The binary will be available at:
# target/release/pipelinePipeline requires a configuration file in TOML format. By default, it looks for:
./.config/pipeline.config.toml
You can specify a custom config path using the --config flag.
Create a configuration file at .config/pipeline.config.toml:
# Default VSOCK Context Identifier
# This is the CID of the enclave
cid = 3
# Default VSOCK port number
# Must match the port used by 'pipeline listen'
port = 5000
# The future configuration may include:
# - VSOCK connection parameters
# - Encryption settings
# - Timeout values
# - Buffer sizespipeline [OPTIONS] <SUBCOMMAND>--config <PATH>: Specify custom configuration file path (default:./.config/pipeline.config.toml)
Starts the Pipeline server, typically inside the enclave:
pipeline listen [OPTIONS]This mode:
- Opens a VSOCK listener
- Accepts incoming connections from the host
- Processes commands and file transfers
- Maintains the secure channel
Use case: Run this inside your Nitro Enclave to accept connections from the parent EC2 instance.
Executes a command on the remote Pipeline server:
pipeline run [OPTIONS] -- <COMMAND> [ARGS...]This mode:
- Connects to the Pipeline server
- Sends the command for execution
- Returns the exit code of the remote command
Example:
# Execute a command inside the enclave (with output to local console)
pipeline run -- /usr/bin/my-secure-app --flag value
# Execute a command inside the enclave, without command output waiting (with output to enclave's debug console, when enclave is running in debug mode)
pipeline run --no-wait -- /usr/bin/my-secure-app --flag value
# The exit code will match the remote command's exit code
echo $?Securely sends a file to the remote endpoint:
pipeline send-file [OPTIONS] <SOURCE> <DESTINATION>Example:
# Send a file to the enclave
pipeline send-file ./local-file.txt /enclave/path/file.txtSecurely receives a file from the remote endpoint:
pipeline recv-file [OPTIONS] <SOURCE> <DESTINATION>Example:
# Receive a file from the enclave
pipeline recv-file /enclave/path/output.txt ./local-output.txtRecursively sends an entire directory structure to the remote endpoint:
pipeline send-dir [OPTIONS] --localdir <LOCAL_DIR> --remotedir <REMOTE_DIR>This mode:
- Recursively traverses the local directory
- Preserves the directory structure
- Transfers all files maintaining their relative paths
- Creates necessary subdirectories in the enclave automatically
Example:
# Send an entire directory to the enclave
pipeline send-dir --cid 3 --port 5000 --localdir ./my-app --remotedir /enclave/app
# Send model files and configurations
pipeline send-dir --cid 3 --port 5000 --localdir ./models --remotedir /enclave/modelsRecursively receives an entire directory structure from the remote endpoint:
pipeline recv-dir [OPTIONS] --localdir <LOCAL_DIR> --remotedir <REMOTE_DIR>This mode:
- Recursively traverses the remote directory in the enclave
- Preserves the directory structure
- Transfers all files maintaining their relative paths
- Creates necessary subdirectories locally automatically
Example:
# Receive an entire directory from the enclave
pipeline recv-dir --cid 3 --port 5000 --localdir ./results --remotedir /enclave/output
# Retrieve processed data with full directory structure
pipeline recv-dir --cid 3 --port 5000 --localdir ./downloaded-data --remotedir /enclave/data- Inside the Enclave (Server):
# Start the Pipeline server
pipeline listen- On the Host EC2 Instance (Client):
# Execute a command inside the enclave
pipeline run -- /app/process-data --input data.json
# Send a file into the enclave
pipeline send-file ./sensitive-data.bin /enclave/input/data.bin
# Send an entire directory into the enclave
pipeline send-dir --cid 3 --port 5000 --localdir ./app-bundle --remotedir /enclave/app
# Receive processed results
pipeline recv-file /enclave/output/results.bin ./results.bin
# Receive an entire output directory from the enclave
pipeline recv-dir --cid 3 --port 5000 --localdir ./output-bundle --remotedir /enclave/output# Deploy an entire application with all its dependencies
pipeline send-dir --cid 3 --port 5000 --localdir ./my-application --remotedir /app
# The directory structure is preserved:
# ./my-application/
# ├── bin/
# │ └── app
# ├── config/
# │ └── settings.toml
# └── data/
# └── initial-data.json
#
# Becomes in enclave:
# /app/
# ├── bin/
# │ └── app
# ├── config/
# │ └── settings.toml
# └── data/
# └── initial-data.json# Retrieve all log files from the enclave
pipeline recv-dir --cid 3 --port 5000 --localdir ./collected-logs --remotedir /var/log/myapp
# Retrieve computation results with full structure
pipeline recv-dir --cid 3 --port 5000 --localdir ./results --remotedir /enclave/output/experiment-001# Send model weights and configuration
pipeline send-dir --cid 3 --port 5000 --localdir ./ml-models --remotedir /enclave/models
# Structure preserved:
# ./ml-models/
# ├── model-v1/
# │ ├── weights.bin
# │ ├── config.json
# │ └── tokenizer/
# │ └── vocab.txt
# └── model-v2/
# ├── weights.bin
# └── config.json- Encrypted Channel: All communications are encrypted using the cryptography module
- Isolated Execution: Runs within AWS Nitro Enclave's trusted execution environment
- VSOCK Transport: Uses VSOCK for secure, isolated network communication
- Configuration Validation: Validates configuration before establishing connections
- Directory Integrity: Directory transfers maintain complete structure integrity
pipeline/
├── src/
│ ├── main.rs # Entry point and CLI handler
│ ├── lib.rs # Core library functions (listen, run, send_file, recv_file, send_dir, recv_dir)
│ ├── cli.rs # CLI app builder
│ ├── cli_parser.rs # Argument parsing structures
│ ├── config.rs # Configuration management
│ ├── vsock.rs # VSOCK socket implementation
│ └── cats.rs # ASCII art and easter eggs
├── cryptography/ # Cryptographic implementations
├── .config/ # Default configuration directory
└── Cargo.toml # Project dependencies
Key dependencies include:
clap(4.5.45) - Command-line argument parsingtokio(1.47.1) - Async runtimeserde(1.0.219) - Serialization/deserializationtoml(0.8.23) - Configuration file parsingnix(0.26.4) - Unix system calls (for VSOCK)- Various crypto libraries for secure communication
- Configuration file errors: Ensure
.config/pipeline.config.tomlexists and is valid - Connection errors: Verify VSOCK connectivity between host and enclave
- Permission errors: Ensure proper permissions for file operations
- Directory errors: Verify source directory exists and destination is writable
cargo testWhen building for deployment inside a Nitro Enclave, ensure you're targeting the appropriate architecture and linking requirements.
Pipeline includes some friendly ASCII art cats:
pipeline --"=(^\">,.•.,<\"^)=" # Meet George
pipeline --"=(^\",..,\"^)=" # Meet Pascal- "Missing configuration file" error: Create
.config/pipeline.config.tomlor specify a valid config path - Connection refused: Ensure the Pipeline server is running in listen mode
- VSOCK errors: Verify Nitro Enclave is properly configured and VSOCK support is enabled
- "Directory does not exist" error: Verify the source directory path is correct
- "Remote directory is empty or does not exist" error: Verify the remote path exists in the enclave
This project is licensed under the Apache 2.0 License. See the LICENSE-APACHE file for the details.
This project appears to be part of a larger Secure Enclaves Framework. Check the LICENSE-APACHE file in the repository root as well for licensing information.
Pipeline is part of the Secure Enclaves Framework that includes:
pf-proxy- Port forwarding proxyra-web-srv- Remote attestation web servicefs-monitor- Filesystem monitoring
# 1. Create configuration
mkdir -vp .config
cat > .config/pipeline.config.toml << EOF
cid = 3
port = 5000
EOF
# 2. In your enclave, start the server
pipeline listen
# 3. From the host, interact with the enclave
pipeline run -- echo "Hello from enclave"
# Single file operations
pipeline send-file data.txt /enclave/data.txt
pipeline recv-file /enclave/result.txt result.txt
# Directory operations (new!)
pipeline send-dir --cid 3 --port 5000 --localdir ./my-app --remotedir /enclave/app
pipeline recv-dir --cid 3 --port 5000 --localdir ./output --remotedir /enclave/results