Skip to content

CLI Commands Reference

Complete reference of Mailborder command-line utilities.

System Management

mb-status

Check status of all Mailborder services.

sudo mb-status

Output:

Mailborder V6 System Status
============================

Services:
  mb-rpcd       [RUNNING]  PID 1234
  mb-milter     [RUNNING]  PID 1235
  mb-filter     [RUNNING]  PID 1237
  mb-virtuoso   [RUNNING]  PID 1238

Dependencies:
  MariaDB       [RUNNING]  PID 987
  Redis         [RUNNING]  PID 988
  Postfix       [RUNNING]  PID 989

System Health: GOOD

Options: - --json - Output in JSON format - --verbose - Detailed information

mb-config

Manage system configuration.

Get Configuration:

# Show all config
sudo mb-config show

# Show specific section
sudo mb-config show spam
sudo mb-config show email

# Get specific value
sudo mb-config get spam.threshold.pass

Set Configuration:

sudo mb-config set spam.threshold.pass 6.0
sudo mb-config set email.max_message_size 52428800

Verify Configuration:

sudo mb-config --verify

Reload Configuration:

sudo mb-config reload

mb-setup

Initial system setup (run once after installation).

sudo mb-setup

Options: - --offline - Offline mode (no Internet checks) - --force - Force re-setup

mb-update

Update virus/spam signatures and software.

# Update everything
sudo mb-update

# Update only antivirus signatures
sudo mb-update --antivirus

# Update only spam signatures
sudo mb-update --spam

# Check for software updates
sudo mb-update --check

mb-doctor

System health check and diagnostics.

sudo mb-doctor

Checks: - Service status - Database connectivity - Disk space - Memory usage - Configuration validity - Log permissions

Output:

[OK] All services running
[OK] Database connected
[WARNING] Disk space at 82%
[OK] Memory usage normal
[OK] Configuration valid

User Management

mb-admin-list

List administrator accounts.

sudo mb-admin-list

Options: - --locked - Show only locked accounts - --disabled - Show only disabled accounts

mb-admin-create

Create new administrator account.

sudo mb-admin-create --email admin@example.com --name "John Doe"

Options: - --email - Email address (required) - --name - Full name - --password - Password (prompted if not provided) - --priv - Privilege level (1-10)

mb-admin-reset

Reset administrator password.

sudo mb-admin-reset --email admin@example.com

mb-admin-disable / mb-admin-enable

Disable or enable user account.

sudo mb-admin-disable --email user@example.com
sudo mb-admin-enable --email user@example.com

mb-admin-unlock

Unlock locked user account.

sudo mb-admin-unlock --email user@example.com

mb-admin-delete

Delete user account.

sudo mb-admin-delete --email user@example.com

Caution: Permanent deletion!

Authentication

mb-2fa-enable

Enable 2FA for user.

sudo mb-2fa-enable --email admin@example.com

Output: - QR code - Secret key - Backup codes

mb-2fa-disable

Disable 2FA for user.

sudo mb-2fa-disable --email admin@example.com

mb-2fa-verify

Verify TOTP code.

sudo mb-2fa-verify --email admin@example.com --code 123456

mb-2fa-backup-codes

Generate backup codes.

sudo mb-2fa-backup-codes --email admin@example.com

mb-passkey-list

List user's passkeys.

sudo mb-passkey-list --email admin@example.com

mb-passkey-remove

Remove passkey.

sudo mb-passkey-remove --email admin@example.com --credential-id abc123

Email Management

mb-domain

Manage accepted domains.

List domains:

sudo mb-domain list

Add domain:

sudo mb-domain add example.com --type local

Remove domain:

sudo mb-domain remove example.com

mb-whitelist / mb-blacklist

Manage whitelists and blacklists.

Add to whitelist:

sudo mb-whitelist add sender@example.com
sudo mb-whitelist add @example.com
sudo mb-whitelist add 203.0.113.10

Add to blacklist:

sudo mb-blacklist add spammer@spam.com
sudo mb-blacklist add @spam-domain.com

List:

sudo mb-whitelist list
sudo mb-blacklist list

Remove:

sudo mb-whitelist remove sender@example.com
sudo mb-blacklist remove spammer@spam.com

mb-quarantine-list

List quarantined emails.

sudo mb-quarantine-list

Options: - --since "2025-01-01" - Date filter - --sender sender@example.com - Filter by sender - --recipient user@example.com - Filter by recipient - --limit 50 - Limit results

mb-quarantine-release

Release quarantined email.

sudo mb-quarantine-release <message-id>

mb-quarantine-delete

Delete quarantined email.

sudo mb-quarantine-delete <message-id>

mb-quarantine-extract

Extract quarantined email to file.

sudo mb-quarantine-extract <message-id> /tmp/email.eml

Spam Management

mb-rspamd-learn

Train Bayesian filter.

Learn spam:

sudo mb-rspamd-learn --spam /path/to/spam-samples/

Learn ham:

sudo mb-rspamd-learn --ham /path/to/ham-samples/

Reset and retrain:

sudo mb-rspamd-learn --reset

mb-spam-test

Test spam scoring.

sudo mb-spam-test /path/to/email.eml

mb-spam-keyword

Manage spam keywords.

Add keyword:

sudo mb-spam-keyword add "V1AGRA" --score 5.0

Remove keyword:

sudo mb-spam-keyword remove "V1AGRA"

List keywords:

sudo mb-spam-keyword list

mb-rbl

Manage RBL servers.

Add RBL:

sudo mb-rbl add zen.spamhaus.org --weight 3.0

Remove RBL:

sudo mb-rbl remove dnsbl.example.com

List RBLs:

sudo mb-rbl list

Virus Management

mb-antivirus-block-ext

Manage blocked file extensions.

Add extension:

sudo mb-antivirus-block-ext add .exe

Remove extension:

sudo mb-antivirus-block-ext remove .exe

List extensions:

sudo mb-antivirus-block-ext list

mb-antivirus-whitelist

Whitelist files/senders from virus scanning.

By hash:

sudo mb-antivirus-whitelist add-hash d41d8cd98f00b204e9800998ecf8427e

By sender:

sudo mb-antivirus-whitelist add-sender trusted@example.com

mb-antivirus-stats

View virus detection statistics.

sudo mb-antivirus-stats

Options: - --by-virus - Group by virus name - --by-sender - Group by sender - --since "2025-01-01" - Date filter

Backup and Restore

mb-backup

Create backup.

Full backup:

sudo mb-backup --full

Incremental backup:

sudo mb-backup --incremental

Configuration only:

sudo mb-backup --config-only

Database only:

sudo mb-backup --database-only

Custom output:

sudo mb-backup --full --output /tmp/mailborder-backup.tar.gz

mb-restore

Restore from backup.

Full restore:

sudo mb-restore --from /path/to/backup.tar.gz

Configuration only:

sudo mb-restore --config-only --from /path/to/backup.tar.gz

Database only:

sudo mb-restore --database-only --from /path/to/backup.tar.gz

Dry run:

sudo mb-restore --dry-run --from /path/to/backup.tar.gz

mb-backup-verify

Verify backup integrity.

sudo mb-backup-verify /path/to/backup.tar.gz

mb-backup-list

List available backups.

sudo mb-backup-list

Maintenance

mb-maintenance

Perform maintenance tasks.

Optimize database:

sudo mb-maintenance --optimize-db

Cleanup logs:

sudo mb-maintenance --cleanup-logs

Cleanup quarantine:

sudo mb-maintenance --cleanup-quarantine

All tasks:

sudo mb-maintenance --all

mb-dns-cache-clear

Clear DNS cache.

sudo mb-dns-cache-clear

mb-redis-flush

Flush Redis cache.

sudo mb-redis-flush

Options: - --all - Flush all databases - --db 0 - Flush specific database

Testing and Diagnostics

mb-test-relay

Test relay host connectivity.

sudo mb-test-relay

mb-test-ldap

Test LDAP authentication.

sudo mb-test-ldap --username john.doe

Options: - --verbose - Detailed output

mb-test-recipient

Test recipient validation.

sudo mb-test-recipient user@example.com

mb-test-smtp

Test SMTP connection.

sudo mb-test-smtp --host mail.example.com --port 25

mb-test-spam

Test spam filtering on file.

sudo mb-test-spam /path/to/email.eml

Logging and Reporting

mb-audit-log

View audit logs.

Recent activity:

sudo mb-audit-log --recent

By type:

sudo mb-audit-log --type login
sudo mb-audit-log --type config

By user:

sudo mb-audit-log --user admin@example.com

Date range:

sudo mb-audit-log --since "2025-01-01" --until "2025-01-31"

Export:

sudo mb-audit-log --export csv > audit-log.csv

mb-report

Generate reports.

Email volume:

sudo mb-report --email-volume --daily

Spam statistics:

sudo mb-report --spam-stats --weekly

Virus detections:

sudo mb-report --virus-stats --monthly

Custom report:

sudo mb-report --custom --since "2025-01-01" --email admin@example.com

mb-spam-stats

View spam statistics.

sudo mb-spam-stats

Options: - --domain example.com - Per-domain stats - --false-positives - False positive rate - --false-negatives - False negative rate

License Management

mb-license

Manage license.

View status:

sudo mb-license --status

Activate license:

sudo mb-license --activate LICENSE-KEY-HERE

Offline activation:

# Generate request
sudo mb-license --offline-request > activation-request.txt

# Apply response
sudo mb-license --offline-response < activation-response.txt

Deactivate:

sudo mb-license --deactivate

API Key Management

mb-api-key-generate

Generate API key.

sudo mb-api-key-generate --email admin@example.com --name "Monitoring Script"

mb-api-key-list

List API keys.

sudo mb-api-key-list --email admin@example.com

mb-api-key-revoke

Revoke API key.

sudo mb-api-key-revoke --key mbv6_abc123...

Clustering

mb-cluster

Manage cluster configuration.

Show cluster status:

sudo mb-cluster status

Add child node:

sudo mb-cluster add-node --host child1.example.com

Remove node:

sudo mb-cluster remove-node --host child1.example.com

Push configuration:

sudo mb-cluster config-push

Common Command Patterns

Chain Commands

# Update signatures and restart filter
sudo mb-update --antivirus && sudo systemctl restart mb-filter

# Backup before major change
sudo mb-backup --full && sudo mb-config set spam.threshold.pass 5.0

# Test and apply config
sudo mb-config --verify && sudo mb-config reload

Cron Jobs

# Daily backup
0 2 * * * /usr/bin/mb-backup --incremental

# Hourly signature update
0 * * * * /usr/bin/mb-update --signatures

# Weekly maintenance
0 3 * * 0 /usr/bin/mb-maintenance --all

Scripting Examples

Bash script to check system health:

#!/bin/bash
if ! sudo mb-status --json | jq -e '.health == "good"' > /dev/null; then
    echo "Mailborder health check failed!" | mail -s "Alert" admin@example.com
fi

Monitor queue size:

#!/bin/bash
QUEUE_SIZE=$(sudo mailq | grep -c "^[A-F0-9]")
if [ "$QUEUE_SIZE" -gt 1000 ]; then
    echo "Queue size is $QUEUE_SIZE" | mail -s "Queue Alert" admin@example.com
fi

Getting Help

Command Help

Most commands support --help:

sudo mb-config --help
sudo mb-backup --help
sudo mb-domain --help

Man Pages

man mb-config
man mb-backup
man mb-status

See Also