~ubuntu-branches/ubuntu/karmic/postfix/karmic-security

« back to all changes in this revision

Viewing changes to man/man5/mysql_table.5

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2008-09-07 14:02:15 UTC
  • mfrom: (29.1.21 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080907140215-d9zf8bj803ditke5
Tags: 2.5.5-1.1
* Non-maintainer upload.
* Add rsyslog.d config snipped to create a /dev/log syslog socket in the
  postfix chroot.  Also, add a note about other syslog daemons to
  README.Debian.  Closes: #311812

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
Alternatively, lookup tables can be specified as MySQL databases.
22
22
In order to use MySQL lookups, define a MySQL source as a lookup
23
23
table in main.cf, for example:
24
 
.ti +4
25
 
alias_maps = mysql:/etc/mysql-aliases.cf
 
24
.nf
 
25
    alias_maps = mysql:/etc/mysql-aliases.cf
 
26
.fi
26
27
 
27
28
The file /etc/postfix/mysql-aliases.cf has the same format as
28
29
the Postfix main.cf file, and can specify the parameters
56
57
The old interface will be gradually phased out. To migrate to
57
58
the new interface set:
58
59
 
59
 
.ti +4
60
 
\fBquery\fR = SELECT [\fIselect_field\fR]
61
 
.ti +8
62
 
FROM [\fItable\fR]
63
 
.ti +8
64
 
WHERE [\fIwhere_field\fR] = '%s'
65
 
.ti +12
66
 
[\fIadditional_conditions\fR]
 
60
.nf
 
61
    \fBquery\fR = SELECT [\fIselect_field\fR]
 
62
        FROM [\fItable\fR]
 
63
        WHERE [\fIwhere_field\fR] = '%s'
 
64
            [\fIadditional_conditions\fR]
 
65
.fi
67
66
 
68
67
Insert the value, not the name, of each legacy parameter. Note
69
68
that the \fBadditional_conditions\fR parameter is optional
97
96
The hosts that Postfix will try to connect to and query from.
98
97
Specify \fIunix:\fR for UNIX domain sockets, \fIinet:\fR for TCP
99
98
connections (default).  Example:
100
 
.ti +4
101
 
hosts = host1.some.domain host2.some.domain
102
 
.ti +4
103
 
hosts = unix:/file/name
 
99
.nf
 
100
    hosts = host1.some.domain host2.some.domain
 
101
    hosts = unix:/file/name
 
102
.fi
104
103
 
105
104
The hosts are tried in random order, with all connections over
106
105
UNIX domain sockets being tried before those over TCP.  The
112
111
prefix it with \fIinet:\fR), MySQL will connect to the default
113
112
UNIX domain socket.  In order to instruct MySQL to connect to
114
113
localhost over TCP you have to specify
115
 
.ti +4
116
 
hosts = 127.0.0.1
 
114
.nf
 
115
    hosts = 127.0.0.1
 
116
.fi
117
117
.IP "\fBuser, password\fR"
118
118
The user name and password to log into the mysql server.
119
119
Example:
120
 
.in +4
121
 
user = someone
122
 
.br
123
 
password = some_password
124
 
.in -4
 
120
.nf
 
121
    user = someone
 
122
    password = some_password
 
123
.fi
125
124
.IP "\fBdbname\fR"
126
125
The database name on the servers. Example:
127
 
.ti +4
128
 
dbname = customer_database
 
126
.nf
 
127
    dbname = customer_database
 
128
.fi
129
129
.IP "\fBquery\fR"
130
130
The SQL query template used to search the database, where \fB%s\fR
131
131
is a substitute for the address Postfix is trying to resolve,
132
132
e.g.
133
 
.ti +4
134
 
query = SELECT replacement FROM aliases WHERE mailbox = '%s'
 
133
.nf
 
134
    query = SELECT replacement FROM aliases WHERE mailbox = '%s'
 
135
.fi
135
136
 
136
137
This parameter supports the following '%' expansions:
137
138
.RS
178
179
\fBadditional_conditions\fR. The mapping from the old parameters
179
180
to the equivalent query is:
180
181
 
181
 
.ti +4
182
 
SELECT [\fBselect_field\fR]
183
 
.ti +4
184
 
FROM [\fBtable\fR]
185
 
.ti +4
186
 
WHERE [\fBwhere_field\fR] = '%s'
187
 
.ti +10
188
 
[\fBadditional_conditions\fR]
 
182
.nf
 
183
    SELECT [\fBselect_field\fR]
 
184
    FROM [\fBtable\fR]
 
185
    WHERE [\fBwhere_field\fR] = '%s'
 
186
          [\fBadditional_conditions\fR]
 
187
.fi
189
188
 
190
189
The '%s' in the \fBWHERE\fR clause expands to the escaped search string.
191
190
With Postfix 2.2 these legacy parameters are used if the \fBquery\fR
241
240
are eligible for lookup: 'user' lookups, bare domain lookups
242
241
and "@domain" lookups are not performed. This can significantly
243
242
reduce the query load on the MySQL server.
244
 
.ti +4
245
 
domain = postfix.org, hash:/etc/postfix/searchdomains
 
243
.nf
 
244
    domain = postfix.org, hash:/etc/postfix/searchdomains
 
245
.fi
246
246
 
247
247
It is best not to use SQL to store the domains eligible
248
248
for SQL lookups.
258
258
temporary error if the limit is exceeded.  Setting the
259
259
limit to 1 ensures that lookups do not return multiple
260
260
values.
261
 
.PP
 
261
.SH "OBSOLETE QUERY INTERFACE"
 
262
.na
 
263
.nf
 
264
.ad
 
265
.fi
 
266
This section describes an interface that is deprecated as
 
267
of Postfix 2.2. It is replaced by the more general \fBquery\fR
 
268
interface described above.  If the \fBquery\fR parameter
 
269
is defined, the legacy parameters described here ignored.
 
270
Please migrate to the new interface as the legacy interface
 
271
may be removed in a future release.
 
272
 
262
273
The following parameters can be used to fill in a
263
274
SELECT template statement of the form:
264
275
 
265
 
.ti +4
266
 
SELECT [\fBselect_field\fR]
267
 
.ti +4
268
 
FROM [\fBtable\fR]
269
 
.ti +4
270
 
WHERE [\fBwhere_field\fR] = '%s'
271
 
.ti +10
272
 
[\fBadditional_conditions\fR]
 
276
.nf
 
277
    SELECT [\fBselect_field\fR]
 
278
    FROM [\fBtable\fR]
 
279
    WHERE [\fBwhere_field\fR] = '%s'
 
280
          [\fBadditional_conditions\fR]
 
281
.fi
273
282
 
274
283
The specifier %s is replaced by the search string, and is
275
284
escaped so if it contains single quotes or other odd characters,
276
285
it will not cause a parse error, or worse, a security problem.
277
 
 
278
 
As of Postfix 2.2 this interface is obsolete, it is replaced
279
 
by the more general \fBquery\fR interface described above.
280
 
If the \fBquery\fR parameter is defined, the legacy parameters
281
 
are ignored. Please migrate to the new interface as the legacy
282
 
interface may be removed in a future release.
283
286
.IP "\fBselect_field\fR"
284
287
The SQL "select" parameter. Example:
285
 
.ti +4
286
 
\fBselect_field\fR = forw_addr
 
288
.nf
 
289
    \fBselect_field\fR = forw_addr
 
290
.fi
287
291
.IP "\fBtable\fR"
288
292
The SQL "select .. from" table name. Example:
289
 
.ti +4
290
 
\fBtable\fR = mxaliases
 
293
.nf
 
294
    \fBtable\fR = mxaliases
 
295
.fi
291
296
.IP "\fBwhere_field\fR
292
297
The SQL "select .. where" parameter. Example:
293
 
.ti +4
294
 
\fBwhere_field\fR = alias
 
298
.nf
 
299
    \fBwhere_field\fR = alias
 
300
.fi
295
301
.IP "\fBadditional_conditions\fR
296
302
Additional conditions to the SQL query. Example:
297
 
.ti +4
298
 
\fBadditional_conditions\fR = AND status = 'paid'
 
303
.nf
 
304
    \fBadditional_conditions\fR = AND status = 'paid'
 
305
.fi
299
306
.SH "SEE ALSO"
300
307
.na
301
308
.nf