Fynx Proto - Network Security Protocols
Production-ready SSH and IPSec protocol implementations in Rust, designed for the Fynx security ecosystem.
๐ฏ Protocols
SSH (Secure Shell) โ Production Ready
Complete SSH protocol implementation with modern cryptography:
- SSH Transport Layer (RFC 4253): Version exchange, key exchange, packet encryption
- Key Exchange: Curve25519 (curve25519-sha256), DH Groups 14/15
- Host Keys: Ed25519, RSA, ECDSA (P-256/384/521)
- Authentication: Password, public key (Ed25519, RSA, ECDSA)
- Encryption: ChaCha20-Poly1305, AES-128/256-GCM
- Advanced: Private key loading (PEM, OpenSSH), known_hosts, authorized_keys
- Testing: 178 tests passing (100%)
IPSec/IKEv2 (IP Security) โ Production Ready
Enterprise-grade VPN protocol with comprehensive features:
- IKEv2 Protocol (RFC 7296): IKE_SA_INIT, IKE_AUTH, CREATE_CHILD_SA
- ESP Protocol (RFC 4303): Transport & Tunnel modes
- Encryption: AES-128/256-GCM, ChaCha20-Poly1305 (AEAD)
- Authentication: Pre-Shared Keys (PSK)
- Advanced: NAT-T (RFC 3948), Dead Peer Detection (DPD), SA Rekeying
- High-Level APIs: IpsecClient, IpsecServer with builder pattern
- Production: Structured logging (tracing), metrics (18 counters), error handling
- Testing: 567 tests passing + 12 benchmarks + 10 interop tests
โก Quick Start
SSH Client
Add to your Cargo.toml:
[]
= { = "0.1.0-alpha.2", = ["ssh"] }
= { = "1.35", = ["full"] }
Connect to an SSH server:
use SshClient;
async
IPSec VPN Client
Add to your Cargo.toml:
[]
= { = "0.1.0-alpha.2", = ["ipsec"] }
= { = "1.35", = ["full"] }
Create a VPN connection:
use ;
async
๐ Features
SSH Protocol Features
Core Protocol
- โ RFC 4253: SSH Transport Layer Protocol
- โ RFC 4252: Authentication Protocol
- โ RFC 4254: Connection Protocol
- โ Version exchange and algorithm negotiation
- โ Key exchange with signature verification
- โ Encrypted packet transport
Key Exchange
- โ Curve25519-SHA256 (modern, recommended)
- โ Diffie-Hellman Group 14 (2048-bit)
- โ Diffie-Hellman Group 15 (3072-bit)
Host Key Algorithms
- โ ssh-ed25519 (Ed25519 signatures)
- โ rsa-sha2-256, rsa-sha2-512 (RSA with SHA-2)
- โ ecdsa-sha2-nistp256/384/521 (ECDSA)
Authentication
- โ Password authentication (RFC 4252)
- โ Public key authentication (Ed25519, RSA, ECDSA)
- โ Private key loading (PEM, PKCS#1, PKCS#8, OpenSSH formats)
- โ Encrypted private keys (AES-128/192/256, bcrypt-pbkdf)
- โ authorized_keys file parsing
- โ known_hosts management (add, verify, update)
- โ StrictHostKeyChecking modes
Encryption (AEAD)
- โ chacha20-poly1305@openssh.com (recommended)
- โ aes128-gcm@openssh.com
- โ aes256-gcm@openssh.com
MAC Algorithms
- โ hmac-sha2-256
- โ hmac-sha2-512
IPSec Protocol Features
IKEv2 Protocol (RFC 7296)
- โ IKE_SA_INIT: Initial handshake + DH key exchange
- โ IKE_AUTH: PSK authentication + first Child SA
- โ CREATE_CHILD_SA: Rekeying and new tunnels
- โ INFORMATIONAL: DELETE notifications, DPD
ESP Protocol (RFC 4303)
- โ Transport mode (host-to-host)
- โ Tunnel mode (network-to-network VPN)
- โ Anti-replay protection (sequence numbers)
- โ Automatic rekeying before SA expiration
Encryption Algorithms
- โ AES-128-GCM (AEAD)
- โ AES-256-GCM (AEAD)
- โ ChaCha20-Poly1305 (AEAD, RFC 8750)
Key Exchange
- โ Diffie-Hellman Group 14 (2048-bit MODP)
- โ Diffie-Hellman Group 15 (3072-bit MODP)
- โ Curve25519 (ECDH)
Advanced Features
- โ NAT Traversal (NAT-T, RFC 3948)
- โ Dead Peer Detection (DPD)
- โ Traffic Selectors (subnet-based tunnels)
- โ Multiple cipher suite negotiation
- โ Cookie-based DoS protection
Production Features
- โ High-level APIs (IpsecClient, IpsecServer)
- โ Configuration builders with validation
- โ Structured logging (tracing, 20+ instrumented functions)
- โ Metrics collection (18 atomic counters)
- โ Enhanced error handling (error codes, context, retry detection)
- โ Comprehensive documentation (500+ lines user guide)
๐๏ธ Architecture
fynx-proto/
โโโ src/
โ โโโ ssh/ # SSH Protocol (178 tests)
โ โ โโโ client.rs # SSH client with host key verification
โ โ โโโ server.rs # SSH server with authentication
โ โ โโโ transport.rs # Transport layer state machine
โ โ โโโ kex.rs # Key exchange (Curve25519, DH)
โ โ โโโ hostkey.rs # Host keys (Ed25519, RSA, ECDSA)
โ โ โโโ auth.rs # Authentication (password, pubkey)
โ โ โโโ privatekey.rs # Private key loading
โ โ โโโ known_hosts.rs # known_hosts file management
โ โ โโโ authorized_keys.rs # authorized_keys parsing
โ โ โโโ crypto.rs # Cryptographic primitives
โ โ
โ โโโ ipsec/ # IPSec Protocol (567 tests)
โ โโโ client.rs # High-level IpsecClient API
โ โโโ server.rs # High-level IpsecServer API
โ โโโ config.rs # Configuration builders
โ โโโ ikev2/ # IKEv2 protocol implementation
โ โโโ esp/ # ESP protocol implementation
โ โโโ crypto/ # AEAD ciphers, key derivation
โ โโโ logging.rs # Structured logging
โ โโโ metrics.rs # Performance metrics
โ
โโโ tests/
โ โโโ ssh_integration.rs # SSH integration tests (6 tests)
โ โโโ ipsec_integration.rs # IPSec integration tests (25 tests)
โ โโโ ipsec_client_server.rs # API tests (6 tests)
โ โโโ interop_strongswan.rs # strongSwan interop (10 tests, ignored)
โ
โโโ benches/
โ โโโ ipsec_bench.rs # IPSec benchmarks (12 benchmarks)
โ
โโโ docs/
โโโ ssh/ # SSH documentation
โโโ ipsec/ # IPSec documentation
๐งช Testing
Comprehensive test coverage with 745+ tests:
# Run all tests
# SSH tests (178 passing)
# IPSec tests (567 passing)
# Run benchmarks
# With output
Test Breakdown
| Category | Tests | Status |
|---|---|---|
| SSH Unit Tests | 172 | โ 100% |
| SSH Integration | 6 | โ 100% |
| IPSec Unit Tests | 536 | โ 100% |
| IPSec Integration | 25 | โ 100% |
| IPSec API Tests | 6 | โ 100% |
| Total Library Tests | 745 | โ 100% |
| IPSec Benchmarks | 12+ | โ Running |
| Interop Tests | 10 | ๐ Framework ready |
๐ Security
Memory Safety
- Zero unsafe code: 100% safe Rust
- Zeroization: Sensitive data (keys, passwords) securely wiped
- No memory leaks: RAII and automatic cleanup
Cryptographic Security
- Modern algorithms: Curve25519, Ed25519, ChaCha20-Poly1305
- Constant-time operations: Timing attack resistant
- Strong RNG: Using
ringfor cryptographic randomness - Anti-replay protection: Sequence number validation in ESP
Protocol Security
- Host key verification: Prevent MITM attacks (SSH)
- Signature verification: Authenticate server identity (SSH, IKEv2)
- Cookie-based DoS protection: Resist resource exhaustion (IKEv2)
- Dead Peer Detection: Detect unresponsive peers (IPSec)
๐ Documentation
- API Documentation: docs.rs/fynx-proto
- SSH User Guide: docs/ssh/README.md
- IPSec User Guide: docs/ipsec/USER_GUIDE.md
- IPSec Architecture: docs/ipsec/ARCHITECTURE.md
- Examples: See
examples/directory
Examples
Run examples with:
# SSH client example
# IPSec client example
# IPSec server example (requires root/administrator for port 500)
โ๏ธ Feature Flags
[]
= ["ssh"]
# SSH protocol support (RFC 4253/4252/4254)
# - 178 tests, production-ready
# - Client, server, authentication
= []
# IPSec/IKEv2 VPN protocol (RFC 7296, RFC 4303)
# - 567 tests, production-ready
# - IKEv2 key exchange, ESP encryption
# - High-level APIs, metrics, logging
= []
# DTLS protocol (planned)
= []
# TTY password input for SSH
= ["rpassword"]
๐ Performance
Benchmarks (IPSec)
Run with: cargo bench --features ipsec --bench ipsec_bench
- IKE Handshake: Complete IKE_SA_INIT + IKE_AUTH exchange
- ESP Encryption: 64B, 512B, 1500B packet throughput
- ESP Decryption: 64B, 1500B packet throughput
- Key Derivation: IKE SA and Child SA key generation
- Serialization: Packet encoding/decoding performance
Async Runtime
- Built on Tokio for efficient async I/O
- Non-blocking operations throughout
- Supports thousands of concurrent connections
Memory Efficiency
- Zero-copy buffer operations with
bytescrate - Efficient packet parsing
- Automatic cleanup with RAII
๐ Roadmap
Completed โ
- SSH Transport Layer (RFC 4253)
- SSH Authentication (password, public key)
- SSH Connection Protocol (command execution)
- Private key loading (PEM, OpenSSH formats)
- known_hosts management
- authorized_keys parsing
- IKEv2 Protocol (RFC 7296)
- ESP Protocol (RFC 4303)
- NAT Traversal (NAT-T)
- Dead Peer Detection (DPD)
- High-level IPSec APIs
- Production hardening (logging, metrics)
Planned ๐
- SSH: Port forwarding (Local, Remote, Dynamic)
- SSH: SFTP protocol
- SSH: Session management (multiplexing, connection pool)
- SSH: ssh-agent support
- SSH: SCP support
- IPSec: X.509 certificate authentication
- IPSec: Additional cipher suites
- IPSec: MOBIKE (RFC 4555)
- DTLS: Protocol implementation
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development Setup
# Clone repository
# Build
# Run tests
# Run specific protocol tests
# Run clippy
# Format code
# Generate documentation
๐ License
Dual-licensed under MIT or Apache-2.0.
- MIT License: LICENSE-MIT
- Apache License 2.0: LICENSE-APACHE
๐ References
SSH
- RFC 4253 - SSH Transport Layer Protocol
- RFC 4252 - SSH Authentication Protocol
- RFC 4254 - SSH Connection Protocol
- RFC 8709 - Ed25519 for SSH
IPSec
- RFC 7296 - IKEv2 Protocol
- RFC 4303 - ESP Protocol
- RFC 3948 - NAT Traversal
- RFC 4106 - AES-GCM for ESP
- RFC 8750 - ChaCha20-Poly1305 for IPSec
๐ฌ Support
- Issues: GitHub Issues
- Documentation: docs.rs/fynx-proto
- Repository: github.com/Rx947getrexp/fynx
Note: This is an alpha release. While extensively tested, please conduct security audits before production deployment.