⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proxyserver.html

📁 perl教程
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>DBI::ProxyServer - a server for the DBD::Proxy driver</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>DBI::ProxyServer - a server for the DBD::Proxy driver</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</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="#proxyserver_configuration_file__bigger_example_">Proxyserver Configuration file (bigger example)</a></li>
	<ul>

		<li><a href="#testing_the_connection_from_a_remote_machine">Testing the connection from a remote machine</a></li>
		<li><a href="#testing_the_connection_with_a_perlscript">Testing the connection with a perl-script</a></li>
		<li><a href="#how_the_configuration_works">How the configuration works</a></li>
		<li><a href="#problems">Problems</a></li>
	</ul>

	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>DBI::ProxyServer - a server for the DBD::Proxy driver</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">DBI::ProxyServer</span><span class="operator">;</span>
    <span class="variable">DBI::ProxyServer::main</span><span class="operator">(</span><span class="variable">@ARGV</span><span class="operator">);</span>
</pre>
<p>
</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>The provided driver script, <a href="../../bin/dbiproxy.html">the dbiproxy manpage</a>, may either be used as it is or
used as the basis for a local version modified to meet your needs.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<p>When calling the DBI::ProxyServer::main() function, you supply an
array of options. 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.html">the RPC::PlServer manpage</a>. See <a href="../../Net/Daemon.html">the Net::Daemon manpage</a>. Available options include</p>
<dl>
<dt><strong><a name="item_chroot"><em>chroot</em> (<strong>--chroot=dir</strong>)</a></strong>

<dd>
<p>(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:</p>
</dd>
<dd>
<pre>
    <span class="keyword">my</span> <span class="variable">$rootdir</span> <span class="operator">=</span> <span class="string">'/var/dbiproxy'</span><span class="operator">;</span>
    <span class="keyword">my</span> <span class="variable">$unixsockdir</span> <span class="operator">=</span> <span class="string">'/tmp'</span><span class="operator">;</span>
    <span class="keyword">my</span> <span class="variable">$unixsockfile</span> <span class="operator">=</span> <span class="string">'mysql.sock'</span><span class="operator">;</span>
    <span class="keyword">foreach</span> <span class="variable">$dir</span> <span class="operator">(</span><span class="variable">$rootdir</span><span class="operator">,</span> <span class="string">"$rootdir$unixsockdir"</span><span class="operator">)</span> <span class="operator">{</span>
        <span class="keyword">mkdir</span> <span class="number">0755</span><span class="operator">,</span> <span class="variable">$dir</span><span class="operator">;</span>
    <span class="operator">}</span>
    <span class="keyword">link</span><span class="operator">(</span><span class="string">"$unixsockdir/$unixsockfile"</span><span class="operator">,</span>
         <span class="string">"$rootdir$unixsockdir/$unixsockfile"</span><span class="operator">);</span>
    <span class="keyword">require</span> <span class="variable">DBD::mysql</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<pre>
    <span class="operator">{</span>
        <span class="string">'chroot'</span> <span class="operator">=&gt;</span> <span class="variable">$rootdir</span><span class="operator">,</span>
        <span class="operator">...</span>
    <span class="operator">}</span>
</pre>
</dd>
<dd>
<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>
</dd>
</li>
<dt><strong><a name="item_clients"><em>clients</em></a></strong>

<dd>
<p>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.</p>
</dd>
</li>
<dt><strong><a name="item_configfile"><em>configfile</em> (<strong>--configfile=file</strong>)</a></strong>

<dd>
<p>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>
</dd>
</li>
<dt><strong><a name="item_debug"><em>debug</em> (<strong>--debug</strong>)</a></strong>

<dd>
<p>Turn debugging mode on. Mainly this asserts that logging messages of
level &quot;debug&quot; are created.</p>
</dd>
</li>
<dt><strong><a name="item_facility"><em>facility</em> (<strong>--facility=mode</strong>)</a></strong>

<dd>
<p>(UNIX only) Facility to use for <a href="../../Sys/Syslog.html">the Sys::Syslog manpage</a>. The default is
<strong>daemon</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_group"><em>group</em> (<strong>--group=gid</strong>)</a></strong>

<dd>
<p>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
(&lt;1024), but don't want the server to execute as root. See also
the --user option.</p>
</dd>
<dd>
<p>GID's can be passed as group names or numeric values.</p>
</dd>
</li>
<dt><strong><a name="item_localaddr"><em>localaddr</em> (<strong>--localaddr=ip</strong>)</a></strong>

<dd>
<p>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>
</dd>
</li>
<dt><strong><a name="item_localport"><em>localport</em> (<strong>--localport=port</strong>)</a></strong>

<dd>
<p>This attribute sets the port on which the daemon is listening. It
must be given somehow, as there's no default.</p>
</dd>
</li>
<dt><strong><a name="item_logfile"><em>logfile</em> (<strong>--logfile=file</strong>)</a></strong>

<dd>
<p>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 &quot;STDERR&quot; forces logging to
stderr. See <a href="../../Net/Daemon/Log.html">the Net::Daemon::Log manpage</a> for details.</p>
</dd>
</li>
<dt><strong><a name="item_mode"><em>mode</em> (<strong>--mode=modename</strong>)</a></strong>

<dd>
<p>The server can run in three different modes, depending on the environment.</p>
</dd>
<dd>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -