1 .TH SLAPO-PCACHE 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2006 The OpenLDAP Foundation, All Rights Reserved.
3 .\" Copying restrictions apply. See the COPYRIGHT file.
4 .\" Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
7 slapo-pcache \- proxycache overlay
15 allows caching of LDAP search requests (queries) in a local database.
16 For an incoming query, the
17 proxy cache determines its corresponding \fBtemplate\fP. If the template
18 was specified as cacheable using the \fBproxytemplate\fP directive
19 and the request is contained in a cached request, it is answered from
21 Otherwise, the search is performed as usual and cacheable search results
22 are saved in the cache for use in future queries.
25 A template is defined by a filter string and an index identifying a set of
26 attributes. The \fBtemplate string\fP for a query can be obtained by
27 removing assertion values from the RFC 4515 representation of its search
28 filter. A query belongs to a template if its template string and set of
29 projected attributes correspond to a cacheable template.
30 Examples of template strings are \fB(mail=)\fP, \fB(|(sn=)(cn=))\fP,
31 \fB(&(sn=)(givenName=))\fP.
34 The config directives that are specific to the
36 overlay can be prefixed by
38 to avoid conflicts with directives specific to the underlying database
39 or to other stacked overlays. This may be particularly useful for those
40 directives that refer to the backend used for local storage.
41 The following cache specific directives can be used to configure the proxy
45 This directive adds the proxy cache overlay to the current backend. The
46 proxy cache overlay may be used with any backend but is intended for use
54 .B proxycache <database> <max_entries> <numattrsets> <entry_limit> <cc_period>
55 The directive enables proxy caching in the current backend and sets general
56 cache parameters. A <database> backend will be used internally to maintain
57 the cached entries. The chosen database will need to be configured as well,
58 as shown below. Cache replacement is invoked when the cache size grows to
59 <max_entries> entries and continues till the cache size drops below this size.
60 <numattrsets> should be equal to the number of following \fBproxyattrset\fP
61 directives. Queries are cached only if they correspond to a cacheable template
62 (specified by the \fBproxytemplate\fP directive) and the number of entries
63 returned is less than <entry_limit>. Consistency check is performed every
64 <cc_period> duration (specified in secs). In each cycle queries with expired
65 "time to live(\fBTTL\fP)" are removed. A sample cache configuration is:
68 proxycache \fBbdb 10000 1 50 100\fP
71 .B proxycachequeries <queries>
72 Specify the maximum number of queries to cache. The default is 10000.
75 .B proxyattrset <index> <attrs...>
76 Used to associate a set of attributes <attrs..> with an <index>. Each attribute
77 set is associated with an integer from 0 to <numattrsets>-1. These indices are
78 used by the \fBproxytemplate\fP directive to define cacheable templates.
81 .B proxytemplate <template_string> <attrset_index> <ttl> [<negttl>]
82 Specifies a cacheable template and "time to live" (in sec) <ttl> of queries
83 belonging to the template. An optional <negttl> can be used to specify
84 that negative results (i.e., queries that returned zero entries)
85 should also be cached for the specified number of seconds. Negative
86 results are not cached by default.
89 .B response-callback { head | tail }
90 Specifies whether the response callback should be placed at the
92 (the default) or at the
94 (actually, wherever the stacking sequence would make it appear)
95 of the callback list. This affects how the overlay interacts with other
96 overlays, since the proxycache overlay should be executed as early
97 as possible (and thus configured as late as possible), to get
98 a chance to return the cached results; however, if executed early
99 at response, it would cache entries that may be later "massaged"
100 by other databases and thus returned \fIafter\fP massaging the first
101 time, and \fIbefore\fP massaging when cached.
104 There are some constraints:
106 all values must be positive;
109 must be less than or equal to
113 attribute sets SHOULD be defined by using the directive
116 all attribute sets SHOULD be referenced by (at least) one
121 The following adds a template with filter string \fB(&(sn=)(givenName=))\fP
122 and attributes mail, postaladdress, telephonenumber and a TTL of 1 hour.
126 proxyattrset \fB0 mail postaladdress telephonenumber\fP
127 proxytemplate \fB(&(sn=)(givenName=)) 0 3600\fP
132 Directives for configuring the underlying database must also be given, as
137 directory /var/tmp/cache
142 Any valid directives for the chosen database type may be used. Indexing
143 should be used as appropriate for the queries being handled. In addition,
144 an equality index on the \fBqueryid\fP attribute should be configured, to
145 assist in the removal of expired query data.
147 Caching data is prone to inconsistencies because updates on the remote server
148 will not be reflected in the response of the cache at least (and at most)
149 for the duration of the
153 The remote server should expose the
155 attribute because the underlying database that actually caches the entries
156 may need it for optimal local processing of the queries.
158 Another potential (and subtle) inconsistency may occur when data is retrieved
159 with different identities and specific per-identity access control
160 is enforced by the remote server.
161 If data was retrieved with an identity that collected only partial results
162 because of access rules enforcement on the remote server, other users
163 with different access privileges on the remote server will get different
164 results from the remote server and from the cache.
165 If those users have higher access privileges on the remote server, they will
166 get from the cache only a subset of the results they would get directly
167 from the remote server; but if they have lower access privileges, they will
168 get from the cache a superset of the results they would get directly
169 from the remote server.
170 Either occurrence may or may not be acceptable, based on the security policy
171 of the cache and of the remote server.
172 It is important to note that in this case the proxy is violating the security
173 of the remote server by disclosing to an identity data that was collected
175 For this reason, it is suggested that, when using
177 proxy caching be used in conjunction with the
178 .I identity assertion
185 statements), so that remote server interrogation occurs with a vanilla identity
186 that has some relatively high
190 access privileges, and the "real" access control is delegated to the proxy's ACLs.
191 Beware that since only the cached fraction of the real datum is available
192 to the cache, it may not be possible to enforce the same access rules that
193 are defined on the remote server.
194 When security is a concern, cached proxy access must be carefully tailored.
199 default slapd configuration file
207 Originally implemented by Apurva Kumar as an extension to back-meta;
208 turned into an overlay by Howard Chu.