Skip to content

Security: Fastcomcorp/Plexius-TSIG

docs/SECURITY.md

Security Guide for Plexius TSIG

Version: Plexius TSIG v0.6.0
License: See LICENSE for copyright and license information.


Overview

This document outlines security best practices, considerations, and recommendations for using the Plexius TSIG library in production environments.


πŸ” Key Security Features

  • Algorithm Support

    • βœ… HMAC-SHA256 (Recommended)
    • βœ… HMAC-SHA384
    • βœ… HMAC-SHA512
  • Message Security

    • βœ… Message integrity verification
    • βœ… Timestamp validation
    • βœ… Replay attack prevention
    • βœ… Signature verification
  • Memory Protection

    • βœ… Secure memory handling (zeroize)
    • βœ… Zero-copy message operations
    • βœ… Thread-safe memory access
    • βœ… Protected memory regions
    • βœ… Memory leak prevention
    • βœ… Automatic key zeroization

βœ… Best Practices

πŸ”‘ Key Management

1. Key Generation

use plexius_tsig::key::TsigKey;

// Generate a secure key
let mut key = TsigKey::new(
    "secure-key-name",
    "HMAC-SHA256",
    &base64_encoded_secret
)?;

// Enable test mode for testing
key.enable_test_mode();

2. Key Rotation

  • Rotate keys every 90 days.
  • Use basic key rotation support.
  • Monitor key usage.
  • ⚠️ Test mode must be enabled for key rotation testing.
let mut key = TsigKey::new("key", "HMAC-SHA256", "secret")?;
key.enable_test_mode(); // Required for testing key rotation

3. Key Storage

  • Use a secure key management system (KMS).
  • Avoid hardcoded keys β€” prefer environment variables or configuration tools.
  • Restrict access to key storage locations.

βœ‰οΈ Message Security

Timestamp Validation

let message = TsigMessage::new()
    .with_fudge(300); // 5 minutes

Signature Verification

let mut key = TsigKey::new("key", "HMAC-SHA256", "secret")?;
key.enable_test_mode(); // Required for testing

if !message.verify(&key)? {
    return Err(TsigError::InvalidSignature);
}

🧠 Memory Protection

Secure Memory Handling

let mut key = TsigKey::new("key-name", "HMAC-SHA256", "secret")?;
// Automatically zeroized on drop

Zero-Copy Operations

let message = TsigMessage::new();
// Message content handled without unnecessary copies

Thread-Safe Access

let manager = TsigManager::new();
// Keys protected during concurrent access

Memory Safety Considerations

  • Use built-in memory protections.
  • Avoid manual memory management.
  • Rely on library for sensitive data cleanup.
  • Monitor for memory leaks in production.

Protected Memory Regions

  • Cryptographic keys
  • Message signatures
  • Configuration data
  • Audit logs
  • Security tokens

⚠️ Security Considerations

Algorithm Selection

  • Use HMAC-SHA256 for general use.
  • Use HMAC-SHA384/512 for higher-security applications.
  • Tradeoff: SHA384/512 is more secure but may reduce performance.

Common Vulnerabilities

Replay Attacks

  • Always validate timestamps.
  • Use proper fudge factor (e.g., 300s).
  • Enable replay detection in production.
  • ⚠️ Test mode disables replay protection.

Key Compromise

  • Monitor key usage and logs.
  • Rotate keys periodically.
  • Use secure, isolated storage.

Message Tampering

  • Verify message integrity.
  • Check digital signatures.
  • Validate message structure and source.

πŸ›  Security Configuration

Recommended Settings

use plexius_tsig::config::SecurityConfig;

let config = SecurityConfig::new()
    .with_key_size_limits(32, 64)
    .with_timestamp_fudge(300)
    .with_algorithm("HMAC-SHA256")
    .with_key_rotation_days(90)
    .with_test_mode(true); // Enable test mode globally

Enable Security Logging

let config = SecurityConfig::new()
    .with_security_logging(true)
    .with_log_level("info")
    .with_test_mode(true);

🚨 Incident Response

If a Key is Compromised

  • Rotate the key immediately.
  • Audit affected logs and systems.
  • Update system configurations and policies.

If Messages Are Tampered

  • Investigate message origin and network path.
  • Validate logging and alerting configurations.
  • Apply configuration changes if needed.

🧾 Compliance

Plexius TSIG supports:


πŸ“’ Security Policy

Reporting a Vulnerability

If you discover a vulnerability, please report it responsibly:

Include:

  • Clear vulnerability description
  • Steps to reproduce
  • Potential impact and mitigation (if any)

We will:

  • Acknowledge within 2 business days
  • Respond with mitigation plan within 7 business days

CVE Assignment

For confirmed and patched vulnerabilities, CVE IDs will be requested through GitHub's CNA process.


Security Audits

We welcome third-party audits. If interested, email us at security@fastcomcorp.com.


Coordinated Disclosure

We follow a coordinated disclosure policy. Security issues will be disclosed publicly after a patch has been made available and users have been notified.


πŸ”” Security Updates

  • Subscribe to release announcements
  • Review release notes for patches
  • Test updates in staging environments
  • Apply patches as soon as possible

πŸ“š Additional Resources

There aren't any published security advisories