Typo
[linux_from_scratch_hints.git] / OLD / xinetd.txt
blob241879e40ffe9100d8cf090afc9401a670fadd1f
1 TITLE:          Setting up xinetd
2 LFS VERSION:    any
3 AUTHOR:         Peter Hall <peter.hall@hgus.gu.se>
5 SYNOPSIS:
6         How to setup the internet service daemon, xinetd.
8 HINT:
9 v1.2
11 Introduction to xinetd
13 Download location               http://www.xinetd.org/pub/xinetd
14 Version used                    2.3.3
15 Package size                    268k
16 Estimated Disk space required   1.3M
18 xinetd is an internet service daemon. Instead of having many
19 different servers running at the same time, only xinetd is loaded..
20 Whenever a request for a service is made, xinetd fires the
21 corresponding server up. It does this in a more secure manner
22 than it's precursor inetd.
24 Installation of xinetd
26 Install xinetd by running the following commands:
28 ./configure --prefix=/usr &&
29 make &&
30 make install
32 Configuring xinetd
34 Config files
36 /etc/xinetd.conf
38 Create the xinetd.conf file by running:
40 cat > /etc/xinetd.conf << "EOF"
41 # Begin /etc/xinetd.conf
43 # Default configuration options that apply to all servers, can be
44 # overriden per service.
46 defaults
48     instances      = 10
49     log_type       = FILE /var/log/service.log 
50     log_on_success = HOST PID
51     log_on_failure = HOST RECORD
54 # The service name must be in /etc/services in order to obtain
55 # the correct port.
56 # If it's a non-standard server/port, use "port = X"
57 service ftp
59     socket_type    = stream
60     protocol       = tcp
61     wait           = no
62     user           = root
63     server         = /usr/sbin/proftpd
64     
67 #service telnet
69 #    socket_type    = stream
70 #    protocol       = tcp
71 #    wait           = no
72 #    user           = root
73 #    no_access      = 0.0.0.0 
74 #    only_from      = 127.0.0.1
75 #    banner_fail    = /etc/telnet_fail 
76 #    server         = /usr/sbin/in.telnetd
79 service ssh
81     socket_type    = stream
82     protocol       = tcp
83     wait           = no
84     user           = root
85     port           = 22
86     server         = /usr/sbin/sshd
87     server_args    = -i
90 service http
92     socket_type    = stream
93     protocol       = tcp
94     wait           = no
95     user           = root
96     server         = /usr/local/apache/bin/httpd
99 #service finger
101 #    socket_type    = stream
102 #    protocol       = tcp
103 #    wait           = no
104 #    user           = root
105 #    no_access      = 0.0.0.0
106 #    only_from      = 127.0.0.1
107 #    banner_fail    = /etc/finger_fail
108 #    server         = /usr/sbin/in.fingerd
109 #    server_args    = -l
112 # End /etc/xinetd.conf
117 Configuration information
119 Please note that this only is a sample configuration and you
120 will MOST CERTAINLY have to edit this to suite your needs.
121 However, I only have sshd on my system and the above configuration
122 works for me, xinetd states in /var/log/daemon.log that servers
123 are missing but still starts.
125 Configuring the daemons to use xinetd
127 One last thing you have to do before you're able to test xinetd out is
128 to make sure that your daemons know they're being started from
129 (x)inetd and not running in standalone mode.
131 For sshd this is accomplished by passing it an extra argument.
132 "server_args = -i" tells the SSH daemon that it should run in
133 inetd mode.
135 Apache, Proftpd and probably many others handles this via their
136 config file. Find the line in /etc/httpd.conf and/or
137 /etc/proftpd.conf that reads:
138 "ServerType standalone"
139 and change standalone to inetd
141 Now run xinetd as root and make sure it works.
144 Make xinetd start on bootup
146 Create the /etc/rc.d/init.d/xinetd by running:
148 cat > /etc/rc.d/init.d/xinetd << "EOF"
149 #!/bin/sh
150 # Begin /etc/rc.d/init.d/xinetd
153 # Include the functions declared in the /etc/init.d/functions file
156 source /etc/rc.d/init.d/functions
158 case "$1" in
159         start)
160                 echo -n "Loading xinet super daemon"
161                 loadproc /usr/sbin/xinetd
162                 ;;
164         stop)
165                 echo -n "Stopping xinet super daemon"
166                 killproc /usr/sbin/xinetd
167                 ;;
169         restart)
170                 $0 stop
171                 /usr/bin/sleep 1
172                 $0 start
173                 ;;
175         status)
176                 statusproc /usr/sbin/xinetd
177                 ;;
179         *)
180                 echo "Usage: $0 {start|stop|reload|restart|status}"
181                 exit 1
182         ;;
184 esac
186 # End /etc/init.d/xinitd
191 Make the script executable and create the appropriate symlinks by
192 running:
194 chmod 755 /etc/rc.d/init.d/xinetd &&
195 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc1.d/K110xinetd &&
196 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc2.d/K110xinetd &&
197 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc3.d/S30xinetd &&
198 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc4.d/S30xinetd &&
199 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc5.d/S30xinetd &&
200 ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc6.d/K110xinetd
203 Contents
205 The xinetd package contains xinetd and itox
207 xinetd
209 xinetd is a superdaemon, similar to inetd
211 itox
213 itox converts inetd.conf style configuration files to xinetd.conf
216 Mail suggestions to peter.hall@hgus.gu.se