1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "https://www.w3.org/TR/html4/loose.dtd"> 3 <html> <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 5 <link rel='stylesheet' type='text/css' href='postfix-doc.css'> 6 <title> Postfix manual - memcache_table(5) </title> 7 </head> <body> <pre> 8 MEMCACHE_TABLE(5) MEMCACHE_TABLE(5) 9 10 <b><a name="name">NAME</a></b> 11 memcache_table - Postfix memcache client configuration 12 13 <b><a name="synopsis">SYNOPSIS</a></b> 14 <b>postmap -q "</b><i>string</i><b>" <a href="memcache_table.5.html">memcache</a>:/etc/postfix/</b><i>filename</i> 15 16 <b>postmap -q - <a href="memcache_table.5.html">memcache</a>:/etc/postfix/</b><i>filename</i> <<i>inputfile</i> 17 18 <b><a name="description">DESCRIPTION</a></b> 19 The Postfix mail system uses optional tables for address rewriting or 20 mail routing. These tables are usually in <b><a href="lmdb_table.5.html">lmdb</a>:</b>, <b><a href="CDB_README.html">cdb</a>:</b>, <b><a href="DATABASE_README.html#types">hash</a>:</b>, or <b><a href="DATABASE_README.html#types">dbm</a>:</b> 21 format. 22 23 Alternatively, lookup tables can be specified as memcache instances. To 24 use memcache lookups, define a memcache source as a lookup table in 25 <a href="postconf.5.html">main.cf</a>, for example: 26 27 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = <a href="memcache_table.5.html">memcache</a>:/etc/postfix/memcache-aliases.cf 28 29 The file /etc/postfix/memcache-aliases.cf has the same format as the 30 Postfix <a href="postconf.5.html">main.cf</a> file, and specifies the parameters described below. 31 32 The Postfix memcache client supports the lookup, update, delete and 33 sequence (first/next) operations. The sequence operation requires a 34 backup database that supports the operation. 35 36 <b><a name="memcache_main_parameters">MEMCACHE MAIN PARAMETERS</a></b> 37 <b>memcache (default: inet:localhost:11211)</b> 38 The memcache server (note: singular) that Postfix will try to 39 connect to. For a TCP server specify "inet:" followed by a 40 hostname or address, ":", and a port name or number. Specify an 41 IPv6 address inside "[]". For a UNIX-domain server specify 42 "unix:" followed by the socket pathname. Examples: 43 44 memcache = inet:memcache.example.com:11211 45 memcache = inet:127.0.0.1:11211 46 memcache = inet:[fc00:8d00:189::3]:11211 47 memcache = unix:/path/to/socket 48 49 NOTE: to access a UNIX-domain socket with the <a href="proxymap.8.html">proxymap(8)</a> 50 server, the socket must be accessible by the unprivileged post- 51 fix user. 52 53 <b>backup (default: undefined)</b> 54 An optional Postfix database that provides persistent backup for 55 the memcache database. The Postfix memcache client will update 56 the memcache database whenever it looks up or changes informa- 57 tion in the persistent database. Specify a Postfix "<a href="DATABASE_README.html">type:table</a>" 58 database. Examples: 59 60 # Non-shared postscreen cache. 61 backup = <a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/<a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> 62 63 # Shared postscreen cache for processes on the same host. 64 backup = <a href="proxymap.8.html">proxy</a>:<a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/<a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> 65 66 Access to remote proxymap servers is under development. 67 68 NOTE 1: When sharing a persistent <a href="postscreen.8.html"><b>postscreen</b>(8)</a> or <a href="verify.8.html"><b>verify</b>(8)</a> 69 cache, disable automatic cache cleanup (set 70 *_cache_cleanup_interval = 0) except with one Postfix instance 71 that will be responsible for cache cleanup. 72 73 NOTE 2: When multiple tables share the same memcache database, 74 each table should use the <b>key_format</b> feature (see below) to 75 prepend its own unique string to the lookup key. Otherwise, 76 automatic <a href="postscreen.8.html"><b>postscreen</b>(8)</a> or <a href="verify.8.html"><b>verify</b>(8)</a> cache cleanup may not work. 77 78 NOTE 3: When the backup database is accessed with "<a href="proxymap.8.html">proxy</a>:" 79 lookups, the full backup database name (including the "<a href="proxymap.8.html">proxy</a>:" 80 prefix) must be specified in the proxymap server's 81 <a href="postconf.5.html#proxy_read_maps">proxy_read_maps</a> or <a href="postconf.5.html#proxy_write_maps">proxy_write_maps</a> setting (depending on 82 whether the access is read-only or read-write). 83 84 <b>flags (default: 0)</b> 85 Optional flags that should be stored along with a memcache 86 update. The flags are ignored when looking up information. 87 88 <b>ttl (default: 3600)</b> 89 The expiration time in seconds of memcache updates. 90 91 NOTE 1: When using a memcache table as <a href="postscreen.8.html"><b>postscreen</b>(8)</a> or <a href="verify.8.html"><b>ver-</b></a> 92 <a href="verify.8.html"><b>ify</b>(8)</a> cache without persistent backup, specify a zero 93 *_cache_cleanup_interval value with all Postfix instances that 94 use the memcache, and specify the largest <a href="postscreen.8.html"><b>postscreen</b>(8)</a> *_ttl 95 value or <a href="verify.8.html"><b>verify</b>(8)</a> *_expire_time value as the memcache table's 96 <b>ttl</b> value. 97 98 NOTE 2: According to memcache protocol documentation, a value 99 greater than 30 days (2592000 seconds) specifies absolute UNIX 100 time. Smaller values are relative to the time of the update. 101 102 <b><a name="memcache_key_parameters">MEMCACHE KEY PARAMETERS</a></b> 103 <b>key_digest (default: empty)</b> 104 After processing the <b>key_format</b> setting, and before sending a 105 request to the memcache server, run the key through the named 106 message digest algorithm and convert the result to lowercase 107 hexadecimal characters. This prevents a database access error 108 when keys may exceed the memcache server's key length limit 109 (usually, 250 bytes). Specify the name of a message digest algo- 110 rithm that is supported by OpenSSL, for example, <b>sha256</b>. 111 112 This feature is available in Postfix 3.11 and later, and 113 requires that Postfix is built with TLS support. 114 115 <b>key_format (default: %s)</b> 116 Format of the lookup and update keys that the Postfix memcache 117 client sends to the memcache server. By default, these are the 118 same as the lookup and update keys that the memcache client 119 receives from Postfix applications. 120 121 NOTE 1: The <b>key_format</b> feature is not used for <b>backup</b> database 122 requests. 123 124 NOTE 2: When multiple tables share the same memcache database, 125 each table should prepend its own unique string to the lookup 126 key. Otherwise, automatic <a href="postscreen.8.html"><b>postscreen</b>(8)</a> or <a href="verify.8.html"><b>verify</b>(8)</a> cache 127 cleanup may not work. 128 129 Examples: 130 131 key_format = aliases:%s 132 key_format = verify:%s 133 key_format = postscreen:%s 134 135 The <b>key_format</b> parameter supports the following '%' expansions: 136 137 <b>%%</b> This is replaced by a literal '%' character. 138 139 <b>%s</b> This is replaced by the memcache client input key. 140 141 <b>%u</b> When the input key is an address of the form user@domain, 142 <b>%u</b> is replaced by the SQL quoted local part of the 143 address. Otherwise, <b>%u</b> is replaced by the entire search 144 string. If the localpart is empty, a lookup is silently 145 suppressed and returns no results (an update is skipped 146 with a warning). 147 148 <b>%d</b> When the input key is an address of the form user@domain, 149 <b>%d</b> is replaced by the domain part of the address. Other- 150 wise, a lookup is silently suppressed and returns no 151 results (an update is skipped with a warning). 152 153 <b>%[SUD]</b> The upper-case equivalents of the above expansions behave 154 in the <b>key_format</b> parameter identically to their 155 lower-case counter-parts. 156 157 <b>%[1-9]</b> The patterns %1, %2, ... %9 are replaced by the corre- 158 sponding most significant component of the input key's 159 domain. If the input key is <i>user (a] mail.example.com</i>, then 160 %1 is <b>com</b>, %2 is <b>example</b> and %3 is <b>mail</b>. If the input key 161 is unqualified or does not have enough domain components 162 to satisfy all the specified patterns, a lookup is 163 silently suppressed and returns no results (an update is 164 skipped with a warning). 165 166 <b>domain (default: no domain list)</b> 167 This feature can significantly reduce database server load. 168 Specify a list of domain names, paths to files, or "<a href="DATABASE_README.html">type:table</a>" 169 databases. When specified, only fully qualified search keys 170 with a *non-empty* localpart and a matching domain are eligible 171 for lookup or update: bare 'user' lookups, bare domain lookups 172 and "@domain" lookups are silently skipped (updates are skipped 173 with a warning). Example: 174 175 domain = example.com, <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/searchdomains 176 177 <b><a name="memcache_error_controls">MEMCACHE ERROR CONTROLS</a></b> 178 <b>data_size_limit (default: 10240)</b> 179 The maximal memcache reply data length in bytes. 180 181 <b>line_size_limit (default: 1024)</b> 182 The maximal memcache reply line length in bytes. 183 184 <b>max_try (default: 2)</b> 185 The number of times to try a memcache command before giving up. 186 The memcache client does not retry a command when the memcache 187 server accepts no connection. 188 189 <b>retry_pause (default: 1)</b> 190 The time in seconds before retrying a failed memcache command. 191 192 <b>timeout (default: 2)</b> 193 The time limit for sending a memcache command and for receiving 194 a memcache reply. 195 196 <b><a name="bugs">BUGS</a></b> 197 The Postfix memcache client cannot be used for security-sensitive 198 tables such as <b><a href="postconf.5.html#alias_maps">alias_maps</a></b> (these may contain "<i>|command</i> and "<i>/file/name</i>" 199 destinations), or <b><a href="postconf.5.html#virtual_uid_maps">virtual_uid_maps</a></b>, <b><a href="postconf.5.html#virtual_gid_maps">virtual_gid_maps</a></b> and <b><a href="postconf.5.html#virtual_mailbox_maps">virtual_mail</a>-</b> 200 <b><a href="postconf.5.html#virtual_mailbox_maps">box_maps</a></b> (these specify UNIX process privileges for "<i>/file/name</i>" desti- 201 nations). In a typical deployment a memcache database is writable by 202 any process that can talk to the memcache server; in contrast, secu- 203 rity-sensitive tables must never be writable by the unprivileged Post- 204 fix user. 205 206 The Postfix memcache client requires additional configuration when used 207 as <a href="postscreen.8.html"><b>postscreen</b>(8)</a> or <a href="verify.8.html"><b>verify</b>(8)</a> cache. For details see the <b>backup</b> and 208 <b>ttl</b> parameter discussions in the MEMCACHE MAIN PARAMETERS section 209 above. 210 211 <b><a name="see_also">SEE ALSO</a></b> 212 <a href="postmap.1.html">postmap(1)</a>, Postfix lookup table manager 213 <a href="postconf.5.html">postconf(5)</a>, configuration parameters 214 215 <b><a name="readme_files">README FILES</a></b> 216 <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview 217 <a href="MEMCACHE_README.html">MEMCACHE_README</a>, Postfix memcache client guide 218 219 <b><a name="license">LICENSE</a></b> 220 The Secure Mailer license must be distributed with this software. 221 222 <b><a name="history">HISTORY</a></b> 223 Memcache support was introduced with Postfix version 2.9. 224 225 <b>AUTHOR(S)</b> 226 Wietse Venema 227 IBM T.J. Watson Research 228 P.O. Box 704 229 Yorktown Heights, NY 10598, USA 230 231 Wietse Venema 232 Google, Inc. 233 111 8th Avenue 234 New York, NY 10011, USA 235 236 MEMCACHE_TABLE(5) 237 </pre> </body> </html> 238