![]() |
|||
| |||
|
SpaceKit for Perl, page 3
1 Introduction
2 Example Client Applications
» Example Server Implementation (bxxd.pl)
4 Example For The Impatient - Utilites
this article in RFC-2629 formats Example Server Implementation (bxxd.pl) The example server implementation is a simple Blocks server that can be used for testing basic connectivity with Blocks client applications. It does not provide datastore support, so it is not possible to perform any of the more advanced client operations, such as: fetch, store, search, etc.
The sample server does provide support for authentication for testing.
The example server application is located in the top-level examples/server directory.
Configuration
Configuration File Format bxxd.pl requires a configuration file in order to start.
The configuration file defines general server parameters as well as the available profiles and their associated parameters. The formal definition of the BXXD configuration file is available in the BXXD configuration DTD.
Global configuration parameters:
homeDirectory:
all relative pathnames are relative to this directory
moduleDirectory:
all relative module files are relative to this directory
logFile:
file to log events
debugLevel:
debug events, any of: "all", "trace", "timing", and "info" (seperated by spaces) or just "none"Per profile configuration parameters:
acl:
access control list for the profile
authDirectory:
all authentication files are relative to this directory
mode:
mode requested if the profile supports multiple modes of operationA typical configuration file contains the following parameters and profiles:
<?xml version="1.0"?> <!DOCTYPE config PUBLIC "-//Blocks//DTD BXXD CONFIG//EN" "http://xml.resource.org/blocks/software/bxxd/config.dtd"> <config> <bxxd port="10288"> <parameter name="homeDirectory" value="/path/to/bxxd" /> <parameter name="moduleDirectory" value="modules" /> <parameter name="logFile" value="logs/bxxd.log" /> <parameter name="debugLevel" value="none" /> <profile uri="http://xml.resource.org/profiles/sasl/ANONYMOUS" module="sasl-anon"> <parameter name="acl" value='subtree "" privs "fetch"' /> </profile> <profile uri="http://xml.resource.org/profiles/sasl/OTP" module="sasl-otp"> <parameter name="authDirectory" value="auth/" /> </profile> <profile uri="http://xml.resource.org/profiles/NULL/ECHO" module="null"> <parameter name="mode" value="echo" /> </profile> <profile uri="http://xml.resource.org/profiles/NULL/SINK" module="null"> <parameter name="mode" value="sink" /> </profile> </bxxd> </config>This is a configuration file for the default port 10288.
Running bxxd.pl from INETD To run the server under the supervision of inetd, first add the following to /etc/services:
bxxp 10288/tcp # Blocks eXtensible eXchange ProtocolSecondly, add the following to /etc/inetd.conf (Note: this should actually be one line, but was split for readability):
bxxp stream tcp nowait bxxpuser /path/to/bxxd/bin/bxxd.pl /path/to/bxxd/bin/bxxd.pl -config /path/to/bxxd/etc/bxxd-config.xmlWhere:
- bxxpuser is the supervisory username of the server.
- /path/to/bxxd/bin is the full pathname to the Blocks SpaceKit server bin directory.
- /path/to/bxxd/etc/bxxd-config.xml is the full pathname to the server configuration file.
You will need to reload inetd as super-user for the change to take effect.
Running bxxd.pl from the Command Line bxxd.pl can run from the command line in "stand-alone daemon" mode. Once started, it continues to run indefinitely. When a client connects, they are the exclusive connection to the server until the close of the session. This mode of running is typically used for testing purposes.
This example starts the server on port 12345 using the configuration file in the current directory named bxxd-config.xml:
bxxd.pl -daemon -port 12345 -config bxxd-config.xmlWithout "-port" the server uses the default port, 10288.
Simple Authentication and Authorization Layer (SASL) Authentication and authorization for the Blocks server is provided via either anonymous[5] or One-Time-Password[4] (OTP) SASL[3] user profiles. The location of this user data is in the configuration file as the "authDirectory" profile parameter. It is a combination of the server "homeDirectory" and the "authDirectory" parameters if authDirectory is a relative path name.
To create an anonymous or OTP user profile, see the SASL Administration utility.
A Complete Module Example For The ImpatientYou can create your own modules by defining a new profile and implementing a new server module as well as the client using the new profile.
In the example, we create a module named "reverse" that receives a server request, reverses the order of the octets in the request, and responds back to the client with the reversed results.
Profile Definition To access your new module, first define the new profile and its corresponding module in the configuration file for the port using the new profile:
<profile uri="http://xml.resource.org/profiles/REVERSE" module="reverse"> </profile>If you are using the server in stand-alone mode, you will need to restart since the configuration file loads at start time.
Utilities
Module Structure
SASL Administration Tool The SASL administration utility is found under the example server directory as etc/sasl-adm.pl. This utility will allow you to create, delete, list, and update the SASL anonymous and SASL OTP user accounts.
Usage: % etc/sasl-adm.pl [-action create|delete|list|update] [-authdir path/to/authdirectory] [-logfile path/to/logfile] [-mechanism anonymous|otp] [-version] [username] [subtree ...] where -action action to perform, defaults to create -authdir path to authentication database directory, defaults to ./auth, and will be created as needed -logfile path to log file, defaults to logs/sasl-adm.log -mechanism SASL mechanism, defaults to otp -version display application version and exit username user account to access, defaults to anonymous subtree list of subtrees user account will be given full access to, default subtree is empty and allows fetch operations on any subtree
Next » A Complete Module Example For The Impatient - Utilities
Footnotes » [3] Myers, J.G., "Simple Authentication and Security Layer (SASL)", RFC 2222, October 1997.
» [4] Newman, C. and J. G. Myers, "ACAP -- Application Configuration Access Protocol", RFC 2244, November 1997.
» [5] Newman, C., "Anonymous SASL Mechanism", RFC 2245, November 1997.
Copyright © 2000 Invisible Worlds. All Rights Reserved.
![]() |
|||
|