| 1 |
<HTML> |
| 2 |
|
| 3 |
<HEAD> |
| 4 |
<TITLE>User Guide To ACEDB 4_9 Sockets-based Client/Server</TITLE> |
| 5 |
|
| 6 |
<LINK rel=stylesheet type="text/css" |
| 7 |
href="../wdoc.css" |
| 8 |
title="Style sheet for wdoc developer documents"> |
| 9 |
|
| 10 |
</HEAD> |
| 11 |
|
| 12 |
|
| 13 |
<BODY> |
| 14 |
|
| 15 |
<BLOCKQUOTE> |
| 16 |
<DIV ALIGN=CENTER> |
| 17 |
<IMG SRC="./acedb-logo.gif" ALT="[ACEDB 4_9 DOCUMENTATION]" align=middle> |
| 18 |
<H3> |
| 19 |
ACEDB Version 4_9 |
| 20 |
</H3> |
| 21 |
</DIV> |
| 22 |
|
| 23 |
|
| 24 |
<DIV ALIGN=CENTER> |
| 25 |
|
| 26 |
<H1 align=center> |
| 27 |
User Guide To Sockets-based Client/Server |
| 28 |
</H1> |
| 29 |
|
| 30 |
<ADDRESS>Originally written by<BR> |
| 31 |
Ed Griffiths <[email protected]>, December 1999</ADDRESS> |
| 32 |
|
| 33 |
</DIV> |
| 34 |
|
| 35 |
<H2>Background</H2> |
| 36 |
|
| 37 |
<P>The first implementation of the ACEDB client/server code used <CODE>RPC</CODE> for |
| 38 |
inter process communication (<CODE>IPC</CODE>). This method was originally |
| 39 |
chosen because it offered the promise and portable means of making requests |
| 40 |
between the client and server. In practice <CODE>RPC</CODE> suffered from |
| 41 |
several major disadvantages: |
| 42 |
<UL> |
| 43 |
<LI>although <CODE>RPC</CODE> was offered by all major unix vendors, their |
| 44 |
implementations turned out to be buggy, in different ways (ironically, |
| 45 |
this was especially true of Suns implementation). |
| 46 |
<LI>although <CODE>RPC</CODE> offers a very simple function call interface |
| 47 |
for <CODE>IPC</CODE>, error handling is not so simple and does not |
| 48 |
offer the fine grained control that other methods of <CODE>IPC</CODE> do. |
| 49 |
<LI><CODE>RPC</CODE> for MS Windows is not robust. |
| 50 |
<LI><CODE>DCE RPC</CODE> using the DCE version of RPC would help with portability for |
| 51 |
both Unix and MS Windows, but the DCE version is often not available for free. |
| 52 |
<LI>many other code subsytems offer sockets communication (e.g. Perl) but not |
| 53 |
<CODE>RPC</CODE>. |
| 54 |
<LI>On unix at least <CODE>RPC</CODE> requires several daemons to be running (portmapper, |
| 55 |
inetd) and this makes the system susceptible to system set up/reboot problems. |
| 56 |
</UL> |
| 57 |
The decision was taken to switch to socket based <CODE>IPC</CODE> because it overcomes |
| 58 |
the above difficulties. Sockets of course present their own difficulties because the interface |
| 59 |
to them is more complex to program than <CODE>RPC</CODE>, it's greater flexibility/portability |
| 60 |
and ubiquitousness made this a worthwhile trade off. |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
<H2>Overview</H2> |
| 65 |
|
| 66 |
<P>The sockets based version of the server offers the same interface as the current RPC based |
| 67 |
version of the client/server but there have been several additions to the code that are |
| 68 |
either indirectly or not directly related to sockets: |
| 69 |
|
| 70 |
<UL> |
| 71 |
<LI>NO_RESTART option & fix for the "phoenix" bug |
| 72 |
<LI>READ/WRITE options for setting global access permissions to a database |
| 73 |
<LI>MD5 password based authentification for users |
| 74 |
<LI>domain name group authorisation (NO_HOSTNAME_RESOLUTION option) |
| 75 |
<LI>a new "admin" class of user with a set of "admin" commands |
| 76 |
<li>READ ONLY database support |
| 77 |
<LI>DEBUG option |
| 78 |
</UL> |
| 79 |
|
| 80 |
<P>This document describes these new features and then goes on to describe how to: |
| 81 |
|
| 82 |
<UL> |
| 83 |
<LI>set up a database for use with the sockets server |
| 84 |
<LI>server start up options |
| 85 |
<LI>foreground and inetd startup of the server |
| 86 |
<LI>client start up |
| 87 |
</UL> |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
<H2>Setting up a database</H2> |
| 92 |
|
| 93 |
<P>The following is a brief summary to get you started, it should |
| 94 |
let you get the server/client going, after that you can tinker around |
| 95 |
to get more security etc.: |
| 96 |
|
| 97 |
<H3>1) Options in wspec/serverconfig.wrm:</H3> |
| 98 |
<DL> |
| 99 |
<DT><B>NO_RESTART</B> |
| 100 |
<DD>- turns ON no restart of server after a crash/shutdown. |
| 101 |
<DT><B>NO_HOSTNAME_RESOLUTION</B> |
| 102 |
<DD>- turns OFF checking for user being in a domain specified |
| 103 |
as having permission to log in, e.g. sanger.ac.uk |
| 104 |
<DT><B>DEBUG</B> |
| 105 |
<DD>- turns ON server debugging output to database/server.log |
| 106 |
<DT><B>WRITE/READ</B> |
| 107 |
<DD>- set the basic database access permission levels for the |
| 108 |
read and write groups (admin users always have write access). |
| 109 |
Default is PASSWD, but NONE & WORLD can also be set. |
| 110 |
<dt><B>READONLY_DATABASE</B> |
| 111 |
<dd>- allows the server to run on a database where all the file permissions |
| 112 |
have been set to read-only (unix only) for extra security. |
| 113 |
</DL> |
| 114 |
|
| 115 |
<P>Unless you have special needs, the default settings are suitable for |
| 116 |
either testing or a production database, but you must create the empty file |
| 117 |
<b>wspec/serverconfig.wrm</b>. |
| 118 |
|
| 119 |
<P>See <A HREF="#config_options">Configuration options</A> for more details. |
| 120 |
|
| 121 |
|
| 122 |
<H3>2) Passwords in wspec/serverpasswd.wrm:</H3> |
| 123 |
|
| 124 |
<P>This file contains two types of record: groups/associated users |
| 125 |
records and individual user records. There are three groups: admin, write and read |
| 126 |
and to set up a database to run with the new socket server there needs |
| 127 |
to be <B>at least one user</B> in the admin group. |
| 128 |
|
| 129 |
<P>To 'bootstrap' an admin |
| 130 |
user so you can access the database via the client you need to: |
| 131 |
<OL> |
| 132 |
<LI>choose your admin userid (this does _not_ need to be an existing |
| 133 |
Unix userid, it can be any name you want), e.g. <B>joebloggs</B> |
| 134 |
<LI>alter the admin group line in <CODE><B>serverpasswd.wrm</B></CODE> so it looks like |
| 135 |
this: |
| 136 |
<PRE><CODE><B> |
| 137 |
admin: joebloggs</B></CODE> |
| 138 |
</B></CODE></PRE> |
| 139 |
<LI>now use the acedb utility program makeUserPasswd to create the |
| 140 |
user entry for joebloggs (note that you won't see the password |
| 141 |
you type): |
| 142 |
<PRE><CODE> |
| 143 |
> bin.<i>whatever</i>/makeUserPasswd joebloggs |
| 144 |
// Please enter passwd: jumbo10 |
| 145 |
// Please re-enter passwd: jumbo10 |
| 146 |
// The following line is a valid entry for wspec/serverpasswd.wrm |
| 147 |
|
| 148 |
joebloggs ccc5b9abf592836076410cdee518c518 |
| 149 |
|
| 150 |
> |
| 151 |
</CODE></PRE> |
| 152 |
<P>cut and paste the entry into a separate line in the <CODE><B>serverpasswd.wrm</B></CODE> file. |
| 153 |
</OL> |
| 154 |
|
| 155 |
<p>The resulting <b>wspec/serverpasswd.wrm</b> file would look like this: |
| 156 |
<PRE><CODE><B> |
| 157 |
admin: joebloggs |
| 158 |
joebloggs ccc5b9abf592836076410cdee518c518 |
| 159 |
</B></CODE></PRE> |
| 160 |
|
| 161 |
<P>Once the initial admin user has been set up, all other users can |
| 162 |
be set up from the admin userid via the new admin commands. |
| 163 |
|
| 164 |
<P>You should now be in a position to test the server and client, it is |
| 165 |
recommended that you test the server in the foreground before trying |
| 166 |
to set it up to be run by inetd. |
| 167 |
|
| 168 |
|
| 169 |
<H2>Server start up options</H2> |
| 170 |
|
| 171 |
<P>saceserver command line options are: |
| 172 |
<PRE><CODE> |
| 173 |
saceserver database_path <:port_number clientT:serverT:maxReq:autoS> |
| 174 |
|
| 175 |
<B>database_path</B> mandatory, gives path to the database |
| 176 |
<B>port_number</B> defaults to 23100 |
| 177 |
<B>clientT</B> client time out (secs), default = 600 |
| 178 |
<B>serverT</B> server time out (secs), default = 600 |
| 179 |
<B>maxReply</B> maximum reply size (Kbytes) that server should return |
| 180 |
<B>autoS</B> time between autosaves of database (secs), default = 600 |
| 181 |
</CODE></PRE> |
| 182 |
|
| 183 |
|
| 184 |
<H3>timeout values</H3> |
| 185 |
|
| 186 |
<P>The meaning of the timeouts is: |
| 187 |
<dl> |
| 188 |
<dt><B>clientT</B> |
| 189 |
<dd>the server will disconnect any clients who have not been active for this length of time. |
| 190 |
<dt><B>serverT</B> |
| 191 |
<dd>once all clients are disconnected, the server will timeout after this length of time. |
| 192 |
</dl> |
| 193 |
|
| 194 |
<P>So if, for instance, you wanted to allow clients to be dormant for an hour |
| 195 |
but have the server close down as soon as the last client quit you could start |
| 196 |
the server like this: |
| 197 |
|
| 198 |
<pre><code>saceserver your_database_path your_port 3600:1 |
| 199 |
</code></pre> |
| 200 |
|
| 201 |
<P>Note that clientT and serverT can take the special value zero which means |
| 202 |
the timeout is infinite, i.e. neither the client or server will ever be timed |
| 203 |
out. This special value is provided for testing and is specifically <B>not</B> |
| 204 |
recommended for normal use. |
| 205 |
|
| 206 |
|
| 207 |
<H3>maximum request size</H3> |
| 208 |
|
| 209 |
<P>The meaning of the maximum request field is: |
| 210 |
<dl> |
| 211 |
<dt><B>maxReply</B> |
| 212 |
<dd>If the reply to a client exceeds this threshold then the server "slices" the reply up |
| 213 |
and returns it a piece at a time. This prevents a single client from hogging the server. |
| 214 |
</dl> |
| 215 |
|
| 216 |
<P>Note that maxReply can take the special value zero which means |
| 217 |
that there is no maximum reply threshold and the server will return in one piece the |
| 218 |
entire reply. This special value is provided for circumstances where the user wants to get |
| 219 |
large replies back in one piece, you should note that other clients requests will not be |
| 220 |
processed while a large reply is being sent. |
| 221 |
|
| 222 |
|
| 223 |
<H3>port numbers</H3> |
| 224 |
|
| 225 |
|
| 226 |
<P>IANA (Internet Assigned Numbers Authority) has set aside certain ranges of port |
| 227 |
numbers for certain uses: |
| 228 |
|
| 229 |
<PRE><CODE> |
| 230 |
|
| 231 |
Port No. range Usage |
| 232 |
-------------- ----- |
| 233 |
|
| 234 |
0 - 1023 "well-known" ports, you need super user authority |
| 235 |
to use these and they are reserved for ftp, http, |
| 236 |
X windows and basic operating system services. |
| 237 |
<b>DO NOT USE THESE</b>. |
| 238 |
|
| 239 |
1024 - 49151 "registered" ports, if you setting up the server to |
| 240 |
be run by inetd you should use one of these. |
| 241 |
<B>But</B> you will need to check in /etc/services |
| 242 |
that your number does not clash with one already there. |
| 243 |
|
| 244 |
49152 - 65535 "dynamic" ports, are for dynamically assigned/ephemeral |
| 245 |
use. You should use one of these if you are just trying |
| 246 |
out the server from an xterm in the foreground. |
| 247 |
|
| 248 |
</CODE></PRE> |
| 249 |
|
| 250 |
<P>Actually its all more confused than this, not all operating systems stick to |
| 251 |
the IANA recommendations, but it is |
| 252 |
generally true that you cannot use a port less then 1024 without root permission |
| 253 |
and you should not in general choose these ports. |
| 254 |
|
| 255 |
<P>You should also <b>not</b> choose a port larger than 65535. If you do, the port |
| 256 |
number may be truncated in a way that leaves it in the range 0 - 1023 which are |
| 257 |
reserved for superuser use for well-known services. |
| 258 |
|
| 259 |
<P>Typically you will see these sorts of errors if you choose a port that is |
| 260 |
either below 1024 or already in use (you may have to look in the database |
| 261 |
logfile to see the error if the server is inetd started): |
| 262 |
|
| 263 |
<PRE><CODE> |
| 264 |
|
| 265 |
<B>typical server error:</B> |
| 266 |
|
| 267 |
% saceserver /mydatabase 777 |
| 268 |
// Database directory: /data1/GrainGenes |
| 269 |
// #### Server starts 2000-04-03_11:29:49 |
| 270 |
// #### host=(unknown) port=777 ACEDB=/data1/GrainGenes |
| 271 |
// #### clientTimeout=600 serverTimeout=600 maxKbytes=0 autoSaveInterval=600 |
| 272 |
|
| 273 |
// FATAL ERROR (www on gn) reported by program aceserver (ACEDB 4_9c), in file a |
| 274 |
cesocket.c, at line 657: Cannot bind to server listening socket system error 13 |
| 275 |
- Permission denied |
| 276 |
// Sorry for the crash, please report it, if it is reproducible |
| 277 |
|
| 278 |
// NB: changes made since the last explicit save have NOT been saved |
| 279 |
|
| 280 |
|
| 281 |
<B>typical client error:</B> |
| 282 |
|
| 283 |
% saceclient localhost -port 777 |
| 284 |
FATAL ERROR (www on gn) reported by program saceclient (ACEDB 4_9c), in file ace |
| 285 |
socketlib.c, at line 269: connect error system error 146 - Connection refused |
| 286 |
|
| 287 |
</CODE></PRE> |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
<H2>Running the Server</H2> |
| 292 |
|
| 293 |
<H3>in the foreground</H3> |
| 294 |
|
| 295 |
<P>To run the server in the foreground, type the following at the prompt in an xterm: |
| 296 |
|
| 297 |
<pre><code> saceserver <your/data/base> <your_port_number> <time_out_options> |
| 298 |
</code></pre> |
| 299 |
|
| 300 |
<P>If the server starts correctly your xterm will "hang" because the server will be sitting |
| 301 |
waiting for clients to connect. If something goes wrong acedb will print an error message and |
| 302 |
then exit. You should correct the error and then try again. |
| 303 |
|
| 304 |
<P>Once the server is starting correctly then try accessing it using the client: |
| 305 |
|
| 306 |
<pre><code>saceclient <host_where_server_is_running> -port <port_number_from_above> |
| 307 |
acedb> status |
| 308 |
acedb> quit |
| 309 |
</code></pre> |
| 310 |
|
| 311 |
<P>If you can connect correctly then you are ready to try running the server under the control |
| 312 |
of one of the unix <A HREF="#inetd">inetd</A> |
| 313 |
or <A HREF="#xinetd">xinetd</A> controller programs. |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
<a name="inetd"><H3>under inetd</H3> |
| 318 |
|
| 319 |
<P>You can now run saceserver against any existing acedb database |
| 320 |
and/or register it under inetd by adding lines to the following |
| 321 |
files (you will need root access): |
| 322 |
|
| 323 |
<P>For this example we assume: |
| 324 |
|
| 325 |
<PRE>nickname for server/database - MyfirstDB |
| 326 |
port for server - 20113 |
| 327 |
user owning database - mieg |
| 328 |
path to server binary - /usr/local/bin/saceserver |
| 329 |
path to database - /home/databases/aardvarkDB |
| 330 |
timeout values for server - 200:200:0 |
| 331 |
</PRE> |
| 332 |
|
| 333 |
|
| 334 |
<P><b>In /etc/services add the line:</b> |
| 335 |
|
| 336 |
<pre><code>MyfirstDB 20113/tcp |
| 337 |
</code></pre> |
| 338 |
|
| 339 |
|
| 340 |
<P><b>in /etc/inetd.conf add the line</b> |
| 341 |
|
| 342 |
<pre><code>MyfirstDB stream tcp wait mieg /usr/local/bin/saceserver saceserver /home/databases/aardvarkDB 200:200:0 |
| 343 |
</code></pre> |
| 344 |
|
| 345 |
<P>Where: |
| 346 |
|
| 347 |
<pre><code> <b>MyfirstDB</b> seen in both files, a random name of your choice to name the database server |
| 348 |
<b>stream tcp wait</b> mandatory, this is the way the daemon must be declared |
| 349 |
<b>mieg</b> user name under which the daemon runs, avoid root, |
| 350 |
choose some local user owning /home/databases/aardvarkDB |
| 351 |
<b>/usr/local/bin/saceserver</b> full path to saceserver executable |
| 352 |
<b>saceserver</b> repeat the name of the execuatble so that it is found as argv[0] by the code |
| 353 |
<b>/home/databases/aardvark</b> the database directory |
| 354 |
<b>200:200:0</b> server and client time out in seconds, then a blocking factor |
| 355 |
(default zero is ok) |
| 356 |
</code></pre> |
| 357 |
|
| 358 |
|
| 359 |
<P>Now get inetd to reread /etc/inetd.conf and pick up the information for MyfirstDB |
| 360 |
(you will probably need to be root to do this): |
| 361 |
|
| 362 |
<ol> |
| 363 |
<li>find out the process id of inetd |
| 364 |
<pre>> ps -A | grep inetd |
| 365 |
|
| 366 |
545 ?? I 0:00.62 /usr/sbin/inetd |
| 367 |
</pre> |
| 368 |
|
| 369 |
<li>Send inetd the interrupt signal |
| 370 |
<pre>> kill -HUP 545 |
| 371 |
</pre> |
| 372 |
</ol> |
| 373 |
|
| 374 |
|
| 375 |
<P>Sending this signal should be enough but on some old systems a reboot may be necessary. |
| 376 |
|
| 377 |
<P>Then access the server by starting up a client: |
| 378 |
|
| 379 |
<pre><code>saceclient <host_where_server_is_running> -port 20113 |
| 380 |
</code></pre> |
| 381 |
|
| 382 |
|
| 383 |
<a name="xinetd"><H3>under xinetd</H3> |
| 384 |
|
| 385 |
<P>xinetd is an open source replacement for inetd, it provides many more features and much |
| 386 |
security than inetd, you can read more about it at the |
| 387 |
<A HREF="http://www.xinetd.org/">xinetd website</A>. |
| 388 |
|
| 389 |
<P>Its configuration is a bit different from inetd and is as follows: |
| 390 |
|
| 391 |
<P>For this example we assume the following: |
| 392 |
|
| 393 |
<PRE>nickname for server/database - MyfirstDB |
| 394 |
port for server - 20113 |
| 395 |
user owning database - mieg |
| 396 |
path to server binary - /usr/local/bin/saceserver |
| 397 |
path to database - /home/databases/aardvarkDB |
| 398 |
timeout values for server - 200:200:0 |
| 399 |
</PRE> |
| 400 |
|
| 401 |
|
| 402 |
<P>In <b>/etc/services</b> add the line: |
| 403 |
|
| 404 |
<pre><code>MyfirstDB 20113/tcp |
| 405 |
</code></pre> |
| 406 |
|
| 407 |
|
| 408 |
<P>xinetd keeps its configuration files in the directory <b>/etc/xinetd.d</b>. Create a file |
| 409 |
in this directory giving it some meaningful name such as <b>acedb</b> and add the |
| 410 |
following lines: |
| 411 |
|
| 412 |
<pre><code># file: /etc/xinetd.d/acedb |
| 413 |
# default: on |
| 414 |
# description: wormbase acedb database |
| 415 |
service acedb |
| 416 |
{ |
| 417 |
protocol = tcp |
| 418 |
socket_type = stream |
| 419 |
port = 20113 |
| 420 |
flags = REUSE |
| 421 |
wait = yes |
| 422 |
user = mieg |
| 423 |
group = mieg |
| 424 |
log_on_success += USERID DURATION |
| 425 |
log_on_failure += USERID HOST |
| 426 |
server = /usr/local/bin/saceserver |
| 427 |
server_args = /home/databases/aardvarkDB 200:200:0 |
| 428 |
} |
| 429 |
</code></pre> |
| 430 |
|
| 431 |
<P>Note that you will need to change the port, user, group, server and server_args |
| 432 |
fields for you setup. |
| 433 |
|
| 434 |
<P><b>Warning:</b> In the past there have been a number of problems with the way |
| 435 |
xinetd worked which prevented users from running the acedb servers with xinetd. |
| 436 |
Currently the following combination of Linux, xinetd and acedb is known to work: |
| 437 |
|
| 438 |
<P><b>Linux:</b> Red Hat Linux release 7.3 (Valhalla), kernal: 2.4.18-27.7.xbigmem |
| 439 |
|
| 440 |
<P><b>xinetd:</b> xinetd-2.3.7-4.7x |
| 441 |
|
| 442 |
<P><b>acedb:</b> 4_9m |
| 443 |
|
| 444 |
<P>If you find that you cannot get acedb working under xinetd control then you should |
| 445 |
first check that you have up to date software. |
| 446 |
|
| 447 |
|
| 448 |
<H2>Running the client</H2> |
| 449 |
<PRE> |
| 450 |
|
| 451 |
Usage: saceclient <host> [-port pn] [-time_out <nn>] [-ace_out] [-ace_in] [-f file_name parms] |
| 452 |
|
| 453 |
host: is a machine where the server runs or is a registered service. |
| 454 |
pn: is the port number described in the server setup section. |
| 455 |
nn: is a number of seconds to wait to receive a server answer, it defaults to 300. |
| 456 |
-ace_out: implies a clean output: .ace files or clean tables |
| 457 |
-ace_in: if the input to the client is an ace file to be parsed by the server. |
| 458 |
-f filename: say for mailing, a command file which is echoed on stdout except |
| 459 |
that %1 %2 ... %9 will be macro substituted by the parms parameters and |
| 460 |
that the construction %(xxx) where xxx is a client command will be evaluated |
| 461 |
|
| 462 |
</PRE> |
| 463 |
|
| 464 |
|
| 465 |
<H2>Introduction of MD5 password encryption based authentification for users</H2> |
| 466 |
|
| 467 |
<P>The sockets based version comes with a new password based system. The previous |
| 468 |
versions of the server used a file based system that while not requiring |
| 469 |
users to user passwords, did require that both client and server could |
| 470 |
"see" the directory where the "magic" files used by the server for |
| 471 |
authentification were stored. This has obvious problems when the client and |
| 472 |
server are separated by a firewall, are very remote from each other or either |
| 473 |
is running on a system that does not support shared file systems. |
| 474 |
|
| 475 |
<P>The new system uses passwords much like any Unix system does, users have their |
| 476 |
own unique userid and must supply a password to gain access to the database. |
| 477 |
Note that userids are 'global' to a database, e.g. if two users on different machines |
| 478 |
by chance have the same userid, they cannot both use that userid to gain access to |
| 479 |
the database, one or the other will have to use a different userid for the database. |
| 480 |
This is the same restriction as applies to Unix login ids. |
| 481 |
|
| 482 |
<P>The new system uses a "challenge-response" protocol: the client contacts the |
| 483 |
server, the server sends the client a key, the client must then encrypt their |
| 484 |
userid, password and the key and send it back to ther server. The server then |
| 485 |
encrypts its copy of the encrypted userid/password with the key and compares |
| 486 |
them with what its been sent. At no time does the password pass in plain text |
| 487 |
across the network, nor is it stored in plain text. Furthermore, they key |
| 488 |
is changed every time the user logs on, making it more difficult to crack |
| 489 |
the password. While not perfect this method offers at least as much (actually |
| 490 |
more) security than the Unix password system. This is also essentially the |
| 491 |
method of security used in the http protocol. |
| 492 |
|
| 493 |
<P>There is a new file, <CODE>wspec/serverpasswd.wrm</CODE>, which holds |
| 494 |
the userids and associated passwords and also which group a userid belongs |
| 495 |
to. There are three groups of users: |
| 496 |
<DL> |
| 497 |
<DT>read |
| 498 |
<DD>users who can get read access to the database |
| 499 |
<DT>write |
| 500 |
<DD>users who can get read/write access to the database |
| 501 |
<DT>admin |
| 502 |
<DD>users who can get read/write access to the database and run |
| 503 |
administrative commands on the database (e.g. add new users, shutdown |
| 504 |
the database etc.) |
| 505 |
</DL> |
| 506 |
|
| 507 |
<P>Entries in this file are of two sorts: group entries and userid entries, below is |
| 508 |
a sample <CODE>wspec/serverpasswd.wrm</CODE> showing both group and userid |
| 509 |
entries (as usual lines beginning with "//" are comments): |
| 510 |
<PRE> |
| 511 |
// User groups |
| 512 |
// |
| 513 |
admin: edgrif |
| 514 |
write: simon |
| 515 |
read: jean richard sanger.ac.uk |
| 516 |
|
| 517 |
// users and passwords |
| 518 |
// |
| 519 |
edgrif 38a6557860893d95c7e738c0e5cd233d |
| 520 |
simon 7d61c0b3fb23c97f6970f07683a03649 |
| 521 |
jean 52af4f5526e16c855ca14a40287d1be1 |
| 522 |
richard 9dee3b01e9adeb11f8acac16fb368d76 |
| 523 |
</PRE> |
| 524 |
|
| 525 |
<P>Initially an admin user must create a new entry for a user, complete with password (see |
| 526 |
admin user section), after this a user can change their own password using the |
| 527 |
<CODE>passwd</CODE> command from the saceclient: |
| 528 |
<PRE><TERM> |
| 529 |
acedb> passwd |
| 530 |
enter new passwd: |
| 531 |
reenter new passwd: |
| 532 |
</TERM></PRE> |
| 533 |
Only rudimentary password checking is done, it is up to users/administrators to ensure |
| 534 |
that good passwords are chosen. |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
<H2>Introduction of domain name group authorisation and the NO_HOSTNAME_RESOLUTION option</H2> |
| 540 |
|
| 541 |
<P>The previous section described the format of entries in <CODE>wspec/serverpasswd.wrm</CODE>, |
| 542 |
the "read" and "write" group entries can also contain domain names: |
| 543 |
|
| 544 |
<PRE> |
| 545 |
// User groups |
| 546 |
// |
| 547 |
admin: edgrif |
| 548 |
write: simon |
| 549 |
read: jean richard sanger.ac.uk |
| 550 |
</PRE> |
| 551 |
|
| 552 |
<P>The "read" group entry contains the entry "sanger.ac.uk", this allows any user whose |
| 553 |
internet address ends with this sub-domain to log in with read access, e.g. |
| 554 |
[email protected], [email protected] etc. This makes it |
| 555 |
possible to give access to groups of people logging in from different sites. This only |
| 556 |
happens if the access level for a group is <CODE>PASSWD</CODE> and the userid of the |
| 557 |
connecting client cannot be found in the group. |
| 558 |
|
| 559 |
<P>When a client connects, the server only has the numeric version of the clients |
| 560 |
internet address, since the lookup required to convert this to the text form |
| 561 |
can be both error prone and slow, it is possible to globally disable this lookup |
| 562 |
by setting the <CODE>NO_HOSTNAME_RESOLUTION</CODE> option in <CODE>wspec/serverconfig.wrm</CODE>. |
| 563 |
If this option is set, the server will not attempt to resolve the text form of a clients |
| 564 |
internet address and match it to group name entries. |
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
<H2>Introduction of an "admin" class of user and a set of "admin" commands</H2> |
| 569 |
|
| 570 |
<P>The introduction of a password system made it necessary to introduce some |
| 571 |
extra commands to the command line interface: because users passwords are |
| 572 |
relatively long and must be copied into the password file correctly, this is |
| 573 |
only really feasible via a program. It also became clear that there should |
| 574 |
be a special class of user who would be allowed to run these commands and not |
| 575 |
just any user with write access as in previous servers. |
| 576 |
|
| 577 |
<P>Some "admin" commands already existed e.g. shutdown, these commands have |
| 578 |
been supplemented with additional commands including: |
| 579 |
<DL> |
| 580 |
<DT><B>shutdown [now] [norestart]</B> |
| 581 |
<DD>Shuts down the server, by default this is when the last client quits but |
| 582 |
if the <B>now</B> option is specified, clients connections are terminated |
| 583 |
immediately and the server is shut down. If the <B>norestart</B> is specified |
| 584 |
then the server will not restart until the lock file |
| 585 |
<CODE>database/SERVER_SHUTDOWN_LOCKFILE.wrm</CODE> is removed. |
| 586 |
<DT><B>who</B> |
| 587 |
<DD>display how many clients are currently connected. |
| 588 |
<DT><B>data_version</B> |
| 589 |
<DD>data served now, as stated in wspec/server.wrm |
| 590 |
<DT><B>wspec</B> |
| 591 |
<DD>export wspec directory as a tar file |
| 592 |
<DT><B>user passwd|group|new|delete <I>userid [password group]</I></B> |
| 593 |
<DD>This command has several forms enabling an admin user to create/update/delete userids: |
| 594 |
<UL> |
| 595 |
<LI>Create: <B>user new <I>new_userid new_group</I></B> (you will be prompted for the passwd) |
| 596 |
<LI>Delete: <B>user delete <I>userid</I></B> |
| 597 |
<LI>Change group: <B>user group <I>userid new_group</I></B> |
| 598 |
<LI>Change password: <B>user passwd <I>userid</I></B> (you will be prompted for the passwd) |
| 599 |
</UL> |
| 600 |
<DT><B>global read|write none|passwd|world</B> |
| 601 |
<DD>Change global read/write permissions for database |
| 602 |
<DT><B>domain group|new|delete <I>domain-name [group]</I></B> |
| 603 |
<DD>This command is similar to the <B>user</B> command but enables the admin user to |
| 604 |
create/update/delete domain names: |
| 605 |
<UL> |
| 606 |
<LI>Create: <B>domain new <I>new_domain new_group</I></B> |
| 607 |
<LI>Delete: <B>domain delete <I>domain</I></B> |
| 608 |
<LI>Change group: <B>domain group <I>domain new_group</I></B> |
| 609 |
</UL> |
| 610 |
</DL> |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
<a name="config_options"></a><H2>Server Configuration Options</H2> |
| 616 |
|
| 617 |
|
| 618 |
<H4>NO_RESTART (and the "phoenix" bug)</H4> |
| 619 |
|
| 620 |
<P>This option can be specified in <CODE>wspec/serverconfig.wrm</CODE> and will prevent the |
| 621 |
database from restarting after either a controlled shutdown or |
| 622 |
a server crash. If the option is specified then the server will |
| 623 |
leave a lockfile in the <CODE>database/</CODE> on shutdown or when it crashes |
| 624 |
(either in a trappable or non-trappable way). |
| 625 |
The name of the lockfile |
| 626 |
indicates whether the file was written as a result of a crash |
| 627 |
or a shutdown: |
| 628 |
<PRE> |
| 629 |
For a crash that was detected by the acedb code: |
| 630 |
|
| 631 |
database/SERVER_CRASH_LOCKFILE.wrm |
| 632 |
|
| 633 |
for a crash that could not be detected by the acedb code: |
| 634 |
|
| 635 |
database/SERVER_UNDETECTABLECRASH_LOCKFILE.wrm |
| 636 |
|
| 637 |
and for a shutdown: |
| 638 |
|
| 639 |
database/SERVER_SHUTDOWN_LOCKFILE.wrm |
| 640 |
</PRE> |
| 641 |
|
| 642 |
<P>The server cannot be restarted either manually or automatically by inetd until |
| 643 |
the lockfile is removed from the directory (the directory would normally be set up |
| 644 |
so that only admin users would have permission to do this). |
| 645 |
|
| 646 |
<P>Previous acedb servers have suffered from an irritating bug when run under the control |
| 647 |
of inetd. This bug (aka the "phoenix" bug) seemed to occur sometimes when the server |
| 648 |
crashed, the system would get into a loop with the server crashing, inetd respawning the server, |
| 649 |
the server crashing, inetd respawning the server, etc. etc. The advantage of the socket based |
| 650 |
server is that the greater degree of control over the port allowed debugging to show that this |
| 651 |
happens when a client has connected, but the server crashes <B>before</B> it has cleared the |
| 652 |
listening socket on which the client connected. In this case, inetd finds that there is still |
| 653 |
data on the listening socket and so it restarts the server which of course crashes again before |
| 654 |
clearing the listening socket. The new server has as part of its crash routine some code to |
| 655 |
clear the listening socket and thus put a stop to inetd trying to restart the server. Note |
| 656 |
however that this bug can still occur if the server crashes in an untrappable way, this |
| 657 |
loophole will be fixed at some time in the future. |
| 658 |
|
| 659 |
|
| 660 |
<H4>READ/WRITE options for setting global access permissions to a database</H4> |
| 661 |
|
| 662 |
<P>The <CODE>READ</CODE> and <CODE>WRITE</CODE> options can be specified in |
| 663 |
<CODE>wspec/serverconfig.wrm</CODE> and allow 'global' control of the access level |
| 664 |
for all users in the read or write groups. |
| 665 |
|
| 666 |
<P>Three levels of control are available: |
| 667 |
<DL> |
| 668 |
<DT>WORLD |
| 669 |
<DD>any user can have access, including users not specified in <CODE>wspec/serverpasswd.wrm</CODE> |
| 670 |
<DT>PASSWD |
| 671 |
<DD>only users specified in <CODE>wspec/serverpasswd.wrm</CODE> can gain access (with a password) |
| 672 |
<DT>NONE |
| 673 |
<DD>no users can have access |
| 674 |
</DL> |
| 675 |
|
| 676 |
<P>The access level is specified on the same line as the keywords <CODE>READ</CODE> or |
| 677 |
<CODE>WRITE</CODE>, e.g. to give read access to everyone and write access to no one, |
| 678 |
<CODE>wspec/serverconfig.wrm</CODE> should contain the lines: |
| 679 |
<PRE> |
| 680 |
READ WORLD |
| 681 |
WRITE NONE |
| 682 |
</PRE> |
| 683 |
|
| 684 |
<P>Admin group users always have write access to the database but this access is via a password. |
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
<H4>READONLY_DATABASE option</H4> |
| 689 |
|
| 690 |
<P>Normally the server must have read/write access to at least some of the files |
| 691 |
and directories within an acedb database (e.g. for logging). This option allows |
| 692 |
the server to run on a database where it only has read permission for <b>all</b> |
| 693 |
directories and files within the database. This can be useful as extra level of security |
| 694 |
for a database which has been made available as a "read only" copy, perhaps to |
| 695 |
any user anywhere on the internet. |
| 696 |
|
| 697 |
<p>You should note that when this option is specified, the server will not do |
| 698 |
any logging of requests or crashes, so there will be <b>no</b> record of users |
| 699 |
interactions with the server. |
| 700 |
|
| 701 |
|
| 702 |
<H4>DEBUG option</H4> |
| 703 |
|
| 704 |
<P>This option can be specified in <CODE>wspec/serverconfig.wrm</CODE> and will cause the server |
| 705 |
to send debugging output to <CODE>database/server.log</CODE>, if the server is being run |
| 706 |
in the foreground then the output will also be sent to stderr. Currently this information |
| 707 |
is patchy but this release of the server includes the basic mechanism (setting up callback |
| 708 |
routines for the messout/messerror routines) for easy output of debugging messages which |
| 709 |
was missing in previous servers. |
| 710 |
|
| 711 |
|
| 712 |
<HR> |
| 713 |
<H3 ALIGN="CENTER">ACEDB Version 4_9</H3> |
| 714 |
|
| 715 |
|
| 716 |
<HR> |
| 717 |
<ADDRESS><A href="mailto:[email protected]">Ed Griffiths <[email protected]></A></ADDRESS> |
| 718 |
<!-- hhmts start --> |
| 719 |
Last modified: Tue Apr 22 16:41:50 BST 2003 |
| 720 |
<!-- hhmts end --> |
| 721 |
|
| 722 |
</BLOCKQUOTE> |
| 723 |
</BODY> |
| 724 |
</HTML> |