πŸ”’Security & Encryption

ProxmoxMCP now supports secure encryption of API tokens and other sensitive configuration values at rest.

Features

  • Fernet Encryption: Industry-standard AES 128 in CBC mode with HMAC SHA256 authentication

  • Secure Key Derivation: PBKDF2 with salt to prevent rainbow table attacks

  • Environment-based Keys: Master keys stored separately from encrypted data

  • Backward Compatibility: Existing plain-text configurations continue to work

  • CLI Tools: Easy-to-use command-line utilities for encryption management

Quick Start

1. Generate a Master Key

# Generate a new master key securely
python -m proxmox_mcp.utils.encrypt_config --generate-key

# Follow the prompts to securely save the generated key
# Then set it as an environment variable:
export PROXMOX_MCP_MASTER_KEY="your-generated-key"

Security Note: The key generation process now includes enhanced security measures that prevent the key from being exposed in terminal history or log files during automatic generation.

2. Encrypt Your Configuration

3. Use Encrypted Configuration

CLI Reference

Encrypt Configuration File

Check Encryption Status

Generate Master Key

Master Key Rotation

ProxmoxMCP supports secure master key rotation for enhanced security compliance and incident response.

Rotate Key for Single Configuration

Rotate Key for All Configurations

Key Rotation Best Practices

  1. Schedule Regular Rotations: Rotate master keys annually or after security incidents

  2. Test Before Production: Always test rotated configurations before deploying

  3. Coordinate Updates: Ensure all systems using the configuration are updated with the new key

  4. Secure Backup Storage: Store configuration backups securely and separately from the new key

  5. Monitor Rotation: Keep audit logs of key rotation activities

Configuration Format

Before Encryption

After Encryption

Environment Variables

Variable
Description
Required

PROXMOX_MCP_MASTER_KEY

Master encryption key

Yes (for encrypted configs)

PROXMOX_MCP_CONFIG

Path to config file

Yes

Security Best Practices

  1. Store Keys Separately: Never store the master key in the same location as encrypted data

  2. Use Environment Variables: Avoid hardcoding keys in scripts or configuration files

  3. Rotate Keys Regularly: Generate new master keys periodically and re-encrypt configurations

  4. Secure Key Storage: Use secure key management systems in production environments

  5. Backup Safely: Ensure encrypted backups include both data and key recovery procedures

  6. Clear Terminal History: After key generation, consider clearing terminal history to prevent exposure

  7. Use CLI Tool: Always use the provided CLI tool for key generation rather than manual methods

  8. Test After Rotation: Always verify configurations work after key rotation before production use

  9. Coordinate Key Updates: Ensure all systems are updated with new keys during rotation

  10. Audit Key Operations: Maintain logs of key generation, rotation, and usage activities

Migration from Plain Text

Existing configurations work without changes. To migrate:

  1. Backup Current Config: Always backup your working configuration

  2. Generate Master Key: Create and securely store a master key

  3. Encrypt Configuration: Use the CLI tool to encrypt sensitive values

  4. Update Environment: Set the master key environment variable

  5. Test Thoroughly: Verify the server starts and connects successfully

  6. Clean Up: Securely delete plain text configuration files

Troubleshooting

Common Issues

"Token decryption failed"

  • Verify PROXMOX_MCP_MASTER_KEY environment variable is set correctly

  • Ensure the master key matches the one used for encryption

"Config file not found"

  • Check PROXMOX_MCP_CONFIG environment variable points to correct file

  • Verify file permissions and path accessibility

"Invalid encrypted token format"

  • Encrypted tokens must start with enc: prefix

  • Verify file wasn't corrupted during transfer or storage

Debug Mode

Enable debug logging to troubleshoot encryption issues:

Key Rotation Procedures

Key rotation is essential for maintaining long-term security. ProxmoxMCP provides comprehensive tools and procedures for safely rotating encryption keys.

When to Rotate Keys

  • Regular Schedule: Annually or as per your organization's security policy

  • Security Incidents: When compromise is suspected or confirmed

  • Personnel Changes: After team member departures or role changes

  • Major Deployments: Before critical releases or infrastructure changes

  • Compliance Requirements: As mandated by security frameworks (SOC2, ISO27001, etc.)

Pre-Rotation Checklist

Before starting key rotation, ensure you have:

  1. Current Access: Ability to decrypt existing configurations

  2. Backup Strategy: Secure backup procedures for configuration files

  3. Testing Environment: Non-production environment for validation

  4. Downtime Window: Planned maintenance window for service restarts

  5. Rollback Plan: Procedures to revert if rotation fails

  6. Team Coordination: All team members aware of the rotation schedule

Step-by-Step Rotation Procedure

1. Preparation Phase

2. Single Configuration Rotation

3. Bulk Configuration Rotation

4. Environment Update

5. Validation Phase

Zero-Downtime Rotation Strategies

Blue-Green Deployment

  1. Prepare Green Environment: Deploy with new keys

  2. Validate Green: Test all functionality

  3. Switch Traffic: Update load balancer/proxy

  4. Monitor: Ensure no errors

  5. Cleanup Blue: Remove old environment after validation

Rolling Update

  1. Rotate Keys: Generate new keys for configuration

  2. Update Environment: Set new master key

  3. Restart Service: Restart with new configuration

  4. Validate: Confirm service operational

  5. Update Monitoring: Ensure alerts still function

Rollback Procedures

If key rotation fails, follow these steps:

Immediate Rollback

Post-Rollback Analysis

  1. Document Issue: Record what went wrong

  2. Preserve Evidence: Keep failed configuration for analysis

  3. Review Logs: Check server and application logs

  4. Plan Fix: Address root cause before retry

  5. Schedule Retry: Plan next rotation attempt

Advanced Key Management

Multi-Environment Key Management

Development Environment

Staging Environment

Production Environment

Key Management Lifecycle

Key Generation

  • Use CLI Tool: Always use the provided encryption utility

  • Secure Generation: Use cryptographically secure random generation

  • Document Creation: Log key generation events (not the keys themselves)

  • Immediate Storage: Store keys in secure key management systems

Key Storage

  • Separate Storage: Never store keys with encrypted data

  • Access Control: Implement strict access controls

  • Encryption at Rest: Encrypt keys in storage systems

  • Backup Keys: Maintain secure, encrypted backups

Key Distribution

  • Secure Channels: Use encrypted communication for key distribution

  • Just-in-Time: Provide keys only when needed

  • Audit Trail: Log key access and distribution

  • Temporary Access: Use short-lived keys where possible

Key Retirement

  • Secure Deletion: Use cryptographic erasure techniques

  • Audit Cleanup: Remove keys from all systems

  • Documentation: Update key management records

  • Compliance: Follow data retention policies

Disaster Recovery Scenarios

Lost Master Key

If you lose access to your master key:

  1. Check Backups: Look for securely stored key backups

  2. Emergency Access: Use disaster recovery key procedures

  3. Re-encrypt Data: Use available plain-text configurations to re-encrypt

  4. Update Systems: Deploy new configurations with new keys

  5. Post-Incident: Review and improve key backup procedures

Corrupted Configuration

If configuration files become corrupted:

  1. Stop Service: Prevent further issues

  2. Restore Backup: Use most recent valid backup

  3. Validate Restoration: Test with current master key

  4. Resume Service: Restart with restored configuration

  5. Investigate: Determine corruption cause

Compromised Keys

If key compromise is suspected:

  1. Immediate Rotation: Start emergency key rotation

  2. Revoke Access: Disable compromised keys

  3. Audit Usage: Review key usage logs

  4. Notify Stakeholders: Inform relevant parties

  5. Update Procedures: Strengthen key protection

Troubleshooting Key Rotation

Common Rotation Issues

"Current master key cannot decrypt configuration"

Symptoms: Rotation fails during verification phase

Causes:

  • Wrong PROXMOX_MCP_MASTER_KEY environment variable

  • Configuration file corrupted

  • Key truncated or modified

Solutions:

"Failed to create backup"

Symptoms: Backup creation fails during rotation

Causes:

  • Insufficient disk space

  • Permission issues

  • File system errors

Solutions:

"Service fails to start with new key"

Symptoms: Server won't start after key rotation

Causes:

  • Environment variable not updated

  • Configuration cache issues

  • Service configuration problems

Solutions:

Debug Mode for Rotation

Enable detailed logging during rotation:

Validation Procedures After Rotation

Basic Connectivity Test

Full Integration Test

CI/CD Integration

GitHub Actions

GitLab CI

Automated Monitoring

Integration Examples

Docker Compose

Docker Swarm with Secrets

Kubernetes

Systemd Service

Environment file (/etc/proxmox-mcp/environment):

For more information, see the main README.md or security documentation.

Last updated

Was this helpful?