new adminmanual
[spider.git] / html / adminmanual-3.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5  <TITLE>The DXSpider Installation and Administration Manual : Configuration</TITLE>
6  <LINK HREF="adminmanual-4.html" REL=next>
7  <LINK HREF="adminmanual-2.html" REL=previous>
8  <LINK HREF="adminmanual.html#toc3" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="adminmanual-4.html">Next</A>
12 <A HREF="adminmanual-2.html">Previous</A>
13 <A HREF="adminmanual.html#toc3">Contents</A>
14 <HR>
15 <H2><A NAME="s3">3. Configuration</A></H2>
16
17 <H2><A NAME="ss3.1">3.1 Allowing ax25 connects from users</A>
18 </H2>
19
20 <P>As stated previously, the aim of this document is not to tell you how to 
21 configure Linux or the ax25 utilities.  However, you do need to add a line 
22 in your ax25d.conf to allow connections to DXSpider for your users.  For
23 each interface that you wish to allow connections on, use the following format ...
24 <P>
25 <BLOCKQUOTE><CODE>
26 <PRE>
27 default  * * * * * *  - sysop /spider/src/client client %u ax25
28 </PRE>
29 </CODE></BLOCKQUOTE>
30 <P>
31 <H2><A NAME="ss3.2">3.2 Allowing telnet connects from users</A>
32 </H2>
33
34 <P>Allowing telnet connections is quite simple.  Firstly you need to add a line 
35 in /etc/services to allow connections to a port number, like this ....
36 <P>
37 <BLOCKQUOTE><CODE>
38 <PRE>
39 spdlogin   8000/tcp     # spider anonymous login port
40 </PRE>
41 </CODE></BLOCKQUOTE>
42 <P>Then add a line in /etc/inetd.conf like this ....
43 <P>
44 <BLOCKQUOTE><CODE>
45 <PRE>
46 spdlogin stream tcp nowait root /usr/sbin/tcpd /spider/src/client login telnet
47 </PRE>
48 </CODE></BLOCKQUOTE>
49 <P>
50 <P>This needs to be added above the standard services such as ftp, telnet etc.  
51 Once this is done, you need to restart inetd like this ....
52 <P>
53 <BLOCKQUOTE><CODE>
54 <PRE>
55 killall -HUP inetd
56 </PRE>
57 </CODE></BLOCKQUOTE>
58 <P>
59 <P>
60 <P>Now login as <EM>sysop</EM> and cd spider/perl. You can test that spider 
61 is accepting telnet logins by issuing the following command ....
62 <P>
63 <BLOCKQUOTE><CODE>
64 <PRE>
65 client.pl login telnet
66 </PRE>
67 </CODE></BLOCKQUOTE>
68 <P>You should get a login prompt and on issuing a callsign, you will be given 
69 access to the cluster.  Note, you will not get a password login.  There seems 
70 no good reason for a password prompt to be given so it is not asked for.
71 <P>
72 <P>Assuming all is well, then try a telnet from your linux console ....
73 <P>
74 <BLOCKQUOTE><CODE>
75 <PRE>
76 telnet localhost 8000
77 </PRE>
78 </CODE></BLOCKQUOTE>
79 <P>
80 <P>You should now get the login prompt and be able to login as before.
81 <P>
82 <H2><A NAME="ss3.3">3.3 Setting up node connects</A>
83 </H2>
84
85 <P>In order to allow cluster node connections, spider needs to know that the 
86 connecting callsign is a cluster node.  This is the case whether the connect 
87 is incoming or outgoing.  In spider this is a simple task and can be done in 
88 runtime.
89 <P>
90 <P>Later versions of Spider can distinguish different software and treat them
91 differently.  For example, the WCY beacon cannot be handles by AK1A type
92 nodes as AK1A does not know what to do with PC73.  There are 4 different
93 types of node at present and although they may not have any major
94 differences at the moment, it allows for compatibility.  The 4 types are ...
95 <P>
96 <BLOCKQUOTE><CODE>
97 <PRE>
98 set/node        (AK1A type)
99 set/spider
100 set/dxnet
101 set/clx
102 </PRE>
103 </CODE></BLOCKQUOTE>
104 <P>
105 <P>For now, we will assume that the cluster we are going to connect to is an
106 AK1A type node.
107 <P>
108 <P>Start up the cluster as you did before and login as the sysop with client.pl.
109 The cluster node I am wanting to make a connection to is GB7BAA but you would
110 obviously use whatever callsign you required.  At the prompt type ...
111 <P>
112 <BLOCKQUOTE><CODE>
113 <PRE>
114 set/node gb7baa
115 </PRE>
116 </CODE></BLOCKQUOTE>
117 <P>
118 <P>The case does not matter as long as you have a version of DXSpider later than 
119 1.33.  Earlier versions required the callsign to be in upper case.
120 <P>
121 <P>That is now set, it is as simple as that.  To prove it, login on yet another 
122 console as sysop and issue the command ...
123 <P>
124 <BLOCKQUOTE><CODE>
125 <PRE>
126 client.pl gb7baa (using the callsign you set as a node)
127 </PRE>
128 </CODE></BLOCKQUOTE>
129 <P>
130 <P>You should get an initialisation string from DXSpider like this ...
131 <P>
132 <BLOCKQUOTE><CODE>
133 <PRE>
134 client.pl gb7baa
135 PC38^GB7MBC^~
136 </PRE>
137 </CODE></BLOCKQUOTE>
138 <P>If the callsign you just set up as a cluster node is for an incoming connect, 
139 this is all that needs to be done.  If the connection is to be outgoing then 
140 a connection script needs to be written.
141 <P>
142 <H2><A NAME="ss3.4">3.4 Connection scripts</A>
143 </H2>
144
145 <P>Because DXSpider operates under Linux, connections can be made using just about 
146 any protocol;  AX25, NETRom, tcp/ip, ROSE etc are all possible examples.  
147 Connect scripts live in the /spider/connect directory and are simple ascii files.  
148 Writing a script for connections is therefore relatively simple.  
149 <P>
150 <P>The connect scripts consist of lines which start with the following keywords 
151 or symbols:-
152 <P>
153 <PRE>
154         
155 #               All lines starting with a # are ignored, as are completely 
156                 blank lines.
157
158 timeout         timeout followed by a number is the number of seconds to wait for a 
159                 command to complete. If there is no timeout specified in the script 
160                 then the default is 60 seconds.
161
162 abort           abort is a regular expression containing one or more strings to look 
163                 for to abort a connection. This is a perl regular expression and is 
164                 executed ignoring case.
165
166 connect         connect followed by ax25 or telnet and some type dependent 
167                 information. In the case of a telnet connection, there can be up to 
168                 two parameters.
169                 The first is the ip address or hostname of the computer you wish to 
170                 connect to and the second is the port number you want to use (this 
171                 can be left out if it is a normal telnet session).
172                 In the case of an ax25 session then this would normally be a call to
173                 ax25_call or netrom_call as in the example above. It is your
174                 responsibility to get your node and other ax25 parameters to work 
175                 before going down this route!
176
177 '               ' is the delimiting character for a word or phrase of an expect/send 
178                 line in a chat type script. The words/phrases normally come in pairs,
179                 either can be empty. Each line reads input from the connection until 
180                 it sees the string (or perl regular expression) contained in the
181                 left hand string. If the left hand string is empty then it doesn't 
182                 read or wait for anything. The comparison is done ignoring case.
183                 When the left hand string has found what it is looking for (if it is)
184                 then the right hand string is sent to the connection.
185                 This process is repeated for every line of chat script. 
186
187 client          client starts the connection, put the arguments you would want here 
188                 if you were starting the client program manually. You only need this 
189                 if the script has a different name to the callsign you are trying to 
190                 connect to (i.e. you have a script called other which actually 
191                 connects to GB7DJK-1 [instead of a script called gb7djk-1]).
192 </PRE>
193 <P>
194 <P>There are many possible ways to configure the script but here are two examples, 
195 one for a NETRom/AX25 connect and one for tcp/ip.  
196 <P>
197 <BLOCKQUOTE><CODE>
198 <PRE>
199 timeout 60
200 abort (Busy|Sorry|Fail)
201 # don't forget to chmod 4775 netrom_call!
202 connect ax25 /usr/sbin/netrom_call bbs gb7djk g1tlh
203 'Connect' '' 
204 'Connect' 'c np7'
205 'Connect' 'c gb7dxm'
206 # you can leave this out if you call the script 'gb7dxm'
207 client gb7dxm ax25
208 </PRE>
209 </CODE></BLOCKQUOTE>
210 <P>
211 <P>
212 <P>
213 <BLOCKQUOTE><CODE>
214 <PRE>
215 timeout 15
216 connect telnet dirkl.tobit.co.uk
217 'login' 'gb7djk'
218 'word' 'gb7djk'
219 # tell GB7DJK-1 that it is connected to GB7DJK
220 # you can leave this out if you call this script 'gb7djk'
221 client gb7djk telnet
222 </PRE>
223 </CODE></BLOCKQUOTE>
224 <P>
225 <P>Both these examples assume that everything is set up properly at the other end.  
226 You will find other examples in the /spider/examples directory.
227 <P>
228 <H2><A NAME="ss3.5">3.5 Starting the connection</A>
229 </H2>
230
231 <P>You start the connection, from within a sysop enabled cluster login, by typing 
232 in the word <EM>connect</EM> followed by a script name like this ....
233 <P>
234 <BLOCKQUOTE><CODE>
235 <PRE>
236 G0VGS de GB7MBC 13-Dec-1998 2041Z >connect gb7djk-1
237 connection to GB7DJK-1 started
238 G0VGS de GB7MBC 13-Dec-1998 2043Z >
239 </PRE>
240 </CODE></BLOCKQUOTE>
241 <P>This will start a connection using the script called <EM>gb7djk-1</EM>.  You can
242 follow the connection by watching the term or console from where you started
243 <EM>cluster.pl</EM>.  You should see something like this ...
244 <P>
245 <BLOCKQUOTE><CODE>
246 <PRE>
247 &lt;- D G1TLH connect gb7djk-1
248 -> D G1TLH connection to GB7DJK-1 started
249 -> D G1TLH G1TLH de GB7DJK 13-Dec-1998 2046Z >
250 timeout set to 15
251 CONNECT sort: telnet command: dirkl.tobit.co.uk
252 CHAT "login" -> "gb7djk"
253 received "
254 Red Hat Linux release 5.1 (Manhattan)
255 Kernel 2.0.35 on an i586
256 "
257 received "login: "
258 sent "gb7djk"
259 CHAT "word" -> "gb7djk"
260 received "gb7djk"
261 received "Password: "
262 sent "gb7djk"
263 Connected to GB7DJK-1, starting normal protocol
264 &lt;- O GB7DJK-1 telnet
265 -> B GB7DJK-1 0
266 GB7DJK-1 channel func  state 0 -> init
267 &lt;- D GB7DJK-1 
268 &lt;- D GB7DJK-1 Last login: Sun Dec 13 17:59:56 from dirk1
269 &lt;- D GB7DJK-1 PC38^GB7DJK-1^~
270 &lt;- D GB7DJK-1 PC18^ 1 nodes, 0 local / 1 total users  Max users 0  Uptime 
271 0 00:00^5447^~
272     etc
273 </PRE>
274 </CODE></BLOCKQUOTE>
275 <P>
276 <P>With later versions of Spider there is a set/login command for users.  This 
277 tells them when a user or node logs in or out.  If you do not add a line to 
278 your scripts after the final line (or before the client line which should always 
279 be last if needed) then the login/logout information will be sent to users
280 <I>before</I> the login actually completes.  This means if a node is 
281 unreachable, it will continue sending logins and logouts to users even though it 
282 is not actually connecting.  To avoid this use the following line ...
283 <P>
284 <BLOCKQUOTE><CODE>
285 <PRE>
286 'connect' ''
287 </PRE>
288 </CODE></BLOCKQUOTE>
289 <P>
290 <P>In a script, this might look like ...
291 <P>
292 <BLOCKQUOTE><CODE>
293 <PRE>
294 timeout 35 
295 abort (Busy|Sorry|Fail)
296 connect telnet mary 3000
297 'ogin:' 'gb7mbc'
298 '>' 'telnet 44.131.93.96 7305'
299 'connect' ''
300 </PRE>
301 </CODE></BLOCKQUOTE>
302 <P>
303 <H2><A NAME="ss3.6">3.6 Telnet echo</A>
304 </H2>
305
306 <P>Cluster links in particular suffer greatly from the presence of telnet echo.  
307 This is caused by the telnet negotiation itself and can create at worst severe 
308 loops.  At best it creates unnecessary bandwidth and large logfiles!  There are
309 things that can be done to limit this problem but will not always work dependent 
310 on the route taken to connect.
311 <P>
312 <P>Telnet echo itself should only be a problem if the connection is being made to 
313 the telnet port (23).  This port uses special rules that include echo negotiation.
314 If the connection is to a different port, such as 8000, this negotiation does 
315 not happen and therefore no echo should be present.
316 <P>
317 <P>Sometimes it is not possible to make a direct connection to another node and this 
318 can cause problems.  There is a way of trying to suppress the telnet echo but 
319 this will not always work, unfortunately it is difficult to be more specific.  
320 Here is an example of what I mean ...
321 <P>
322 <BLOCKQUOTE><CODE>
323 <PRE>
324 timeout 35
325 abort (Busy|Sorry|Fail)
326 connect telnet mary.lancs.ac.uk
327 'ogin:' 'gb7mbc'
328 'word:' 'mypasswd'
329 '\$' 'stty -echo raw'
330 '\$' 'telnet 44.131.93.96'
331 'connect' ''
332 </PRE>
333 </CODE></BLOCKQUOTE>
334 <P>So, the first connection is made by Spider.  This is fine as Spider uses the
335 Net_Telnet script from within perl.  This actually uses TCP rather than TELNET 
336 so no negotiation will be done on the first connection.  Once connected to
337 mary.lancs.ac.uk, the command is sent to suppress echo.  Now a telnet is made 
338 to a cluster node that is accepting connections on port 23.  The problem with 
339 this link is that the negotiation is made by the remote machine, therefore you 
340 have no control over it.  The chances are that this link will create echo and 
341 there will be no way you can stop it.
342 <P>
343 <P>
344 <H2><A NAME="ss3.7">3.7 Automating things</A>
345 </H2>
346
347 <P>Ok, you should now have DXSpider running nicely and allowing connects by cluster
348 nodes or users.  However, it has to be shutdown and restarted manually and if
349 connection scripts fail they have to be started again manually too, not much use 
350 if you are not at the console!  So, in this section we will automate both.  
351 Firstly starting the cluster.
352 <P>
353 <H3>Autostarting the cluster</H3>
354
355 <P>This is not only a way to start the cluster automatically, it also works as a
356 watchdog, checking the sanity of DXSpider and respawning it should it crash for 
357 any reason.  Before doing the following, shutdown the cluster as you did earlier.
358 <P>
359 <P>Login as root and bring up the /etc/inittab file in your favourite editor.  Add 
360 the following lines to the file near the end ...
361 <P>
362 <BLOCKQUOTE><CODE>
363 <PRE>
364 ##Start DXSpider on bootup and respawn it should it crash
365 DX:3:respawn:/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7
366 </PRE>
367 </CODE></BLOCKQUOTE>
368 <P>
369 <P>This will automatically start DXSpider on tty7 (ALT-F7) on bootup and restart 
370 it should it crash for any reason.
371 <P>
372 <P>As root type the command <EM>telinit q</EM>.  DXSpider should start up 
373 immediately.  You will see the output on tty7 and if you login as <EM>sysop</EM> 
374 you should find everything running nicely.
375 <P>
376 <P>So far so good, now to automate script connections...
377 <P>
378 <H3>The crontab file</H3>
379
380 <P>Login as <EM>sysop</EM> and create a file in /spider/local_cmd called crontab.  
381 Edit it with your favourite editor and add a line like this (I have included 
382 a comment)
383 <P>
384 <BLOCKQUOTE><CODE>
385 <PRE>
386 # check every 10 minutes to see if gb7xxx is connected and if not
387 # start a connect job going
388
389 0,10,20,30,40,50 * * * * start_connect('gb7xxx') if !connected('gb7xxx')
390 </PRE>
391 </CODE></BLOCKQUOTE>
392 <P>
393 <P>The callsign involved will be the callsign of the cluster node you are 
394 going to connect to.  This will now check every 10 minutes to see if 
395 gb7xxx is connected, if it is then nothing will be done.  If it is not, 
396 then a connect attempt will be started.
397 <P>
398 <P>There are probably lots of other things you could use this crontab file for.  
399 If you want to know more about it, look at the
400 <A HREF="http://www.dxcluster.org/cron.html">DXSpider</A> website 
401 at the cron page where it is explained more fully.
402 <P>
403 <HR>
404 <A HREF="adminmanual-4.html">Next</A>
405 <A HREF="adminmanual-2.html">Previous</A>
406 <A HREF="adminmanual.html#toc3">Contents</A>
407 </BODY>
408 </HTML>