Quick Reference

Cheatsheets

Practical command references for Linux, networking, servers, containers, databases, and more.

Cheatsheet#pmg-cheatsheet

Proxmox Mail Gateway (PMG) Cheatsheet

Proxmox Mail Gateway (PMG) is an open-source email security solution that protects your mail server against spam, viruses, trojans, and phishing emails. It is deployed as an appliance (installed from ISO).

Service Management

# Main SMTP filter service
systemctl status pmg-smtp-filter       # Check status of the filtering engine
systemctl restart pmg-smtp-filter      # Restart the filter
 
# Underlying Postfix MTA
systemctl status postfix               # Check status of the mail transport
systemctl restart postfix              # Restart Postfix
 
# Web API and interface
systemctl restart pmgproxy             # Restart the web interface proxy
systemctl restart pmgdaemon            # Restart the PMG management daemon

PMG Configuration (pmgconfig)

pmgconfig dump                         # Show all current configuration values
pmgconfig sync                         # Sync config to disk and restart affected services

Network Configuration

PMG network settings are managed via /etc/network/interfaces or the web GUI. Useful CLI commands:

# Show current network interfaces
ip addr show
 
# Show routing table
ip route show
 
# Test DNS resolution
dig example.com
 
# Restart networking after changes
systemctl restart networking

Quarantine Management (pmgqm)

pmgqm status                          # Show quarantine database statistics
pmgqm purge                           # Purge old quarantined emails (based on retention policy)
pmgqm send --receiver [email protected]  # Send quarantine report to a specific user

Rule System

pmg rule list                          # List all configured filtering rules and their status

Spam and Virus Engine

# Update SpamAssassin rules
sa-update                              # Download and apply the latest spam rules
 
# Update ClamAV virus definitions
freshclam                              # Download the latest virus signatures
 
# Check ClamAV service status
systemctl status clamav-daemon
systemctl restart clamav-daemon
 
# Manually scan a file with ClamAV
clamscan /path/to/file

Log Viewing

# PMG-specific logs
pmg log view
 
# Follow the Postfix mail log in real-time
tail -f /var/log/mail.log
 
# Follow the general system log
tail -f /var/log/syslog
 
# Use journalctl for service-specific logs
journalctl -u pmg-smtp-filter -f
journalctl -u postfix -f

Backup and Restore

# Create a configuration backup (saved to /var/lib/pmg/backup/)
pmgbackup backup
 
# List existing backups
ls /var/lib/pmg/backup/
 
# Restore configuration from a specific backup file
pmgbackup restore /var/lib/pmg/backup/pmg-backup_2024-01-01.tgz

Updates

# Update PMG packages
apt update && apt full-upgrade
 
# Check current PMG version
pveversion

Cluster Management

PMG supports clustering for high availability.

# Show cluster status
pmgcm status
 
# Show cluster node info
pmgcm info