added set/lockout
[spider.git] / html / adminmanual-2.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 Administration Manual : Configuration</TITLE>
6  <LINK HREF="adminmanual-3.html" REL=next>
7  <LINK HREF="adminmanual-1.html" REL=previous>
8  <LINK HREF="adminmanual.html#toc2" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="adminmanual-3.html">Next</A>
12 <A HREF="adminmanual-1.html">Previous</A>
13 <A HREF="adminmanual.html#toc2">Contents</A>
14 <HR>
15 <H2><A NAME="s2">2. Configuration</A></H2>
16
17 <H2><A NAME="ss2.1">2.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 configure Linux or the ax25 utilities.  However, you do need to add a line in your ax25d.conf to allow connections to DXSpider for your users.  For each interface that you wish to allow connections on, use the following format ...
21 <P>
22 <BLOCKQUOTE><CODE>
23 <PRE>
24 default  * * * * * *  - sysop /spider/perl/client.pl client.pl %u ax25
25 </PRE>
26 </CODE></BLOCKQUOTE>
27 <P>
28 <H2><A NAME="ss2.2">2.2 Allowing telnet connects from users</A>
29 </H2>
30
31 <P>Allowing telnet connections is quite simple.  Firstly you need to add a line in /etc/services to allow connections to a port number, like this ....
32 <P>
33 <BLOCKQUOTE><CODE>
34 <PRE>
35 spdlogin   8000/tcp     # spider anonymous login port
36 </PRE>
37 </CODE></BLOCKQUOTE>
38 <P>Then add a line in /etc/inetd.conf like this ....
39 <P>
40 <BLOCKQUOTE><CODE>
41 <PRE>
42 spdlogin stream tcp nowait root /usr/sbin/tcpd /spider/perl/client.pl login telnet
43 </PRE>
44 </CODE></BLOCKQUOTE>
45 <P>
46 <P>This needs to be added above the standard services such as ftp, telnet etc.  Once this is done, you need to restart inetd like this ....
47 <P>
48 <BLOCKQUOTE><CODE>
49 <PRE>
50 killall -HUP inetd
51 </PRE>
52 </CODE></BLOCKQUOTE>
53 <P>
54 <P>
55 <P>Now login as <EM>sysop</EM> and cd spider/perl. You can test that spider is accepting telnet logins by issuing the following command ....
56 <P>
57 <BLOCKQUOTE><CODE>
58 <PRE>
59 client.pl login telnet
60 </PRE>
61 </CODE></BLOCKQUOTE>
62 <P>You should get a login prompt and on issuing a callsign, you will be given access to the cluster.  Note, you will not get a password login.  There seems no good reason for a password prompt to be given so it is not asked for.
63 <P>
64 <P>Assuming all is well, then try a telnet from your linux console ....
65 <P>
66 <BLOCKQUOTE><CODE>
67 <PRE>
68 telnet localhost 8000
69 </PRE>
70 </CODE></BLOCKQUOTE>
71 <P>
72 <P>You should now get the login prompt and be able to login as before.
73 <P>
74 <H2><A NAME="ss2.3">2.3 Setting up node connects</A>
75 </H2>
76
77 <P>In order to allow cluster node connections, spider needs to know that the connecting callsign is a cluster node.  This is the case whether the connect is incoming or outgoing.
78 In spider this is a simple task and can be done in runtime.
79 <P>
80 <P>Start up the cluster as you did before and login as the sysop with client.pl.
81 The cluster node I am wanting to make a connection to is GB7BAA but you would obviously use whatever callsign you required.
82 At the prompt type ...
83 <P>
84 <BLOCKQUOTE><CODE>
85 <PRE>
86 set/node gb7baa
87 </PRE>
88 </CODE></BLOCKQUOTE>
89 <P>
90 <P>The case does not matter as long as you have a version of DXSpider later than 1.33.  Earlier versions required the callsign to be in upper case.
91 <P>
92 <P>That is now set, it is as simple as that.  To prove it, login on yet another console as sysop and issue the command ...
93 <P>
94 <BLOCKQUOTE><CODE>
95 <PRE>
96 client.pl gb7baa (using the callsign you set as a node)
97 </PRE>
98 </CODE></BLOCKQUOTE>
99 <P>
100 <P>You should get an initialisation string from DXSpider like this ...
101 <P>
102 <BLOCKQUOTE><CODE>
103 <PRE>
104 client.pl gb7baa
105 PC38^GB7MBC^~
106 </PRE>
107 </CODE></BLOCKQUOTE>
108 <P>If the callsign you just set up as a cluster node is for an incoming connect, this is all that needs to be done.  If the connection is to be outgoing then a connection script needs to be written.
109 <P>
110 <H3>Connection scripts</H3>
111
112 <P>Because DXSpider operates under Linux, connections can be made using just about any protocol;  AX25, NETRom, tcp/ip, ROSE etc are all possible examples.  Connect scripts live in the /spider/connect directory and are simple ascii files.  Writing a script for connections is therefore relatively simple.  
113 <P>
114 <P>The connect scripts consist of lines which start with the following keywords or symbols:-
115 <P>
116 <P>
117 <PRE>
118         
119 #               All lines starting with a # are ignored, as are wholly blank lines.
120
121 timeout         timeout followed by a number is the number of seconds to wait for a 
122                 command to complete. If there is no timeout specified in the script 
123                 then the default is 60 seconds.
124
125 abort           abort is a regular expression containing one or more strings to look 
126                 for to abort a connection. This is a perl regular expression and is 
127                 executed ignoring case.
128
129 connect         connect followed by ax25 or telnet and some type dependent 
130                 information. In the case of a telnet connection, there can be up to 
131                 two parameters.
132                 The first is the ip address or hostname of the computer you wish to 
133                 connect to and the second is the port number you want to use (this 
134                 can be left out if it is a normal telnet session).
135                 In the case of an ax25 session then this would normally be a call to
136                 ax25_call or netrom_call as in the example above. It is your
137                 responsibility to get your node and other ax25 parameters to work 
138                 before going down this route!
139
140 '               ' is the delimiting character for a word or phrase of an expect/send 
141                 line in a chat type script. The words/phrases normally come in pairs, 
142                 either can be empty. Each line reads input from the connection until 
143                 it sees the string (or perl regular expression) contained in the
144                 left hand string. If the left hand string is empty then it doesn't 
145                 read or wait for anything. The comparison is done ignoring case.
146                 When the left hand string has found what it is looking for (if it is) 
147                 then the right hand string is sent to the connection.
148                 This process is repeated for every line of chat script. 
149
150 client          client starts the connection, put the arguments you would want here 
151                 if you were starting the client program manually. You only need this 
152                 if the script has a different name to the callsign you are trying to 
153                 connect to (i.e. you have a script called other which actually 
154                 connects to GB7DJK-1 [instead of a script called gb7djk-1]).
155 </PRE>
156 <P>
157 <P>There are many possible ways to configure the script but here are two examples, one for a NETRom/AX25 connect and one for tcp/ip.  
158 <P>
159 <BLOCKQUOTE><CODE>
160 <PRE>
161         timeout 60
162         abort (Busy|Sorry|Fail)
163         # don't forget to chmod 4775 netrom_call!
164         connect ax25 /usr/sbin/netrom_call bbs gb7djk g1tlh
165         'Connect' ''
166         'Connect' 'c np7'
167         'Connect' 'c gb7dxm'
168         'Connect' ''
169         # you can leave this out if you call the script 'gb7dxm'
170         client gb7dxm ax25
171 </PRE>
172 </CODE></BLOCKQUOTE>
173 <P>
174 <P>
175 <P>
176 <BLOCKQUOTE><CODE>
177 <PRE>
178         timeout 15
179         connect telnet dirkl.tobit.co.uk
180         'login' 'gb7djk'
181         'word' 'gb7djk'
182         # tell GB7DJK-1 that it is connected to GB7DJK
183         # you can leave this out if you call this script 'gb7djk'
184         client gb7djk telnet
185 </PRE>
186 </CODE></BLOCKQUOTE>
187 <P>
188 <P>Both these examples assume that everything is set up properly at the other end.  You will find other examples in the /spider/examples directory.
189 <P>
190 <H3>Starting the connection</H3>
191
192 <P>You start the connection, from within a sysop enabled cluster login, by typing in the word <EM>connect</EM> followed by a script name like this ....
193 <P>
194 <BLOCKQUOTE><CODE>
195 <PRE>
196 G0VGS de GB7MBC 13-Dec-1998 2041Z >connect gb7djk-1
197 connection to GB7DJK-1 started
198 G0VGS de GB7MBC 13-Dec-1998 2043Z >
199 </PRE>
200 </CODE></BLOCKQUOTE>
201 <P>This will start a connection using the script called <EM>gb7djk-1</EM>.  You can follow the connection by watching the term or console from where you started <EM>cluster.pl</EM>.  You should see something like this ...
202 <P>
203 <BLOCKQUOTE><CODE>
204 <PRE>
205 &lt;- D G1TLH connect gb7djk-1
206 -> D G1TLH connection to GB7DJK-1 started
207 -> D G1TLH G1TLH de GB7DJK 13-Dec-1998 2046Z >
208 timeout set to 15
209 CONNECT sort: telnet command: dirkl.tobit.co.uk
210 CHAT "login" -> "gb7djk"
211 received "
212 Red Hat Linux release 5.1 (Manhattan)
213 Kernel 2.0.35 on an i586
214 "
215 received "login: "
216 sent "gb7djk"
217 CHAT "word" -> "gb7djk"
218 received "gb7djk"
219 received "Password: "
220 sent "gb7djk"
221 Connected to GB7DJK-1, starting normal protocol
222 &lt;- O GB7DJK-1 telnet
223 -> B GB7DJK-1 0
224 GB7DJK-1 channel func  state 0 -> init
225 &lt;- D GB7DJK-1 
226 &lt;- D GB7DJK-1 Last login: Sun Dec 13 17:59:56 from dirk1
227 &lt;- D GB7DJK-1 PC38^GB7DJK-1^~
228 &lt;- D GB7DJK-1 PC18^ 1 nodes, 0 local / 1 total users  Max users 0  Uptime 0 00:00^5447^~
229     etc
230 </PRE>
231 </CODE></BLOCKQUOTE>
232 <P>
233 <H2><A NAME="ss2.4">2.4 Automating things</A>
234 </H2>
235
236 <P>Ok, you should now have DXSpider running nicely and allowing connects by cluster nodes or users.  However, it has to be shutdown and restarted manually and if connection scripts fail they have to be started again manually too, not much use if you are not at the console!
237 So, in this section we will automate both.  Firstly starting the cluster.
238 <P>
239 <H3>Autostarting the cluster</H3>
240
241 <P>This is not only a way to start the cluster automatically, it also works as a watchdog, checking the sanity of DXSpider and respawning it should it crash for any reason.
242 Before doing the following, shutdown the cluster as you did earlier.
243 <P>
244 <P>Login as root and bring up the /etc/inittab file in your favourite editor.  Add the following lines to the file near the end ...
245 <P>
246 <BLOCKQUOTE><CODE>
247 <PRE>
248 ##Start DXSpider on bootup and respawn it should it crash
249 DX:3:respawn:/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7
250 </PRE>
251 </CODE></BLOCKQUOTE>
252 <P>
253 <P>This will automatically start DXSpider on tty7 (ALT-F7) on bootup and restart it should it crash for any reason.
254 <P>
255 <P>As root type the command <EM>telinit q</EM>.  DXSpider should start up immediately.  You will see the output on tty7 and if you login as <EM>sysop</EM> you should find everything running nicely.
256 <P>
257 <P>So far so good, now to automate script connections...
258 <P>
259 <H3>The crontab file</H3>
260
261 <P>Login as <EM>sysop</EM> and create a file in /spider/local_cmd called crontab.  Edit it with your favourite editor and add a line like this (I have included a comment)
262 <P>
263 <BLOCKQUOTE><CODE>
264 <PRE>
265 # check every 10 minutes to see if gb7xxx is connected and if not
266 # start a connect job going
267
268 0,10,20,30,40,50 * * * * start_connect('gb7xxx') if !connected('gb7xxx')
269 </PRE>
270 </CODE></BLOCKQUOTE>
271 <P>
272 <P>The callsign involved will be the callsign of the cluster node you are going to connect to.  This will now check every 10 minutes to see if gb7xxx is connected, if it is then nothing will be done.  If it is not, then a connect attempt will be started.
273 <P>
274 <P>There are probably lots of other things you could use this crontab file for.  If you want to know more about it, look at the 
275 <A HREF="http://www.dxcluster.org/cron.html">DXSpider</A> website at the cron page where it is explained more fully.
276 <P>
277 <HR>
278 <A HREF="adminmanual-3.html">Next</A>
279 <A HREF="adminmanual-1.html">Previous</A>
280 <A HREF="adminmanual.html#toc2">Contents</A>
281 </BODY>
282 </HTML>