home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>DBI::ProxyServer - a server for the DBD::Proxy driver</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> DBI::ProxyServer - a server for the DBD::Proxy driver</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#options">OPTIONS</A></LI>
- <LI><A HREF="#configuration file">CONFIGURATION FILE</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>DBI::ProxyServer - a server for the DBD::Proxy driver</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use DBI::ProxyServer;
- DBI::ProxyServer::main(@ARGV);</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>DBI::Proxy Server is a module for implementing a proxy for the DBI proxy
- driver, DBD::Proxy. It allows access to databases over the network if the
- DBMS does not offer networked operations. But the proxy server might be
- usefull for you, even if you have a DBMS with integrated network
- functionality: It can be used as a DBI proxy in a firewalled environment.</P>
- <P>DBI::ProxyServer runs as a daemon on the machine with the DBMS or on the
- firewall. The client connects to the agent using the DBI driver DBD::Proxy,
- thus in the exactly same way than using DBD::mysql, DBD::mSQL or any other
- DBI driver.</P>
- <P>The agent is implemented as a RPC::PlServer application. Thus you have
- access to all the possibilities of this module, in particular encryption
- and a similar configuration file. DBI::ProxyServer adds the possibility of
- query restrictions: You can define a set of queries that a client may
- execute and restrict access to those. (Requires a DBI driver that supports
- parameter binding.) See <A HREF="#configuration file">CONFIGURATION FILE</A>.</P>
- <P>
- <HR>
- <H1><A NAME="options">OPTIONS</A></H1>
- <P>When calling the DBI::ProxyServer::main() function, you supply an
- array of options. (@ARGV, the array of command line options is used,
- if you don't.) These options are parsed by the Getopt::Long module.
- The ProxyServer inherits all of RPC::PlServer's and hence Net::Daemon's
- options and option handling, in particular the ability to read
- options from either the command line or a config file. See
- <A HREF="../../../RPC/PlServer(3).html">the RPC::PlServer(3) manpage</A>. See <A HREF="../../../Net/Daemon(3).html">the Net::Daemon(3) manpage</A>. Available options include</P>
- <DL>
- <DT><STRONG><A NAME="item_chroot"><EM>chroot</EM> (<STRONG>--chroot=dir</STRONG>)</A></STRONG><BR>
- <DD>
- (UNIX only) After doing a bind(), change root directory to the given
- directory by doing a chroot(). This is usefull for security, but it
- restricts the environment a lot. For example, you need to load DBI
- drivers in the config file or you have to create hard links to Unix
- sockets, if your drivers are using them. For example, with MySQL, a
- config file might contain the following lines:
- <PRE>
- my $rootdir = '/var/dbiproxy';
- my $unixsockdir = '/tmp';
- my $unixsockfile = 'mysql.sock';
- foreach $dir ($rootdir, "$rootdir$unixsockdir") {
- mkdir 0755, $dir;
- }
- link("$unixsockdir/$unixsockfile",
- "$rootdir$unixsockdir/$unixsockfile");
- require DBD::mysql;</PRE>
- <PRE>
- {
- 'chroot' => $rootdir,
- ...
- }</PRE>
- <P>If you don't know chroot(), think of an FTP server where you can see a
- certain directory tree only after logging in. See also the --group and
- --user options.</P>
- <P></P>
- <DT><STRONG><A NAME="item_clients"><EM>clients</EM></A></STRONG><BR>
- <DD>
- An array ref with a list of clients. Clients are hash refs, the attributes
- <EM>accept</EM> (0 for denying access and 1 for permitting) and <EM>mask</EM>, a Perl
- regular expression for the clients IP number or its host name. See
- <A HREF="#access control">Access control</A> below.
- <P></P>
- <DT><STRONG><A NAME="item_configfile"><EM>configfile</EM> (<STRONG>--configfile=file</STRONG>)</A></STRONG><BR>
- <DD>
- Config files are assumed to return a single hash ref that overrides the
- arguments of the new method. However, command line arguments in turn take
- precedence over the config file. See the <A HREF="#configuration file">CONFIGURATION FILE</A> section
- below for details on the config file.
- <P></P>
- <DT><STRONG><A NAME="item_debug"><EM>debug</EM> (<STRONG>--debug</STRONG>)</A></STRONG><BR>
- <DD>
- Turn debugging mode on. Mainly this asserts that logging messages of
- level ``debug'' are created.
- <P></P>
- <DT><STRONG><A NAME="item_facility"><EM>facility</EM> (<STRONG>--facility=mode</STRONG>)</A></STRONG><BR>
- <DD>
- (UNIX only) Facility to use for <A HREF="#sys::syslog (3)">Sys::Syslog (3)</A>. The default is
- <STRONG>daemon</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_group"><EM>group</EM> (<STRONG>--group=gid</STRONG>)</A></STRONG><BR>
- <DD>
- After doing a bind(), change the real and effective GID to the given.
- This is usefull, if you want your server to bind to a privileged port
- (<1024), but don't want the server to execute as root. See also
- the --user option.
- <P>GID's can be passed as group names or numeric values.</P>
- <P></P>
- <DT><STRONG><A NAME="item_localaddr"><EM>localaddr</EM> (<STRONG>--localaddr=ip</STRONG>)</A></STRONG><BR>
- <DD>
- By default a daemon is listening to any IP number that a machine
- has. This attribute allows to restrict the server to the given
- IP number.
- <P></P>
- <DT><STRONG><A NAME="item_localport"><EM>localport</EM> (<STRONG>--localport=port</STRONG>)</A></STRONG><BR>
- <DD>
- This attribute sets the port on which the daemon is listening. It
- must be given somehow, as there's no default.
- <P></P>
- <DT><STRONG><A NAME="item_logfile"><EM>logfile</EM> (<STRONG>--logfile=file</STRONG>)</A></STRONG><BR>
- <DD>
- Be default logging messages will be written to the syslog (Unix) or
- to the event log (Windows NT). On other operating systems you need to
- specify a log file. The special value ``STDERR'' forces logging to
- stderr. See <A HREF="../../../Net/Daemon/Log(3).html">the Net::Daemon::Log(3) manpage</A> for details.
- <P></P>
- <DT><STRONG><A NAME="item_mode"><EM>mode</EM> (<STRONG>--mode=modename</STRONG>)</A></STRONG><BR>
- <DD>
- The server can run in three different modes, depending on the environment.
- <P>If you are running Perl 5.005 and did compile it for threads, then the
- server will create a new thread for each connection. The thread will
- execute the server's <CODE>Run()</CODE> method and then terminate. This mode is the
- default, you can force it with ``--mode=threads''.</P>
- <P>If threads are not available, but you have a working fork(), then the
- server will behave similar by creating a new process for each connection.
- This mode will be used automatically in the absence of threads or if
- you use the ``--mode=fork'' option.</P>
- <P>Finally there's a single-connection mode: If the server has accepted a
- connection, he will enter the <CODE>Run()</CODE> method. No other connections are
- accepted until the <CODE>Run()</CODE> method returns (if the client disconnects).
- This operation mode is usefull if you have neither threads nor fork(),
- for example on the Macintosh. For debugging purposes you can force this
- mode with ``--mode=single''.</P>
- <P></P>
- <DT><STRONG><A NAME="item_pidfile"><EM>pidfile</EM> (<STRONG>--pidfile=file</STRONG>)</A></STRONG><BR>
- <DD>
- (UNIX only) If this option is present, a PID file will be created at the
- given location.
- <P></P>
- <DT><STRONG><A NAME="item_user"><EM>user</EM> (<STRONG>--user=uid</STRONG>)</A></STRONG><BR>
- <DD>
- After doing a bind(), change the real and effective UID to the given.
- This is usefull, if you want your server to bind to a privileged port
- (<1024), but don't want the server to execute as root. See also
- the --group and the --chroot options.
- <P>UID's can be passed as group names or numeric values.</P>
- <P></P>
- <DT><STRONG><A NAME="item_version"><EM>version</EM> (<STRONG>--version</STRONG>)</A></STRONG><BR>
- <DD>
- Supresses startup of the server; instead the version string will
- be printed and the program exits immediately.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="configuration file">CONFIGURATION FILE</A></H1>
- <P>The configuration file is just that of <EM>RPC::PlServer</EM> or <EM>Net::Daemon</EM>
- with some additional attributes in the client list.</P>
- <P>The config file is a Perl script. At the top of the file you may include
- arbitraty Perl source, for example load drivers at the start (usefull
- to enhance performance), prepare a chroot environment and so on.</P>
- <P>The important thing is that you finally return a hash ref of option
- name/value pairs. The possible options are listed above.</P>
- <P>All possibilities of Net::Daemon and RPC::PlServer apply, in particular</P>
- <DL>
- <DT><STRONG><A NAME="item_Host_and%2For_User_dependent_access_control">Host and/or User dependent access control</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Host_and%2For_User_dependent_encryption">Host and/or User dependent encryption</A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Changing_UID_and%2For_GID_after_binding_to_the_por">Changing UID and/or GID after binding to the port</A></STRONG><BR>
- <DD>
- <DT><STRONG>Running in a <CODE>chroot()</CODE> environment</STRONG><BR>
- <DD>
- </DL>
- <P>Additionally the server offers you query restrictions. Suggest the
- following client list:</P>
- <PRE>
- 'clients' => [
- { 'mask' => '^admin\.company\.com$',
- 'accept' => 1,
- 'users' => [ 'root', 'wwwrun' ],
- },
- {
- 'mask' => '^admin\.company\.com$',
- 'accept' => 1,
- 'users' => [ 'root', 'wwwrun' ],
- 'sql' => {
- 'select' => 'SELECT * FROM foo',
- 'insert' => 'INSERT INTO foo VALUES (?, ?, ?)'
- }
- }</PRE>
- <P>then only the users root and wwwrun may connect from admin.company.com,
- executing arbitrary queries, but only wwwrun may connect from other
- hosts and is restricted to</P>
- <PRE>
- $sth->prepare("select");</PRE>
- <P>or</P>
- <PRE>
- $sth->prepare("insert");</PRE>
- <P>which in fact are ``SELECT * FROM foo'' or ``INSERT INTO foo VALUES (?, ?, ?)''.</P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <PRE>
- Copyright (c) 1997 Jochen Wiedmann
- Am Eisteich 9
- 72555 Metzingen
- Germany</PRE>
- <PRE>
- Email: joe@ispsoft.de
- Phone: +49 7123 14881</PRE>
- <P>The DBI::ProxyServer module is free software; you can redistribute it
- and/or modify it under the same terms as Perl itself. In particular
- permission is granted to Tim Bunce for distributing this as a part of
- the DBI.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><EM>dbiproxy(1)</EM>, <A HREF="../../../DBD/Proxy(3).html">the DBD::Proxy(3) manpage</A>, <EM>DBI(3)</EM>, <A HREF="../../../RPC/PlServer(3).html">the RPC::PlServer(3) manpage</A>,
- <A HREF="../../../RPC/PlClient(3).html">the RPC::PlClient(3) manpage</A>, <A HREF="../../../Net/Daemon(3).html">the Net::Daemon(3) manpage</A>, <A HREF="../../../Net/Daemon/Log(3).html">the Net::Daemon::Log(3) manpage</A>,
- <A HREF="../../../Sys/Syslog(3).html">the Sys::Syslog(3) manpage</A>, <A HREF="../../../Win32/EventLog(3).html">the Win32::EventLog(3) manpage</A>, <EM>syslog(2)</EM></P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> DBI::ProxyServer - a server for the DBD::Proxy driver</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-