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