Difference between revisions of "Cyrus"

From Leaky
Jump to: navigation, search
(IMAP - LOCALDELETE)
(IMAP: Added note about getting free space on partition)
Line 101: Line 101:
  
 
  imtest -a cyrusadmin localhost
 
  imtest -a cyrusadmin localhost
 +
 +
=== IMAP - GETANNOTATION ===
 +
 +
This command can be used to fetch the amount of space left on the partition.
 +
 +
0 GETANNOTATION "" "*" "value.shared"
 +
* ANNOTATION "" "/vendor/cmu/cyrus-imapd/freespace" ("value.shared" "107410772")
 +
0 OK Completed
 +
 +
The value returned is in KB. This is the same information as the following (but in a raw form).
 +
 +
cyradm> info
 +
Server Wide:
 +
  freespace: 107410772
  
 
=== IMAP - LOCALCREATE ===
 
=== IMAP - LOCALCREATE ===

Revision as of 15:57, 14 July 2013

Syntax

Syntax used in this document includes the following.

  • example.com - a domain name
  • username - a username or local part of an email address
  • cyradm> - a cyradm prompt (already authenticated as an admin user)
  • cyrus$ - shell prompt for the cyrus user (in some cases you can also do the command using su cyrus -c "..." but be careful to correctly escape characters)
  • root# - shell prompt for the root user

imapd.conf configuration options

The example commands given are for installations where the imapd.conf has the following options (among others)

admins: cyrusadmin
defaultdomain: cyrusdomain
allowusermoves: on

deletedprefix: DELETED
delete_mode: delayed
expunge_mode: delayed

unixhierarchysep: on
virtdomains: userid

hashimapspool: true
fulldirhash: on

Listing and fixing mailbox quotas (both use and limit)

Check mailbox quota use for the domain example.com

cyrus$ /usr/lib/cyrus-imapd/quota -d example.com

To check and fix the mailbox quota use for the domain example.com

cyrus$ /usr/lib/cyrus-imapd/quota -d example.com -f

If a mailbox quota is incorrect on the mailstore it can be changed from cyradm. The below example sets the quota to 40MB (the number is the mailbox quota in KB)

cyradm> setquota user/username@example.com 40960

To view the current quota for a mailbox

cyradm> listquota user/username@example.com

Error: can't fork process to run service Resource temporarily unavailable

This is when the number of files/processes that cyrus is using has exceeded the ulimit variables.

To fix, add the following into /etc/security/limits.d/90-nproc.conf

cyrus      soft    nproc     unlimited
cyrus      hard    nproc     unlimited
cyrus      soft    nofile    30000
cyrus      hard    nofile    30000

And then reboot the server (can we just do this instead? service cyrus-imapd stop ; service cyrus-imapd start)

MUPDATE/IMAP administration

In the event of broken mailboxes, there are a number of things that can be done by poking directly at the mupdate or imap servers. Using the mupdatetest program, you can query and modify the central database directly. Note the format of mailbox names is domain.com!user.user^name where the dots in the user part of the email address are replaced with ^

RFC for MUPDATE protocol - http://tools.ietf.org/html/rfc3656

MUPDATE

Connecting to the mupdate server is similar to connecting to the IMAP server.

root# mupdatetest -a cyrusadmin mupdatehost

MUPDATE - FIND

Query the mupdate server to see if a mailbox exists

mupdate> F01 FIND "example.com!user.username"
F01 MAILBOX {25+}
example.com!user.username {26+}
mailstore1.example.net!fs1 {20+}
username@example.com
F01 OK "Search completed"

MUPDATE - DELETE

Delete a mailbox

mupdate> D01 DELETE "example.com!user.username"
D01 OK "done"

MUPDATE - ACTIVATE

Create a mailbox (note this doesn't actually create it on the backend server, just within the mupdate server)

mupdate> A01 ACTIVATE "example.com!user.username" "mailstore1.example.net!fs1" "username@example.com lrswipkxtecda"
A01 OK "done"

IMAP

To create the folder, you need to login to the cyrusbe server where the mailbox needs to reside and run the following - this part is the IMAP server, not the MUPDATE server. It may also remove the need for the above ACTIVATE command to be run.

imtest -a cyrusadmin localhost

IMAP - GETANNOTATION

This command can be used to fetch the amount of space left on the partition.

0 GETANNOTATION "" "*" "value.shared"
* ANNOTATION "" "/vendor/cmu/cyrus-imapd/freespace" ("value.shared" "107410772")
0 OK Completed

The value returned is in KB. This is the same information as the following (but in a raw form).

cyradm> info
Server Wide:
  freespace: 107410772

IMAP - LOCALCREATE

This command causes the IMAP server to create a local folder. If there is a folder name rather than just INBOX, the folder name is inserted just before the @ i.e user/username/folder@example.com

LC1 LOCALCREATE user/username@example.com
LC1 OK Completed

It can also be written on a single line.

LC1 LOCALCREATE user/username@'example.com

IMAP - SETACL

Next we have to set permissions on the newly created folder so that the user can access it.

ACL0 SETACL user/username@example.com username@example.com lrswipkxtea
ACL0 OK Completed

IMAP - MUPDATEPUSH

And finally we push the details to the mupdate server so that everything syncs up properly.

MP1 MUPDATEPUSH user/username@example.com
MP1 OK Completed

IMAP - LOCALDELETE

To remove a folder locally:

LD1 LOCALDELETE user/username@example.com
LD1 OK Completed

Assorted Links

Cyrus: sieve scripts in shared folders