📄 inetd.8
字号:
.\" Copyright (c) 1985, 1991, 1993, 1994.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)inetd.8 8.4 (Berkeley) 6/1/94.\".Dd June 1, 1994.Dt INETD 8.Os BSD 4.4.Sh NAME.Nm inetd.Nd internet.Dq super-server.Sh SYNOPSIS.Nm inetd.Op Fl d.Op Fl R Ar rate.Op Ar configuration_files ....Sh DESCRIPTIONThe.Nm inetdprogramshould be run at boot time by.Pa /etc/rc(see.Xr rc 8 ) .It then listens for connections on certaininternet sockets. When a connection is found on oneof its sockets, it decides what service the socketcorresponds to, and invokes a program to service the request.The server program is invoked with the service socketas its standard input, output and error descriptors.After the program isfinished,.Nm inetdcontinues to listen on the socket (except in some cases whichwill be described below). Essentially,.Nm inetdallows running one daemon to invoke several others,reducing load on the system..PpThe options available for.Nm inetd:.Bl -tag -width Ds.It Fl d, --debugTurns on debugging..It Fl R, --rate Ar rateSpecifies the maximum number of times a service can be invokedin one minute; the default is 1000..It Fl --versionShows the version..It Fl --helpShows the help..El.PpUpon execution,.Nm inetdreads its configuration information from a configurationpathnames on the command line, by default,.Pa /etc/inetd.conf and /etc/initd.d .If the configuration pathname is a directory, all the files in thedirectory are read like a configuration file. All of the configurationfiles are read and merged.There must be an entry for each field in the configurationfile, with entries for each field separated by a tab ora space. Comments are denoted by a ``#'' at the beginningof a line. There must be an entry for each field. Thefields of the configuration file are as follows:.Pp.Bd -unfilled -offset indent -compactservice namesocket typeprotocolwait/nowaituserserver programserver program arguments.Ed.PpThere are two types of services that.Nm inetdcan start: standard and TCPMUX.A standard service has a well-known port assigned to it;it may be a service that implements an official Internet standard or is aBSD-specific service.As described in.Tn RFC 1078 ,TCPMUX services are nonstandard services that do not have awell-known port assigned to them.They are invoked from.Nm inetdwhen a program connects to the.Dq tcpmuxwell-known port and specifiesthe service name.This feature is useful for adding locally-developed servers..PpThe.Em service-nameentry is the name of a valid service inthe file.Pa /etc/services .For.Dq internalservices (discussed below), the servicename.Em mustbe the official name of the service (that is, the first entry in.Pa /etc/services ) .For TCPMUX services, the value of the.Em service-namefield consists of the string.Dq tcpmuxfollowed by a slash and thelocally-chosen service name.The service names listed in.Pa /etc/servicesand the name.Dq helpare reserved.Try to choose unique names for your TCPMUX services by prefixing them withyour organization's name and suffixing them with a version number..PpThe.Em socket-typeshould be one of.Dq stream ,.Dq dgram ,.Dq raw ,.Dq rdm ,or.Dq seqpacket ,depending on whether the socket is a stream, datagram, raw,reliably delivered message, or sequenced packet socket.TCPMUX services must use.Dq stream ..PpThe.Em protocolmust be a valid protocol as given in.Pa /etc/protocols .Examples might be.Dq tcpor.Dq udp .TCPMUX services must use.Dq tcp ..PpThe.Em wait/nowaitentry specifies whether the server that is invoked by inetd will take overthe socket associated with the service access point, and thus whether.Nm inetdshould wait for the server to exit before listening for new servicerequests.Datagram servers must use.Dq wait ,as they are always invoked with the original datagram socket boundto the specified service address.These servers must read at least one datagram from the socketbefore exiting.If a datagram server connectsto its peer, freeing the socket so.Nm inetdcan received further messages on the socket, it is said to bea.Dq multi-threadedserver;it should read one datagram from the socket and create a new socketconnected to the peer.It should fork, and the parent should then exitto allow.Nm inetdto check for new service requests to spawn new servers.Datagram servers which process all incoming datagramson a socket and eventually time out are said to be.Dq single-threaded ..Xr Comsat 8 ,.Pq Xr biff 1and.Xr talkd 8are both examples of the latter type ofdatagram server..Xr Tftpd 8is an example of a multi-threaded datagram server..PpServers using stream sockets generally are multi-threaded anduse the.Dq nowaitentry.Connection requests for these services are accepted by.Nm inetd ,and the server is given only the newly-accepted socket connectedto a client of the service.Most stream-based services operate in this manner.Stream-based servers that use.Dq waitare started with the listening service socket, and must acceptat least one connection request before exiting.Such a server would normally accept and process incoming connectionrequests until a timeout.TCPMUX services must use.Dq nowait ..PpThe.Em userentry should contain the user name of the user as whom the servershould run. This allows for servers to be given less permissionthan root..PpThe.Em server-programentry should contain the pathname of the program which is to beexecuted by.Nm inetdwhen a request is found on its socket. If.Nm inetdprovides this service internally, this entry shouldbe.Dq internal ..PpThe.Em server program argumentsshould be just as argumentsnormally are, starting with argv[0], which is the name ofthe program. If the service is provided internally, theword.Dq internalshould take the place of this entry..PpThe.Nm inetdprogramprovides several.Dq trivialservices internally by use ofroutines within itself. These services are.Dq echo ,.Dq discard ,.Dq chargen(character generator),.Dq daytime(human readable time), and.Dq time(machine readable time,in the form of the number of seconds since midnight, January1, 1900). All of these services are tcp based. Fordetails of these services, consult the appropriate.Tn RFCfrom the Network Information Center..PpThe.Nm inetdprogramrereads its configuration file when it receives a hangup signal,.Dv SIGHUP .Services may be added, deleted or modified when the configuration fileis reread..Sh TCPMUX.Pp.Tn RFC 1078describes the TCPMUX protocol:``A TCP client connects to a foreign host on TCP port 1. It sends theservice name followed by a carriage-return line-feed <CRLF>. Theservice name is never case sensitive. The server replies with asingle character indicating positive (+) or negative (\-)acknowledgment, immediately followed by an optional message ofexplanation, terminated with a <CRLF>. If the reply was positive,the selected protocol begins; otherwise the connection is closed.''The program is passed the TCP connection as file descriptors 0 and 1..PpIf the TCPMUX service name begins with a ``+'',.Nm inetdreturns the positive reply for the program.This allows you to invoke programs that use stdin/stdoutwithout putting any special server code in them..PpThe special service name.Dq helpcauses.Nm inetdto list TCPMUX services in.Pa inetd.conf ..ne 1i.Sh "EXAMPLES".PpHere are several example service entries for the various types of services:.Bd -literalftp stream tcp nowait root /usr/libexec/ftpd ftpd -lntalk dgram udp wait root /usr/libexec/ntalkd ntalkdtcpmux/+date stream tcp nowait guest /bin/date datetcpmux/phonebook stream tcp nowait guest /usr/local/bin/phonebook phonebook.Ed.Sh "ERROR MESSAGES"The.Nm inetdserverlogs error messages using.Xr syslog 3 .Important error messages and their explanations are:.Bd -literal\fIservice\fP/\fIprotocol\fP server failing (looping), service terminated..EdThe number of requests for the specified service in the past minuteexceeded the limit. The limit exists to prevent a broken programor a malicious user from swamping the system.This message may occur for several reasons:1) there are lots of hosts requesting the service within a short time period,2) a 'broken' client program is requesting the service too frequently,3) a malicious user is running a program to invoke the service ina 'denial of service' attack, or4) the invoked service program has an error that causes clientsto retry quickly.Use the.Op Fl Roption,as described above, to change the rate limit.Once the limit is reached, the service will bereenabled automatically in 10 minutes..sp.Bd -literal\fIservice\fP/\fIprotocol\fP: No such user '\fIuser\fP', service ignored\fIservice\fP/\fIprotocol\fP: getpwnam: \fIuser\fP: No such user.EdNo entry for.Em userexists in the.Pa passwdfile. The first messageoccurs when.Nm inetd(re)reads the configuration file. The second message occurs when theservice is invoked..sp.Bd -literal\fIservice\fP: can't set uid \fInumber\fP\fIservice\fP: can't set gid \fInumber\fP.EdThe user or group ID for the entry's.Em useris invalid..Sh SEE ALSO.Xr comsat 8 ,.Xr fingerd 8 ,.Xr ftpd 8 ,.Xr rexecd 8 ,.Xr rlogind 8 ,.Xr rshd 8 ,.Xr telnetd 8 ,.Xr tftpd 8.Sh HISTORYThe.Nmcommand appeared in.Bx 4.3 .TCPMUX is based on code and documentation by Mark Lottor.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -