Command line Reference

Custom paster commands are provided to enable scripting of house keeping tasks such as quarantine management and Database maintenance.

Note

This information is provided simply for reference and documentation purposes scheduled tasks are installed by default to perform these house keeping tasks for you, you do not have to create new cronjobs. For information on cronjobs that use these commands refer to Scheduled commands

Command options and help

These commands may take options to get details on the supported options run:

paster baruwa
paster COMMAND_NAME -h or paster help COMMAND_NAME

The paster command now has auto completions support meaning you can press tab to get the available options:

paster
camqadm                     create                      points                      routes                      send-top-spammer-list       update-delta-index
celerybeat                  create-admin-user           post                        send-pdf-reports            send-whitelist-data         update-mta-lookup
celeryd                     exe                         prune-database              send-pdf-reports-ng         serve                       update-queue-stats
celeryev                    help                        prune-quarantine            send-quarantine-reports     setup-app                   update-rulesets
change-user-password        make-config                 request                     send-quarantine-reports-ng  shell                       update-sa-rules

Quarantine management

paster prune-quarantine /etc/baruwa/production.ini

Deletes quarantined files older than ms.quarantine.days_to_keep. This is set in the /etc/baruwa/production.ini file

Quarantine reports

paster send-quarantine-reports-ng /etc/baruwa/production.ini

Generates an email report of the quarantined messages. This command allows you to specify the number of days the report should cover as well as the maximum number of messages to return. The following switches allow you to specify periods.

  • -o NUM_DAYS, --newer-than=NUM_DAYS Report on messages this number of days back
  • -m MAX_MSGS, --max-records=MAX_MSGS Maximum number of messages to return
  • -i ORG_ID, --org-id=ORG_ID Process only this organization’s accounts
  • -e EXCLUDE_ORG, --excluded-org=EXCLUDE_ORG Exclude this organization’s accounts
  • -f, --force Force sending of reports even if hour is not in user or domain set timezone

Database maintenance

paster prune-database /etc/baruwa/production.ini

Deletes records older than 30 days from the messages table of the database, and archives them to the archive table. It deletes records older than 90 days from the archives table. These defaults can be configured in the configuration file as the following options:

  • baruwa.messages.keep.days
  • baruwa.archive.keep.days

The following options allow you to specify the periods of the records that need to be processed.

  • -d --days records older than this number are deleted from messages
  • -a --adays records older than this number are deleted from archives

Spamassassin rule description updates

paster update-sa-rules /etc/baruwa/production.ini

Updates the Spamassassin rule descriptions in the database.

PDF reports

paster send-pdf-reports-ng /etc/baruwa/production.ini

Sends PDF reports by email. This command allows you to specify the report type [domain, user], report period [daily, weekly, monthly] and the number of days to report on. The following switches allow you to specify the options.

  • -t REPORT_TYPE, --report-type=REPORT_TYPE Report type [user, domain]
  • -p REPORT_PERIOD, --report-period=REPORT_PERIOD Report period [daily, weekly, monthly]
  • -d NUMBER_OF_DAYS, --number-of-days=NUMBER_OF_DAYS Restrict to number of days
  • -i ORG_ID, --org-id=ORG_ID Process only this organization’s accounts
  • -e EXCLUDE_ORG, --excluded-org=EXCLUDE_ORG Exclude this organization’s accounts
  • -f, --force Force sending of reports even if hour is not in user or domain set timezone

Mail queue Stats updates

paster update-queue-stats /etc/baruwa/production.ini

Query the inbound and outbound queues and write stats to the database.

Delta search index updates

paster update-delta-index --index messages --realtime /etc/baruwa/production.ini
paster update-delta-index --index archive /etc/baruwa/production.ini

The messages and archive index have deltas to ensure that indexing is efficient the above commands merge the delta index with the main index and remove id’s from the realtime index that have been indexed to disk indexes.

The messages index has a real time index while archive does not.

Create an administrator account

paster create-admin-user -u USERNAME -p PASSWORD -e EMAIL -t TIMEZONE /etc/baruwa/production.ini

Create an administrator account

Change user password

paster change-user-password --username USERNAME [/etc/baruwa/production.ini]

Changes an accounts password, This is the only way to change an administrator account’s password as it cannot be changed via the web interface.

Generate list of top spammers

paster send-top-spammer-list -e EMAIL [-m -s SPAMSCORE -p REPORT_PERIOD -d] [/etc/baruwa/production.ini]

Generates a list of top spammers and emails or displays it.

  • -e EMAIL, --email=EMAIL Email address to send data to
  • -m, --include-message-count Include the number messages received
  • -d, --dry-run Print to stdout do not send email
  • -n NUM, --messages-sent=NUM Return senders with message counts equal to or greater than
  • -s SPAMSCORE, --spam-score-threshold=SPAMSCORE Count messages with spam scores equal to or greater than
  • -p REPORT_PERIOD, --report-period=REPORT_PERIOD Report period [daily, weekly, monthly]

Generate list of clean senders

paster send-whitelist-data -e EMAIL [-m -s SPAMSCORE -p REPORT_PERIOD -d] [/etc/baruwa/production.ini]

Generates a list of top ham senders for whitelisting.

  • -e EMAIL, --email=EMAIL Email address to send data to
  • -m, --include-message-count Include the number messages received
  • -d, --dry-run Print to stdout do not send email
  • -n NUM, --messages-sent=NUM Return senders with message counts equal to or greater than
  • -s SPAMSCORE, --spam-score-threshold=SPAMSCORE Count messages with spam scores equal to or greater than
  • -p REPORT_PERIOD, --report-period=REPORT_PERIOD Report period [daily, weekly, monthly]

Create Scanner rulesets

paster update-rulesets [/etc/baruwa/production.ini]

This will create or update the necessary Scanner rulesets.

Create MTA lookup files

paster update-mta-lookup [/etc/baruwa/production.ini]

This will create or update the MTA CDB lookup files.

Dump MTA lookup file

paster dump-mta-lookup-file [/etc/baruwa/production.ini] -f /var/lib/baruwa/data/db/routedata.cdb

This will display the contents of a CDB lookup file.

  • -f FILENAME, --filename=FILENAME Lookup file to dump