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!#(B
  • xinetd --- $B:G6a!"$h$/;H$o$l$F$$$F!"(BFedora Core (RedHat) Linux $B$G$b$3$A$i$,I8=`$K$J$C$F$$$^$9!#(B $B%]!<%HHV9fKh$K$$$m$$$m$J%"%/%;%9@)8f$,$G$-$^$9!#(B $B$?$@$7!"(BRedHat7.0.1$B$KIUB0$7$F$$$?%P!<%8%g%s$K$O(B $B%;%-%e%j%F%#%[!<%k$,8+IU$+$C$?$j$7$F$$$^$9$N$G!"(B $B$$$D$b:G?7HG$r;H$&$h$&$KCm0U$,I,MW$G$9(B ($B%M%C%H%o!<%/4X78$N%=%U%H$K$OA4$FEv$F$O$^$k;v$G$9$,(B)$B!#(B

    inetd

    $B%]!<%H4F;kMQ%G!<%b%s$H$7$F$h$/MxMQ$5$l$F$$$?$N$,(B inetd $B$G$9!#(B inetd$B$N@_Dj$O(B /etc/inetd.conf $B$G9T$J$$$^$9!#(B

    /etc/inetd.conf $B$rJQ99$7$?>l9g$O!"(Binetd $B$K(B HUP $B%7%0%J%k$rAw$C$F$*$/(B $BI,MW$,$"$j$^$9!#(B

    # kill -HUP `cat /var/run/inetd.pid`
    

    [$BCm0U(B]tcpd

    inetd $B$K$h$C$F5/F0$5$l$k%G!<%b%s$O!"(BRedHat6.2J $B$N>l9g(B tcpd$B$K$h$C$F%U%#%k%?$,3]$1$i$l$F$$$^$9!#(B

    tcpd $B$O!"

  • /etc/hosts.allow $B$,B8:_$9$k>l9g(B --- /etc/hosts.allow $B$K=q$+$l$F$$$k%[%9%H$d(BIP$B%"%I%l%9$N(B $B%/%i%$%"%s%H$+$i$N@\B3$r5v$9(B
  • /etc/hosts.deny $B$,B8:_$9$k>l9g(B --- $B$3$3$K=q$+$l$?%[%9%H$d(BIP$B%"%I%l%9(B($B$NHO0O(B)$B$N(B $B%/%i%$%"%s%H$+$i$N@\B3$r5v$5$J$$(B

    xinetd

    $B:G6a$N(BRedHat $B$d(B Fedora Core Linux $B$G$O(B inetd $B$NBe$j$K(B xinetd $B$,(B $B;H$o$l$k$h$&$K$J$j$^$7$?!#(B

    $B>\$7$/$O(Bman$B%3%^%s%I$r;H$C$F(B xinetd $B$N%^%K%e%"%k$rFI$s$G2<$5$$!#(B
       # man xinetd
       # man xinetd.conf
    
    man xinetd.conf$B$NH4?h(B
    XINETD.CONF(5)                                     XINETD.CONF(5)
    
    NAME
           xinetd.conf - Extended Internet Services Daemon configura-
           tion file
    
    DESCRIPTION
           xinetd.conf is the configuration file that determines  the
           services  provided  by  xinetd.  Any line whose first non-
           whitespace character is a  '#'  is  considered  a  comment
           line. Empty lines are ignored.
    
           The file contains entries of the form:
    
                  service <service_name>
                  {
                         <attribute> <assign_op> <value> <value> ...
                         ...
                  }
    
           The  assignment  operator,  assign_op,  can be one of '=',
           '+=', '='.  The majority of attributes  support  only  the
           simple  assignment  operator, '='.  Attributes whose value
           is a set of values support all assignment operators.   For
           such  attributes, '+=' means adding a value to the set and
           '=' means removing a value from the set.  A list of  these
           attributes  will  be  given  after  all the attributes are
           described.
    
           Each entry  defines  a  service  identified  by  the  ser-
           vice_name.    The   following   is  a  list  of  available
           attributes:
    
           socket_type      Possible   values   for   this  attribute
                            include:
    
                            stream      streambased service
    
                            dgram       datagrambased service
    
                            raw         service that requires  direct
                                        access to IP
    
                            seqpacket   service  that  requires reli-
                                        able   sequential    datagram
                                        transmission
    
           wait             This  attribute determines if the service
                            is singlethreaded  or  multithreaded.  If
                            its  value  is yes the service is single-
                            threaded; this  means  that  xinetd  will
                            start  the  server  and then it will stop
                            handling requests for the  service  until
                            the  server dies.  If the attribute value
                            is no, the service is  multithreaded  and
                            xinetd  will  keep  handling  new service
                            requests.
    
           user             determines the uid for  the  server  pro-
                            cess.   The   user  name  must  exist  in
                            /etc/passwd.  This attribute is  ineffec-
                            tive  if  the effective user ID of xinetd
                            is not superuser.
    
           server           determines  the  program  to  execute for
                            this service.
    
           server_args      determines the arguments  passed  to  the
                            server.  In contrast to inetd, the server
                            name   should   not   be   included    in
                            server_args.
    
           only_from        determines  the remote hosts to which the
                            particular  service  is  available.   Its
                            value is a list of IP addresses which can
                            be specified in any  combination  of  the
                            following ways:
    
                            a)   a  numeric  address  in  the form of
                                 %d.%d.%d.%d. If the rightmost compo-
                                 nents  are  0,  they  are treated as
                                 wildcards (for example, 128.138.12.0
                                 matches  all hosts on the 128.138.12
                                 subnet).  0.0.0.0 matches all Inter-
                                 net addresses.
    
                            b)   a  factorized address in the form of
                                 %d.%d.%d.{%d,%d,...}.  There  is  no
                                 need  for  all  4  components  (i.e.
                                 %d.%d.{%d,%d,...%d}  is  also   ok).
                                 However, the factorized part must be
                                 at the end of the address.
    
                            c)   a network name (from /etc/networks)
    
                            d)   a host name.  When a  connection  is
                                 made  to xinetd, a reverse lookup is
                                 performed, and  the  canonical  name
                                 returned  is  compared to the speci-
                                 fied host name.  You  may  also  use
                                 domain   names   in   the   form  of
                                 .domain.com.  If the reverse  lookup
                                 of   the   client's   IP  is  within
                                 .domain.com, a match occurs.
    
                            e)   an ip address/netmask range  in  the
                                 form of 1.2.3.4/32.
    
                            Specifying this attribute without a value
                            makes the service available to nobody.
    
    (ά)
           port             determines  the  service  port.  If  this
                            attribute  is  specified  for  a  service
                            listed in /etc/services, it must be equal
                            to the port number listed in that file.
    
    (ά)
    
    EXAMPLE
                  #
                  # Sample configuration file for xinetd
                  #
    
                  defaults
                  {
                         log_type            = FILE /var/log/servicelog
                         log_on_success      = PID
                         log_on_failure      = HOST RECORD
                         only_from           = 128.138.193.0 128.138.204.0 128.138.209.0
                         only_from           = 128.138.252.1
                         instances           = 10
                         disabled            = rstatd
                  }
    
                  #
                  # Note 1: the protocol attribute is not required
                  # Note 2: the instances attribute overrides the default
                  #
                  service login
                  {
                         socket_type         = stream
                         protocol            = tcp
                         wait                = no
                         user                = root
                         server              = /usr/etc/in.rlogind
                         instances           = UNLIMITED
                  }
    
                  #
                  # Note 1: the instances attribute overrides the default
                  # Note 2: the log_on_success flags are augmented
                  #
                  service shell
                  {
                         socket_type         = stream
                         wait                = no
                         user                = root
                         instances           = UNLIMITED
                         server              = /usr/etc/in.rshd
                         log_on_success      += HOST RECORD
                  }
    
                  service ftp
                  {
                         socket_type         = stream
                         wait                = no
                         nice                = 10
                         user                = root
                         server              = /usr/etc/in.ftpd
                         server_args         = l
                         instances           = 4
                         log_on_success      += DURATION HOST USERID
                         access_times        = 2:009:00 12:0024:00
                  }
    
                  # Limit telnet sessions to 8 Mbytes of memory and a total
                  # 20 CPU seconds for child processes.
                  service telnet
                  {
                         socket_type         = stream
                         wait                = no
                         nice                = 10
                         user                = root
                         server              = /usr/etc/in.telnetd
                         rlimit_as           = 8M
                         rlimit_cpu          = 20
                  }
    
    ¡Êά¡Ë