mirror of
https://github.com/samhocevar/rinetd.git
synced 2024-12-28 05:40:31 +08:00
141 lines
12 KiB
HTML
141 lines
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html><head>
|
|
<title>rinetd man page</title>
|
|
<meta name="generator" content="roffit">
|
|
<STYLE type="text/css">
|
|
P.level0 {
|
|
padding-left: 2em;
|
|
}
|
|
|
|
P.level1 {
|
|
padding-left: 4em;
|
|
}
|
|
|
|
P.level2 {
|
|
padding-left: 6em;
|
|
}
|
|
|
|
span.emphasis {
|
|
font-style: italic;
|
|
}
|
|
|
|
span.bold {
|
|
font-weight: bold;
|
|
}
|
|
|
|
span.manpage {
|
|
font-weight: bold;
|
|
}
|
|
|
|
h2.nroffsh {
|
|
background-color: #e0e0e0;
|
|
}
|
|
|
|
span.nroffip {
|
|
font-weight: bold;
|
|
font-size: 120%;
|
|
font-family: monospace;
|
|
}
|
|
|
|
p.roffit {
|
|
text-align: center;
|
|
font-size: 80%;
|
|
}
|
|
</STYLE>
|
|
</head><body>
|
|
|
|
<p class="level0">
|
|
<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
|
|
<p class="level0">rinetd - internet redirection server
|
|
<p class="level0"><a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
|
|
<p class="level0"><span Class="bold">rinetd</span> [<span Class="bold">-f</span>] [<span Class="bold">-c</span> <span Class="emphasis">configuration</span>]
|
|
<p class="level0"><span Class="bold">rinetd -h</span>
|
|
<p class="level0"><span Class="bold">rinetd -v</span>
|
|
<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
|
|
<p class="level0">
|
|
<p class="level0"><span Class="bold">rinetd</span> redirects TCP or UDP connections from one IP address and port to another. <span Class="bold">rinetd</span> is a single-process server which handles any number of connections to the address/port pairs specified in the file <span Class="emphasis">/etc/rinetd.conf</span>. Since <span Class="bold">rinetd</span> runs as a single process using nonblocking I/O, it is able to redirect a large number of connections without a severe impact on the machine. This makes it practical to run services on machines inside an IP masquerading firewall.
|
|
<p class="level0"><span Class="bold">rinetd</span> is typically launched at boot time, using the following syntax:
|
|
<p class="level0"><span Class="bold"> /usr/sbin/rinetd</span>
|
|
<p class="level0">The configuration file is found in the file <span Class="emphasis">/etc/rinetd.conf</span>, unless another file is specified using the <span Class="bold">-c</span> command line option.
|
|
<p class="level0"><a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2>
|
|
<p class="level0">
|
|
<p class="level0"><span Class="bold">-f</span> Run <span Class="bold">rinetd</span> in the foreground, without forking to the background.
|
|
<p class="level0"><span Class="bold">-c</span> <span Class="emphasis">configuration</span> Specify an alternate configuration file.
|
|
<p class="level0"><span Class="bold">-v</span> Display the version number and exit.
|
|
<p class="level0"><span Class="bold">-h</span> Produce a short help message and exit.
|
|
<p class="level0"><a name="FORWARDING"></a><h2 class="nroffsh">FORWARDING RULES</h2>
|
|
<p class="level0">
|
|
<p class="level0">Most entries in the configuration file are forwarding rules. The format of a forwarding rule is as follows:
|
|
<p class="level0"><span Class="bold"> bindaddress bindport connectaddress connectport [options...]</span>
|
|
<p class="level0">For example:
|
|
<p class="level0"><span Class="bold"> 206.125.69.81 80 10.1.1.2 80</span>
|
|
<p class="level0">Would redirect all connections to port 80 of the "real" IP address 206.125.69.81, which could be a virtual interface, through <span Class="bold">rinetd</span> to port 80 of the address 10.1.1.2, which would typically be a machine on the inside of a firewall which has no direct routing to the outside world.
|
|
<p class="level0">
|
|
<p class="level0">is one of <span Class="bold">rinetd</span>'s primary features, sometimes it is preferable to respond on all IP addresses that belong to the server. In this situation, the special IP address 0.0.0.0 can be used. For example:
|
|
<p class="level0">
|
|
<p class="level0"><span Class="bold"> 0.0.0.0 23 10.1.1.2 23</span>
|
|
<p class="level0">Would redirect all connections to port 23, for all IP addresses assigned to the server. This is the default behavior for most other programs.
|
|
<p class="level0">Ports default to TCP. To specify the protocol, append <span Class="emphasis">/udp</span> or <span Class="emphasis">/tcp</span> to the port number:
|
|
<p class="level0"><span Class="bold"> 206.125.69.81 80/tcp 10.1.1.2 8000/udp</span>
|
|
<p class="level0">Service names can be specified instead of port numbers. On most systems, service names are defined in the file <span Class="emphasis">/etc/services</span>.
|
|
<p class="level0">Both IP addresses and hostnames are accepted for bindaddress and connectaddress, including IPv6.
|
|
<p class="level0">
|
|
<p class="level0"><a name="UDP"></a><h2 class="nroffsh">UDP timeout option</h2>
|
|
<p class="level0">Since UDP is a connectionless protocol, a timeout is necessary or forwarding connections may accumulate with time and exhaust resources. By default, if no data is sent or received on a UDP connection for 72 seconds, the other connection is closed. This value can be changed using the <span Class="emphasis">timeout</span> option:
|
|
<p class="level0"><span Class="bold"> 0.0.0.0 8000/udp 10.1.1.2 80 [timeout=3600]</span>
|
|
<p class="level0">This rule will forward all data received on UDP port 8000 to host 10.1.1.2 on TCP port 80, and will close the connection after no data is received on the UDP port for 3600 seconds.
|
|
<p class="level0"><a name="Source"></a><h2 class="nroffsh">Source address option</h2>
|
|
<p class="level0">A forwarding rule option allows to bind to a specific local address when sending data to the other end. This is done using the <span Class="emphasis">src</span> option:
|
|
<p class="level0"><span Class="bold"> 192.168.1.1 80 10.1.1.127 80 [src=10.1.1.2]</span>
|
|
<p class="level0">Assuming the local host has two IP addresses, 10.1.1.1 and 10.1.1.2, this rule ensures that forwarded packets are sent using source address 10.1.1.2.
|
|
<p class="level0"><a name="ALLOW"></a><h2 class="nroffsh">ALLOW AND DENY RULES</h2>
|
|
<p class="level0">Configuration files can also contain allow and deny rules.
|
|
<p class="level0">Allow rules which appear before the first forwarding rule are applied globally: if at least one global allow rule exists, and the address of a new connection does not satisfy at least one of the global allow rules, that connection is immediately rejected, regardless of any other rules.
|
|
<p class="level0">Allow rules which appear after a specific forwarding rule apply to that forwarding rule only. If at least one allow rule exists for a particular forwarding rule, and the address of a new connection does not satisfy at least one of the allow rules for that forwarding rule, that connection is immediately rejected, regardless of any other rules.
|
|
<p class="level0">Deny rules which appear before the first forwarding rule are applied globally: if the address of a new connection satisfies any of the global deny rules, that connection is immediately rejected, regardless of any other rules.
|
|
<p class="level0">Deny rules which appear after a specific forwarding rule apply to that forwarding rule only. If the address of a new connection satisfies any of the deny rules for that forwarding rule, that connection is immediately rejected, regardless of any other rules.
|
|
<p class="level0">The format of an allow rule is as follows:
|
|
<p class="level0"><span Class="bold"> allow|deny pattern</span>
|
|
<p class="level0">Patterns can contain the following characters: <span Class="bold">0</span>, <span Class="bold">1</span>, <span Class="bold">2</span>, <span Class="bold">3</span>, <span Class="bold">4</span>, <span Class="bold">5</span>, <span Class="bold">6</span>, <span Class="bold">7</span>, <span Class="bold">8</span>, <span Class="bold">9</span>, <span Class="bold">.</span> (period), <span Class="bold">?</span>, and <span Class="bold">*</span>. The <span Class="bold">?</span> wildcard matches any one character. The <span Class="bold">*</span> wildcard matches any number of characters, including zero.
|
|
<p class="level0">For example:
|
|
<p class="level0"><span Class="bold"> allow 206.125.69.*</span>
|
|
<p class="level0">This allow rule matches all IP addresses in the 206.125.69 class C domain.
|
|
<p class="level0">Host names are NOT permitted in allow and deny rules. The performance cost of looking up IP addresses to find their corresponding names is prohibitive. Since <span Class="bold">rinetd</span> is a single process server, all other connections would be forced to pause during the address lookup.
|
|
<p class="level0"><a name="LOGGING"></a><h2 class="nroffsh">LOGGING</h2>
|
|
<p class="level0"><span Class="bold">rinetd</span> is able to produce a log file in either of two formats: tab-delimited and web server-style "common log format".
|
|
<p class="level0">By default, <span Class="bold">rinetd</span> does not produce a log file. To activate logging, add the following line to the configuration file:
|
|
<p class="level0"><span Class="bold"> logfile log-file-location</span>
|
|
<p class="level0">Example:
|
|
<p class="level0"><span Class="bold"> logfile /var/log/rinetd.log</span>
|
|
<p class="level0">By default, <span Class="bold">rinetd</span> logs in a simple tab-delimited format containing the following information:
|
|
<p class="level0"> Date and time
|
|
<p class="level0"> Client address
|
|
<p class="level0"> Listening host
|
|
<p class="level0"> Listening port
|
|
<p class="level0"> Forwarded-to host
|
|
<p class="level0"> Forwarded-to port
|
|
<p class="level0"> Bytes received from client
|
|
<p class="level0"> Bytes sent to client
|
|
<p class="level0"> Result message
|
|
<p class="level0">To activate web server-style "common log format" logging, add the following line to the configuration file:
|
|
<p class="level0"><span Class="bold"> logcommon</span>
|
|
<p class="level0"><a name="REINITIALIZING"></a><h2 class="nroffsh">REINITIALIZING RINETD</h2>
|
|
<p class="level0">
|
|
<p class="level0">The <span Class="bold">kill -1</span> signal (<span Class="emphasis">SIGHUP</span>) can be used to cause <span Class="bold">rinetd</span> to reload its configuration file without interrupting existing connections.
|
|
<p class="level0">Under Linux(tm the process id is saved in the file <span Class="emphasis">/var/run/rinetd.pid</span> to facilitate the <span Class="bold">kill -HUP</span>. An alternate filename can be provided by using the pidlogfile configuration file option.
|
|
<p class="level0"><a name="BUGS"></a><h2 class="nroffsh">BUGS AND LIMITATIONS</h2>
|
|
<p class="level0">
|
|
<p class="level0"><span Class="bold">rinetd</span> only redirects protocols which use a single TCP or UDP socket. This rules out FTP.
|
|
<p class="level0">The server redirected to is not able to identify the host the client really came from. This cannot be corrected; however, the log produced by <span Class="bold">rinetd</span> provides a way to obtain this information. Under Unix, Sockets would theoretically lose data when closed with SO_LINGER turned off, but in Linux this is not the case (kernel source comments support this belief on my part). On non-Linux Unix platforms, alternate code which uses a different trick to work around blocking close() is provided, but this code is untested.
|
|
<p class="level0">The logging is inadequate. The duration of each connection should be logged. <a name="LICENSE"></a><h2 class="nroffsh">LICENSE</h2>
|
|
<p class="level0">Copyright (c) 1997, 1998, 1999, Thomas Boutell and Boutell.Com, Inc.
|
|
<p class="level0">Copyright (c) 2003-2021 Sam Hocevar
|
|
<p class="level0">This software is released for free use under the terms of the GNU General Public License, version 2 or higher. NO WARRANTY IS EXPRESSED OR IMPLIED. USE THIS SOFTWARE AT YOUR OWN RISK. <a name="CONTACT"></a><h2 class="nroffsh">CONTACT INFORMATION</h2>
|
|
<p class="level0">See https://github.com/samhocevar/rinetd/releases for the latest release.
|
|
<p class="level0">Thomas Boutell can be reached by email: boutell@boutell.com
|
|
<p class="level0">Sam Hocevar can be reached by email: sam@hocevar.net <a name="THANKS"></a><h2 class="nroffsh">THANKS</h2>
|
|
<p class="level0">Thanks are due to Bill Davidsen, Libor Pechachek, Sascha Ziemann, the Apache Group, and many others who have contributed advice and/or source code to this and other free software projects. <p class="roffit">
|
|
This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
|
|
</body></html>
|