Dovecot v2.1+ Statistics

There are different “zoom levels” you may use to view the following statistics:

  • command: Per-IMAP command
  • session: Per IMAP/POP3 connection
  • user: Per user (all of user’s sessions summed up)
  • domain: Per domain (all of domain’s users summed up)
  • ip: Per IP address (all sessions from the IP summed up)

Basic Configuration

mail_plugins = $mail_plugins stats
protocol imap {
  mail_plugins = $mail_plugins imap_stats
}
plugin {
  # how often to session statistics
  stats_refresh = 30 secs
  # track per-IMAP command statistics
  stats_track_cmds = yes
}

You’ll also need to give enough permissions for mail processes to be able to write to stats-mail fifo. For example if you use a single “vmail” user for mail access:

service stats {
  fifo_listener stats-mail {
    user = vmail
    mode = 0600
  }
}

Statistics gathered

Statistics gathered using the getrusage() system call:

  • user_cpu: User CPU (seconds.microseconds)
  • sys_cpu: System CPU (seconds.microseconds)
  • min_faults: Minor page faults (page reclaims)
  • maj_faults: Major page faults
  • vol_cs: Voluntary context switches
  • invol_cs: Involuntary context switches
  • disk_input: Number of bytes read from disk
  • disk_output: Number of bytes written to disk

The disk_input and disk_output attempt to count the actual read/write bytes to physical disk, so e.g. reads from OS’s cache aren’t counted. Note that not all operating systems and filesystem support this, instead they simply show these values always as 0.

Statistics gathered by Dovecot’s lib-storage internally:

  • lookup_path: Number of open() and stat() calls (i.e. “path lookups”)
  • lookup_attr: Number of stat() and fstat() calls
  • read_count: Number of read() calls for message data (e.g. index files not counted)
  • read_bytes: Number of message bytes read()
  • cache_hits: Number of cache hits from dovecot.index.cache file


Advertisements

Doveadm Notes

Dovecot‘s administration utility can be used to manage various parts of Dovecot, as well as access users’ mailboxes. Here’s a list of some commonly used commands.

  • Show all messages older then 30 days in user matt’s Inbox
doveadm search -u matt mailbox INBOX savedbefore 30d
  • Expunge (delete) all messages older then 7 days in matt’s Trash folder
doveadm expunge -u matt mailbox Trash savedbefore 7d
  • List current quota status for a user (-u) or all users (-A)
doveadm quota get -u matt

RoundCube Regression Testing

With the release of RoundCube 0.3-stable and all the upgrades that will happen, It feels like a good time to talk about regression testing.  Regression testing is when you test the functions of a peace of software to make sure that your updates didn’t break any functions.  In RoundCube it takes me about 10 minuets to fully test a site.  Here’s my check list, yours my vary depending on the plugins your using.

Main Screen

  • Read a HTMLmessage from the preview panel
    • Confirm the “View Header” drop down window works with HTML messages
  • Read a Plain Textmessage from the preview panel
    • Confirm the “View Header” drop down window works with Plain Text messages
  • Read a HTMLmessage full screen
    • Confirm the “View Header” drop down window works with HTML messages
    • Confirm the “Read Source” button works with HTML messages
  • Read a Plain Textmessage full screen
    • Confirm the “View Header” drop down window works with Plain Text messages
    • Confirm the “Read Source” button works with Plain Text messages
  • Change Message pages
  • Select All, Unread, None from the bottom center
  • Is the quota meter displaying
  • Flag (star) a message
  • Search for a known message value
  • Move a message from Inbox to a folder
  • Move a message from a folder to the Inbox
  • Send a message to an internal account
  • Send a message to an external account
  • Add a message via the plus symbol when viewing a message
    • Dose it show up in Personal Settings / Spam / Address Rules

Address Book

  • Add an Address Book entry
    • Dose it show up in Personal Settings / Spam / Address Rules
  • Change an existing entry
  • Compose Mail To” button, top center
  • Export Contacts in vCard format” button, top center
  • “Import Contacts” button, top center
  • Delete a contact
    • Dose it delete from Personal Settings / Spam / Address Rules

Personal Settings / Folders

  • Subscribe to a folder
  • Unsubscribe from a folder
  • Add a folder
  • Delete a folder

Personal Settings / Identities

  • Add a new “Identity”
    • Send a message with this identity
  • Modify an existing “Identity”
    • Send a message with this identity
  • Delete an Identity
  • Change default Identity’s

Personal Settings / Spam

  • Add a new white list entry
  • Add a new black list entry
  • Delete a white list entry
  • Delete a black list entry

Postfix: reject an address before queue

First start out by creating a file named /etc/postfix/rejected_addresses then add the following to it

bad_sender@example.com    REJECT

This will be an hashed map table, so we need to create the hash

postmap /etc/postfix/rejected_addresses

Next we need to add the map to our /etc/postfix/main.cffile. We will be adding this to the smtpd_recipient_restrictions section.

smtpd_recipient_restrictions =
  ...
  check_sender_access hash:/etc/postfix/rejected_addresses,
  ...
  reject_unauth_destination

Once complete reload postfix

postfix reload