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