| 1 |
.. cyrusman:: cyr_dbtool(8) |
| 2 |
|
| 3 |
.. author: Nic Bernstein (Onlight) |
| 4 |
.. author: Jeroen van Meeuwen (Kolab Systems) |
| 5 |
|
| 6 |
.. _imap-reference-manpages-systemcommands-cyr_dbtool: |
| 7 |
|
| 8 |
============== |
| 9 |
**cyr_dbtool** |
| 10 |
============== |
| 11 |
|
| 12 |
Manage Cyrus databases |
| 13 |
|
| 14 |
Synopsis |
| 15 |
======== |
| 16 |
|
| 17 |
.. parsed-literal:: |
| 18 |
|
| 19 |
**cyr_dbtool** [ **-C** *config-file* ] [ **-n** ] [ **-o** ] [ **-T** ] |
| 20 |
*db-file* *db-backend* *action* [ *key* ] [ *value* ] |
| 21 |
|
| 22 |
Description |
| 23 |
=========== |
| 24 |
|
| 25 |
**cyr_dbtool** is used to manage a cyrusdb file. The usable actions are: |
| 26 |
|
| 27 |
**show** *[<prefix>]* |
| 28 |
|
| 29 |
**get** *<key>* |
| 30 |
|
| 31 |
**set** *<key> <value>* |
| 32 |
|
| 33 |
**delete** *<key>* |
| 34 |
|
| 35 |
**consistency** |
| 36 |
|
| 37 |
**repack** |
| 38 |
|
| 39 |
You may omit *key* or *key/value* and specify one per line on stdin. |
| 40 |
Keys are terminated by tab or newline, values are terminated by newline. |
| 41 |
|
| 42 |
Running without any options will list the available database backends and |
| 43 |
usable actions. |
| 44 |
|
| 45 |
The *consistency* action runs a consistency check on the DB by calling |
| 46 |
'myconsistent' on it. |
| 47 |
|
| 48 |
The *repack* action will compress the database by removing stale data |
| 49 |
on backends which support it. It's a NOOP otherwise. |
| 50 |
|
| 51 |
**cyr_dbtool** |default-conf-text| |
| 52 |
|
| 53 |
.. Note:: |
| 54 |
Note that the file locations are NOT read out of the configuration |
| 55 |
file, and must be supplied on the command line. |
| 56 |
|
| 57 |
.. Tip:: |
| 58 |
The format of all Cyrus databases is detailed in the distribution in |
| 59 |
file doc/internal/database-formats.html. Please consult that for |
| 60 |
details. |
| 61 |
|
| 62 |
Options |
| 63 |
======= |
| 64 |
|
| 65 |
.. program:: cyr_dbtool |
| 66 |
|
| 67 |
.. option:: -C config-file |
| 68 |
|
| 69 |
|cli-dash-c-text| |
| 70 |
|
| 71 |
.. option:: -n, --create |
| 72 |
|
| 73 |
Create the database file if it doesn't already exist. |
| 74 |
|
| 75 |
.. option:: -T, --use-transaction |
| 76 |
|
| 77 |
Use a transaction to do the action (most especially for 'show') - the |
| 78 |
default used to be transactions. |
| 79 |
|
| 80 |
Examples |
| 81 |
======== |
| 82 |
|
| 83 |
This series of examples address manipulating the *user_deny.db* |
| 84 |
database, which is used to deny users access to specific services. This |
| 85 |
is typically a Cyrus "flat" format database. |
| 86 |
|
| 87 |
*user_deny.db* is indexed by userid and each record contains the |
| 88 |
database version number (currently 2), a list of "wildmat" patterns |
| 89 |
specifying Cyrus services to be denied, and a text message to be |
| 90 |
displayed to the user upon denial. The service names to be matched are |
| 91 |
those as used in :cyrusman:`cyrus.conf(5)`. :cyrusman:`cyr_deny(8)` |
| 92 |
provides more convenient way to manage *user_deny.db*. |
| 93 |
|
| 94 |
.. Note:: |
| 95 |
|
| 96 |
Given that *keys* are tab-delimited, these examples use the notation |
| 97 |
<tab> to indicate the tab character. When entering this via the |
| 98 |
command line, remember to escape tabs. In a normal shell, one can |
| 99 |
do so with <ctrl-v> (^v). The sequence "<ctrl-v><ctrl-i>" (^v^i) |
| 100 |
works well to enter tab characters. |
| 101 |
|
| 102 |
.. parsed-literal:: |
| 103 |
|
| 104 |
**cyr_dbtool** /var/lib/imap/user_deny.db flat baduser "2<tab>pop3,imap<tab>Denied" |
| 105 |
|
| 106 |
.. |
| 107 |
|
| 108 |
Deny the user 'baduser' access to imap and pop3. |
| 109 |
|
| 110 |
.. only:: html |
| 111 |
|
| 112 |
Subsequent login attempts by this user would result in authentication |
| 113 |
failures, and log entries like this:: |
| 114 |
|
| 115 |
# grep baduser /var/log/mail.log |
| 116 |
Sep 19 14:34:57 cyrushost cyrus/imap[635]: fetching user_deny.db entry for 'baduser' |
| 117 |
Sep 19 14:34:57 cyrushost cyrus/imap[635]: user 'baduser' denied access to service 'imap' |
| 118 |
Sep 19 14:34:57 cyrushost cyrus/imap[635]: badlogin: cyrus.example.org [192.168.190.14] plaintext baduser SASL(-14): authorization failure: user 'baduser' is denied access to service 'imap' |
| 119 |
Sep 19 14:38:21 cyrushost cyrus/imap[816]: badlogin: cyrus.example.org [192.168.190.14] plaintext baduser SASL(-13): authentication failure: checkpass failed |
| 120 |
|
| 121 |
.. parsed-literal:: |
| 122 |
|
| 123 |
**cyr_dbtool** /var/lib/imap/user_deny.db flat show |
| 124 |
|
| 125 |
.. |
| 126 |
|
| 127 |
Show all current database records. |
| 128 |
|
| 129 |
.. only:: html |
| 130 |
|
| 131 |
:: |
| 132 |
|
| 133 |
baduser 2 pop3,imap Denied |
| 134 |
|
| 135 |
.. parsed-literal:: |
| 136 |
|
| 137 |
**cyr_dbtool** /var/lib/imap/user_deny.db flat get baduser |
| 138 |
|
| 139 |
.. |
| 140 |
|
| 141 |
Get the current database record(s) for user 'baduser'. |
| 142 |
|
| 143 |
.. only:: html |
| 144 |
|
| 145 |
:: |
| 146 |
|
| 147 |
2 pop3,imap Denied |
| 148 |
|
| 149 |
Files |
| 150 |
===== |
| 151 |
|
| 152 |
/etc/imapd.conf |
| 153 |
|
| 154 |
See Also |
| 155 |
======== |
| 156 |
|
| 157 |
:cyrusman:`imapd.conf(5)` |