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

📄 inetd.texi

📁 压缩包中包含LINUX下多个命令的源码
💻 TEXI
字号:
@node inetd@chapter inetd@cindex inetd@command{Inetd} program should be run at boot time by /etc/rc (see rc(8)).It then listens for connections on certain internet sockets.  When aconnection is found on one of its sockets, it decides what service the socketcorresponds to, and invokes a program to service the request.  The serverprogram is invoked with the service socket as its standard input, outputand error descriptors.  After the program is finished, inetd continues tolisten on the socket (except in some cases which will be described below).Essentially, inetd allows running one daemon to invoke several others,reducing load on the system.@section InvokingThe options are as follows:@table @samp@item -d@itemx --debug@opindex -d@opindex --debugTurns on debugging.@item -R @var{RATE}@itemx --rate=@var{RATE}@opindex --r@opindex --rateSpecifies the maximum number of times a service can be invoked inone minute; the default is 1000.@end table@section Configuration fileUpon execution, inetd reads its configuration information from a configurationpathnames on the command line, by default, @file{/etc/inetd.conf} and@file{/etc/initd.d}.  If the configuration pathname is a directory, all thefiles in the directory are read like a configuration file. All of theconfiguration files are read and merged.  There must be an entry for eachfield in the configuration file, with entries for each field separated by atab or a space.  Comments are denoted by a ``#'' at the beginning of a line.There must be an entry for each field.  The fields of the configurationfile are as follows:@example           service name           socket type           protocol           wait/nowait           user           server program           server program arguments@end exampleThere are two types of services that inetd can start: standard and TCPMUX.A standard service has a well-known port assigned to it; it may bea service that implements an official Internet standard or is a BSD-specificservice.  As described in RFC 1078, TCPMUX services are nonstandardservices that do not have a well-known port assigned to them.  They areinvoked from inetd when a program connects to the ``tcpmux'' well-knownport and specifies the service name.  This feature is useful for addinglocally-developed servers.The service-name entry is the name of a valid service in the file@file{/etc/services}. For ``internal'' services (discussed below), the servicename must be the official name of the service (that is, the first entryin @file{/etc/services}). For TCPMUX services, the value of the service-namefield consists of the string ``tcpmux'' followed by a slash and thelocally-chosen service name.  The service names listed in /etc/services andthe name ``help'' are reserved.  Try to choose unique names for your TCPMUXservices by prefixing them with your organization's name and suffixing themwith a version number.The socket-type should be one of ``stream'', ``dgram'', ``raw'', ``rdm'',or ``seqpacket'', depending on whether the socket is a stream, datagram,raw, reliably delivered message, or sequenced packet socket.  TCPMUX servicesmust use ``stream''.The protocol must be a valid protocol as given in /etc/protocols. Examplesmight be ``tcp'' or ``udp''. TCPMUX services must use ``tcp''.The wait/nowait entry specifies whether the server that is invoked by inetdwill take over the socket associated with the service access point,and thus whether inetd should wait for the server to exit before listeningfor new service requests.  Datagram servers must use ``wait'', asthey are always invoked with the original datagram socket bound to thespecified service address.  These servers must read at least one datagramfrom the socket before exiting.  If a datagram server connects to itspeer, freeing the socket so inetd can received further messages on thesocket, it is said to be a ``multi-threaded'' server; it should read onedatagram from the socket and create a new socket connected to the peer.It should fork, and the parent should then exit to allow inetd to checkfor new service requests to spawn new servers.  Datagram servers whichprocess all incoming datagrams on a socket and eventually time out aresaid to be ``single-threaded''. Comsat(8),  (biff(1))  and talkd(8) areboth examples of the latter type of datagram server.  Tftpd(8) is an exampleof a multi-threaded datagram server.Servers using stream sockets generally are multi-threaded and use the``nowait'' entry.  Connection requests for these services are accepted byinetd, and the server is given only the newly-accepted socket connectedto a client of the service.  Most stream-based services operate in thismanner.  Stream-based servers that use ``wait'' are started with thelistening service socket, and must accept at least one connection requestbefore exiting.  Such a server would normally accept and process incomingconnection requests until a timeout.  TCPMUX services must use ``nowait''.The user entry should contain the user name of the user as whom the servershould run.  This allows for servers to be given less permission than root.The server-program entry should contain the pathname of the program whichis to be executed by inetd when a request is found on its socket.  Ifinetd provides this service internally, this entry should be ``internal''.The server program arguments should be just as arguments normally are,starting with argv[0], which is the name of the program.  If the serviceis provided internally, the word ``internal'' should take the place ofthis entry.The inetd program provides several ``trivial'' services internally by useof routines within itself.  These services are ``echo'', ``discard'',``chargen'' (character generator), ``daytime'' (human readable time), and``time'' (machine readable time, in the form of the number of secondssince midnight, January 1, 1900).  All of these services are tcp based.For details of these services, consult the appropriate RFC from the NetworkInformation Center.The inetd program rereads its configuration file when it receives ahangup signal, SIGHUP. Services may be added, deleted or modified whenthe configuration file is reread.@section TCPMUXRFC 1078 describes the TCPMUX protocol: ``A TCP client connects to a foreignhost on TCP port 1.  It sends the service name followed by a carriage-returnline-feed <CRLF>.  The service name is never case sensitive.The server replies with a single character indicating positive (+) ornegative (-) acknowledgment, immediately followed by an optional messageof explanation, terminated with a <CRLF>.  If the reply was positive, theselected protocol begins; otherwise the connection is closed.''  The programis passed the TCP connection as file descriptors 0 and 1.If the TCPMUX service name begins with a ``+'', inetd returns the positivereply for the program.  This allows you to invoke programs that usestdin/stdout without putting any special server code in them.The special service name ``help'' causes inetd to list TCPMUX services in@file{inetd.conf}.@exampleHere are several example service entries for the various types ofservices:ftp           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/bin/phonebook   phonebook@end example@section Error MessagesThe inetd server logs error messages using syslog(3).  Important errormessages and their explanations are:@table @samp@item service/protocol server failing (looping), service terminated.The number of requests for the specified service in the past minute exceededthe limit. The limit exists to prevent a broken program or a malicious userfrom 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) amalicious user is running a program to invoke the service in a 'denial ofservice' attack, or 4) the invoked service program has an error that causesclients to retry quickly.  Use the [-R] option, as described above, to changethe rate limit.  Once the limit is reached, the service will be reenabledautomatically in 10 minutes.@item service/protocol: No such user 'user', service ignored@itemx service/protocol: getpwnam: user: No such userNo entry for user exists in the passwd file. The first message occurswhen inetd (re)reads the configuration file. The second message occurswhen the service is invoked.the service will be reenabled automatically in 10 minutes.@item service/protocol: No such user 'user', service ignored@itemx service/protocol: getpwnam: user: No such userNo entry for user exists in the passwd file. The first message occurswhen inetd (re)reads the configuration file. The second message occurswhen the service is invoked.@item service: can't set uid number@itemx service: can't set gid numberThe user or group ID for the entry's user is invalid.@end table

⌨️ 快捷键说明

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