Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "DBI::ProxyServer 3" | |
132 | .TH DBI::ProxyServer 3 "2002-10-01" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | DBI::ProxyServer \- a server for the DBD::Proxy driver | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 2 | |
138 | \& use DBI::ProxyServer; | |
139 | \& DBI::ProxyServer::main(@ARGV); | |
140 | .Ve | |
141 | .SH "DESCRIPTION" | |
142 | .IX Header "DESCRIPTION" | |
143 | DBI::Proxy Server is a module for implementing a proxy for the \s-1DBI\s0 proxy | |
144 | driver, DBD::Proxy. It allows access to databases over the network if the | |
145 | \&\s-1DBMS\s0 does not offer networked operations. But the proxy server might be | |
146 | usefull for you, even if you have a \s-1DBMS\s0 with integrated network | |
147 | functionality: It can be used as a \s-1DBI\s0 proxy in a firewalled environment. | |
148 | .PP | |
149 | DBI::ProxyServer runs as a daemon on the machine with the \s-1DBMS\s0 or on the | |
150 | firewall. The client connects to the agent using the \s-1DBI\s0 driver DBD::Proxy, | |
151 | thus in the exactly same way than using DBD::mysql, DBD::mSQL or any other | |
152 | \&\s-1DBI\s0 driver. | |
153 | .PP | |
154 | The agent is implemented as a RPC::PlServer application. Thus you have | |
155 | access to all the possibilities of this module, in particular encryption | |
156 | and a similar configuration file. DBI::ProxyServer adds the possibility of | |
157 | query restrictions: You can define a set of queries that a client may | |
158 | execute and restrict access to those. (Requires a \s-1DBI\s0 driver that supports | |
159 | parameter binding.) See \*(L"\s-1CONFIGURATION\s0 \s-1FILE\s0\*(R". | |
160 | .SH "OPTIONS" | |
161 | .IX Header "OPTIONS" | |
162 | When calling the \fIDBI::ProxyServer::main()\fR function, you supply an | |
163 | array of options. (@ARGV, the array of command line options is used, | |
164 | if you don't.) These options are parsed by the Getopt::Long module. | |
165 | The ProxyServer inherits all of RPC::PlServer's and hence Net::Daemon's | |
166 | options and option handling, in particular the ability to read | |
167 | options from either the command line or a config file. See | |
168 | \&\fIRPC::PlServer\fR\|(3). See \fINet::Daemon\fR\|(3). Available options include | |
169 | .IP "\fIchroot\fR (\fB\-\-chroot=dir\fR)" 4 | |
170 | .IX Item "chroot (--chroot=dir)" | |
171 | (\s-1UNIX\s0 only) After doing a \fIbind()\fR, change root directory to the given | |
172 | directory by doing a \fIchroot()\fR. This is usefull for security, but it | |
173 | restricts the environment a lot. For example, you need to load \s-1DBI\s0 | |
174 | drivers in the config file or you have to create hard links to Unix | |
175 | sockets, if your drivers are using them. For example, with MySQL, a | |
176 | config file might contain the following lines: | |
177 | .Sp | |
178 | .Vb 9 | |
179 | \& my $rootdir = '/var/dbiproxy'; | |
180 | \& my $unixsockdir = '/tmp'; | |
181 | \& my $unixsockfile = 'mysql.sock'; | |
182 | \& foreach $dir ($rootdir, "$rootdir$unixsockdir") { | |
183 | \& mkdir 0755, $dir; | |
184 | \& } | |
185 | \& link("$unixsockdir/$unixsockfile", | |
186 | \& "$rootdir$unixsockdir/$unixsockfile"); | |
187 | \& require DBD::mysql; | |
188 | .Ve | |
189 | .Sp | |
190 | .Vb 4 | |
191 | \& { | |
192 | \& 'chroot' => $rootdir, | |
193 | \& ... | |
194 | \& } | |
195 | .Ve | |
196 | .Sp | |
197 | If you don't know \fIchroot()\fR, think of an \s-1FTP\s0 server where you can see a | |
198 | certain directory tree only after logging in. See also the \-\-group and | |
199 | \&\-\-user options. | |
200 | .IP "\fIclients\fR" 4 | |
201 | .IX Item "clients" | |
202 | An array ref with a list of clients. Clients are hash refs, the attributes | |
203 | \&\fIaccept\fR (0 for denying access and 1 for permitting) and \fImask\fR, a Perl | |
204 | regular expression for the clients \s-1IP\s0 number or its host name. See | |
205 | \&\*(L"Access control\*(R" below. | |
206 | .IP "\fIconfigfile\fR (\fB\-\-configfile=file\fR)" 4 | |
207 | .IX Item "configfile (--configfile=file)" | |
208 | Config files are assumed to return a single hash ref that overrides the | |
209 | arguments of the new method. However, command line arguments in turn take | |
210 | precedence over the config file. See the \*(L"\s-1CONFIGURATION\s0 \s-1FILE\s0\*(R" section | |
211 | below for details on the config file. | |
212 | .IP "\fIdebug\fR (\fB\-\-debug\fR)" 4 | |
213 | .IX Item "debug (--debug)" | |
214 | Turn debugging mode on. Mainly this asserts that logging messages of | |
215 | level \*(L"debug\*(R" are created. | |
216 | .IP "\fIfacility\fR (\fB\-\-facility=mode\fR)" 4 | |
217 | .IX Item "facility (--facility=mode)" | |
218 | (\s-1UNIX\s0 only) Facility to use for \*(L"Sys::Syslog (3)\*(R". The default is | |
219 | \&\fBdaemon\fR. | |
220 | .IP "\fIgroup\fR (\fB\-\-group=gid\fR)" 4 | |
221 | .IX Item "group (--group=gid)" | |
222 | After doing a \fIbind()\fR, change the real and effective \s-1GID\s0 to the given. | |
223 | This is usefull, if you want your server to bind to a privileged port | |
224 | (<1024), but don't want the server to execute as root. See also | |
225 | the \-\-user option. | |
226 | .Sp | |
227 | \&\s-1GID\s0's can be passed as group names or numeric values. | |
228 | .IP "\fIlocaladdr\fR (\fB\-\-localaddr=ip\fR)" 4 | |
229 | .IX Item "localaddr (--localaddr=ip)" | |
230 | By default a daemon is listening to any \s-1IP\s0 number that a machine | |
231 | has. This attribute allows to restrict the server to the given | |
232 | \&\s-1IP\s0 number. | |
233 | .IP "\fIlocalport\fR (\fB\-\-localport=port\fR)" 4 | |
234 | .IX Item "localport (--localport=port)" | |
235 | This attribute sets the port on which the daemon is listening. It | |
236 | must be given somehow, as there's no default. | |
237 | .IP "\fIlogfile\fR (\fB\-\-logfile=file\fR)" 4 | |
238 | .IX Item "logfile (--logfile=file)" | |
239 | Be default logging messages will be written to the syslog (Unix) or | |
240 | to the event log (Windows \s-1NT\s0). On other operating systems you need to | |
241 | specify a log file. The special value \*(L"\s-1STDERR\s0\*(R" forces logging to | |
242 | stderr. See \fINet::Daemon::Log\fR\|(3) for details. | |
243 | .IP "\fImode\fR (\fB\-\-mode=modename\fR)" 4 | |
244 | .IX Item "mode (--mode=modename)" | |
245 | The server can run in three different modes, depending on the environment. | |
246 | .Sp | |
247 | If you are running Perl 5.005 and did compile it for threads, then the | |
248 | server will create a new thread for each connection. The thread will | |
249 | execute the server's \fIRun()\fR method and then terminate. This mode is the | |
250 | default, you can force it with \*(L"\-\-mode=threads\*(R". | |
251 | .Sp | |
252 | If threads are not available, but you have a working \fIfork()\fR, then the | |
253 | server will behave similar by creating a new process for each connection. | |
254 | This mode will be used automatically in the absence of threads or if | |
255 | you use the \*(L"\-\-mode=fork\*(R" option. | |
256 | .Sp | |
257 | Finally there's a single-connection mode: If the server has accepted a | |
258 | connection, he will enter the \fIRun()\fR method. No other connections are | |
259 | accepted until the \fIRun()\fR method returns (if the client disconnects). | |
260 | This operation mode is usefull if you have neither threads nor \fIfork()\fR, | |
261 | for example on the Macintosh. For debugging purposes you can force this | |
262 | mode with \*(L"\-\-mode=single\*(R". | |
263 | .IP "\fIpidfile\fR (\fB\-\-pidfile=file\fR)" 4 | |
264 | .IX Item "pidfile (--pidfile=file)" | |
265 | (\s-1UNIX\s0 only) If this option is present, a \s-1PID\s0 file will be created at the | |
266 | given location. | |
267 | .IP "\fIuser\fR (\fB\-\-user=uid\fR)" 4 | |
268 | .IX Item "user (--user=uid)" | |
269 | After doing a \fIbind()\fR, change the real and effective \s-1UID\s0 to the given. | |
270 | This is usefull, if you want your server to bind to a privileged port | |
271 | (<1024), but don't want the server to execute as root. See also | |
272 | the \-\-group and the \-\-chroot options. | |
273 | .Sp | |
274 | \&\s-1UID\s0's can be passed as group names or numeric values. | |
275 | .IP "\fIversion\fR (\fB\-\-version\fR)" 4 | |
276 | .IX Item "version (--version)" | |
277 | Supresses startup of the server; instead the version string will | |
278 | be printed and the program exits immediately. | |
279 | .SH "CONFIGURATION FILE" | |
280 | .IX Header "CONFIGURATION FILE" | |
281 | The configuration file is just that of \fIRPC::PlServer\fR or \fINet::Daemon\fR | |
282 | with some additional attributes in the client list. | |
283 | .PP | |
284 | The config file is a Perl script. At the top of the file you may include | |
285 | arbitraty Perl source, for example load drivers at the start (usefull | |
286 | to enhance performance), prepare a chroot environment and so on. | |
287 | .PP | |
288 | The important thing is that you finally return a hash ref of option | |
289 | name/value pairs. The possible options are listed above. | |
290 | .PP | |
291 | All possibilities of Net::Daemon and RPC::PlServer apply, in particular | |
292 | .IP "Host and/or User dependent access control" 4 | |
293 | .IX Item "Host and/or User dependent access control" | |
294 | .PD 0 | |
295 | .IP "Host and/or User dependent encryption" 4 | |
296 | .IX Item "Host and/or User dependent encryption" | |
297 | .IP "Changing \s-1UID\s0 and/or \s-1GID\s0 after binding to the port" 4 | |
298 | .IX Item "Changing UID and/or GID after binding to the port" | |
299 | .IP "Running in a \fIchroot()\fR environment" 4 | |
300 | .IX Item "Running in a chroot() environment" | |
301 | .PD | |
302 | .PP | |
303 | Additionally the server offers you query restrictions. Suggest the | |
304 | following client list: | |
305 | .PP | |
306 | .Vb 14 | |
307 | \& 'clients' => [ | |
308 | \& { 'mask' => '^admin\e.company\e.com$', | |
309 | \& 'accept' => 1, | |
310 | \& 'users' => [ 'root', 'wwwrun' ], | |
311 | \& }, | |
312 | \& { | |
313 | \& 'mask' => '^admin\e.company\e.com$', | |
314 | \& 'accept' => 1, | |
315 | \& 'users' => [ 'root', 'wwwrun' ], | |
316 | \& 'sql' => { | |
317 | \& 'select' => 'SELECT * FROM foo', | |
318 | \& 'insert' => 'INSERT INTO foo VALUES (?, ?, ?)' | |
319 | \& } | |
320 | \& } | |
321 | .Ve | |
322 | .PP | |
323 | then only the users root and wwwrun may connect from admin.company.com, | |
324 | executing arbitrary queries, but only wwwrun may connect from other | |
325 | hosts and is restricted to | |
326 | .PP | |
327 | .Vb 1 | |
328 | \& $sth->prepare("select"); | |
329 | .Ve | |
330 | .PP | |
331 | or | |
332 | .PP | |
333 | .Vb 1 | |
334 | \& $sth->prepare("insert"); | |
335 | .Ve | |
336 | .PP | |
337 | which in fact are \*(L"\s-1SELECT\s0 * \s-1FROM\s0 foo\*(R" or \*(L"\s-1INSERT\s0 \s-1INTO\s0 foo \s-1VALUES\s0 (?, ?, ?)\*(R". | |
338 | .SH "AUTHOR" | |
339 | .IX Header "AUTHOR" | |
340 | .Vb 4 | |
341 | \& Copyright (c) 1997 Jochen Wiedmann | |
342 | \& Am Eisteich 9 | |
343 | \& 72555 Metzingen | |
344 | \& Germany | |
345 | .Ve | |
346 | .PP | |
347 | .Vb 2 | |
348 | \& Email: joe@ispsoft.de | |
349 | \& Phone: +49 7123 14881 | |
350 | .Ve | |
351 | .PP | |
352 | The DBI::ProxyServer module is free software; you can redistribute it | |
353 | and/or modify it under the same terms as Perl itself. In particular | |
354 | permission is granted to Tim Bunce for distributing this as a part of | |
355 | the \s-1DBI\s0. | |
356 | .SH "SEE ALSO" | |
357 | .IX Header "SEE ALSO" | |
358 | \&\fIdbiproxy\fR\|(1), \fIDBD::Proxy\fR\|(3), \s-1\fIDBI\s0\fR\|(3), \fIRPC::PlServer\fR\|(3), | |
359 | \&\fIRPC::PlClient\fR\|(3), \fINet::Daemon\fR\|(3), \fINet::Daemon::Log\fR\|(3), | |
360 | \&\fISys::Syslog\fR\|(3), \fIWin32::EventLog\fR\|(3), \fIsyslog\fR\|(2) |