# Create .env file (automatically ignored by git)
cp .env.example .env
# Edit .env with your actual credentialsexport CAMERA_IP="192.168.1.100"
export CAMERA_USERNAME="admin"
export CAMERA_PASSWORD="your_secure_password"./scripts/deploy-setup.sh # Prompts for credentials securely- β Hardcoding credentials in source code
- β Committing real passwords to git
- β Using default passwords in production
- β Storing credentials in plain text config files that are committed
The system uses secure fallback priorities:
- Environment variables (highest priority)
- Config file values (medium priority)
- Interactive prompts (fallback)
- Default values (lowest priority)
- β
.envfiles are automatically ignored by git - β Config files with credentials are gitignored
- β Password prompts are masked
- β Environment variable substitution in config files
- β Secure file permissions (600) for credential files
# Method 1: Use .env file
cp .env.example .env
# Edit .env with test credentials
python3 scripts/camera-test.py
# Method 2: Export variables
export CAMERA_IP="192.168.1.100"
export CAMERA_PASSWORD="test123"
python3 scripts/camera-test.py# Method 1: Interactive setup
./scripts/deploy-setup.sh
# Method 2: Non-interactive with environment variables
export CAMERA_IP="10.0.1.50"
export CAMERA_PASSWORD="SecurePassword123!"
./scripts/deploy-setup.sh --non-interactive
# Method 3: Systemd environment files
sudo systemctl edit sai-cam
# Add environment variables to service# Use secrets management
export CAMERA_IP="$CI_CAMERA_IP"
export CAMERA_PASSWORD="$CI_CAMERA_PASSWORD"
./scripts/install.sh# config.yaml - Safe to commit
cameras:
- id: 'cam1'
type: 'onvif'
address: '${CAMERA_IP}' # Environment variable
username: '${CAMERA_USERNAME}' # Environment variable
password: '${CAMERA_PASSWORD}' # Environment variable
port: 8000
- id: 'cam2'
type: 'rtsp'
rtsp_url: '${RTSP_URL}' # Full URL in environment# .env - Never committed to git
CAMERA_IP=192.168.1.100
CAMERA_USERNAME=admin
CAMERA_PASSWORD=SecurePassword123!
RTSP_URL=rtsp://admin:SecurePassword123!@192.168.1.101:554/stream- No hardcoded IP addresses from your network
- No real passwords in any files
- All examples use placeholder values
- .env files are in .gitignore
- Test with example values to ensure they don't work
- Set all required environment variables
- Use strong, unique passwords
- Secure file permissions on credential files
- Test credential loading from environment
- Verify no credentials in logs
- Change all default passwords
- Use HTTPS for server communications
- Implement certificate validation
- Regular credential rotation
- Monitor for credential exposure
- Use network isolation where possible
# β Wrong
CAMERA_PASSWORD="RealPassword123!" # Real password in git
# β
Correct
CAMERA_PASSWORD="${CAMERA_PASSWORD:-your_password_here}" # Environment variable# β Wrong
password: admin123 # Default password
# β
Correct
password: "${CAMERA_PASSWORD}" # Secure environment variable# β Wrong
logger.info(f"Connecting with password: {password}")
# β
Correct
logger.info("Connecting to camera (credentials configured)")- Immediately change all exposed passwords
- Review git history for credential commits
- Rotate authentication tokens
- Update all deployed systems
- Consider credential management system
For security issues or questions:
- Review this guide first
- Check environment variable configuration
- Test with placeholder values
- Verify .gitignore is working
Remember: Security is everyone's responsibility!