|
sreLite2 -- an http/1.1 server for OS/2 |
|
| Abstract | sreLite2 ver 1.10 is an http www server for OS/2. It is freeware, and requires the SRE2003 Internet Server. | |
Features of sreLite2 include:
| Although sreLite2 can be an effective WWW server.... | |
| sreLite2 becomes cumbersome to configure, and looses efficiency,
when you have a complicated set of redirections, aliases, and
access controls.
| |
| If you find that you would benefit from a richer set of features, consider SREhttp/2 (check it out at http://srehttp2.srehttp.org/). | |
| Note | sreLite2 is based on the SRELite "GoServe filter". Although the feature
set is similar, the configuration files (USERS.IN and SRELITE2.CFG) are
somewhat different. Also, unless explicitily indicated, SRE-http addons
will NOT run under sreLite2
In other words, migrating from SRELite to SRELite/2 will require some hands on tinkering. |
Do you have an up to date version of SRE2003? If not, get it and install it (http://sre2003.srehttp.org/)Let's assume SRE2003 is installed in the x:\SRE2003 directory
Alternatively, you can modify these files by using the on-line configuration tools accessible through the INDEX.SHT page (on the /SRE2K/sre2003 sub- directory of your "data directory").
By default, these configuration tools are:
The following parameters are contained in sre2003.CFG.
... For more details,see SRECFG1.HTM
... For most sites, the most important parameters are: sel_requires, aliases, superusers, and default_requires.
| ACCEPT_RANGE | Enable range requests. |
| ADD_SLASH | Check for "subdirectory without trailing /" entries |
| ALIASES | Aliasing rules. |
| ALWAYS_GET_PRIVS | Always get client specific privileges |
| DEFAULTS | list of default names to use when request ends with a / |
| DEFAULT_REQUIRES | Default required priviliges |
| DIR_EXCLUSIONS | Directory exclusion list. |
| DOMD5 | Create and MD5 response header |
| GZIP_THESE | On the fly GZIP encoding |
| HOME_DIR | The users-home directory replacement for ~ |
| INHOUSEIPS | Automatically grant client priviliges by IP address. |
| LOAD_ADDON | Addons to load into macrospace for quicker execution |
| LOGIT | Record entries in a common log file. |
| NOT_FOUND_FILE | A 404 response file |
| POST_FILTER | A procedure to call after responding to a request |
| REALM | Define a realm name |
| SSI_EXTENSIONS | List of server side include extensions. |
| SUPERUSERS | Define a list of superuers. |
| SEL_REQUIRES | Selector specific access requirements |
| VERBOSE | Verbosity of status messages. |
SRELite2 supports a moderately complex set of access controls rules.
The basic notion is:
Client privileges are assigned using the SUPERUSERS and INHOUSEIPS parameters, and using the USERS.IN file.
USERNAME PASSWORD client_Privilege_list
where all fields can contain letters (A-Z, a-z), numbers (0-9), and _ characters:
> Username is a case insensitive username
The format of username is one of:
username -- username applies to all hosts, including the "Generic" host"
host_nickname/username -- username ONLY applies to requests to host_nickname
/username -- username ONLY applies to requested to the generic host
> Password is possibly case-sensitive (depending on the client's authorization protocol)
It can contain A-Z, a-z, _, and 0-10.
> Client_privilege_list is an optional space delimited list of "privileges".
You can also use a * for either username or password ---
>> the * character for password means "any password will do".
>> the * in USERNAME is a wildcard -- it means "any username
(say, for this host_nickname)
TIGER/JONES
JONES
TIGER/ *
*
Or, for a request to the "generic host" (i.e.; if you did NOT specify any
host nicknames), and the username is PAUL:
/PAUL
PAUL
/ *
*
| Note that /PAUL means: | check for username PAUL on a request to the generic host only |
| whereas PAUL means: | check for username PAUL on ALL requests (perhaps after checking for a host-specific PAUL). |
In any case, if a username is found, it's password is compared to what the client provided. If the password does not match, then the username is not a match.
; this is a comment (starts with ;) OUTATOWN SHEP2 INHOUSE MASTER1 12ISIE6 SUPERUSER user1 1user Priv1 Priv2 ANONYMOUS * PUBLIC TIGERS/Jill cats dogs SHOP/* shopper visitorx /BILL PILL SILL TIGERS/BILL WILL NILL BILL HILL MILL
| !RESET |
Reset sreLite2 parameters. This requires SUPERUSER
privileges |
| !RANGE:rtype=a1-a2/asel | Add a RANGE item to the
IM information. If you've selected
XRANGE as your
IM_DEFAULT,
this RANGE IM
information will be used to extract a portion of aselector.
Rtype defines how to extract this range:
|
A simple example might help:
then, SRElite2 will use E:\WWW\MYFILES\PROJECT1\BIGTASK.HTM
Note that if a GET HTTP method was used, the request selector may contain
information following a ?
For example... /SHOWINFO?DATABASE=PRICES&ITEM=APPLES
Example: http://WWW.SREHTTP.ORG:80/calc/calc.htm
Examples:
/JOE/* will match /JOE/FOO.HTM
/JOAN/SRCH.HTM?* will match /JOAN/SRCH.HTM?search+me
/JOAN/SRCH.HTM?* will NOT match /JOAN/SRCH.HTM
(/JOAN/SRCH.HTM* will match BOTH these examples)
/PETS/*INDEX.HTM will match
/PETS/INDEX.HTM, /PETS/CAT/INDEX.HTM and /PETS/PUPPY/LAB/INDEX.HTM
but will NOT match
/PETS/CAT/PUREBRED.HTM
Wildcard matching is used when examining SEL_REQUIRES, ALIASES, and
INHOUSEIPS.
The basic rule is that both a "target" and a "replacement" should contain * characters. When a wildcard match between the target and a candidate occurs, the "covered portion of the candidate" is inserted into the "replacement". In other words, the * character in the replacement is deleted, and the "covered portion" is inserted.
Example:
The following lists a few useful procedures provided in the sreLite2
procedure library. These complement the procedures in the sre2003
procedure library (as described in SRE2PRC.HTM).
SREL2_RESET Reread configuration files
SREL2_MULT_SEND Send a multi-part document
SREL2_GET_USERINFO Extract information on a user
SREL2_CHECK_PRIVS Check a list or privileges against a second list
--------------------------
SREL2_CHECK_PRIVS
Check to see if the user has one of the required privileges.
Syntax:
imatch=srel2_check_privs(privs_to_check,privs_granted)
where:
privs_to_check : a space delimited list of privileges (as may be specified
if a sel_requires entry).
privs_granted: the privileges of this user; say, as derived from srel2_get_userinfo
(that is, as specified in USERS.IN).
and
imatch:
0 -- none of the the names in the userlist have any of the
privileges contained in the privs_to_check list
n -- the first privilege, in the privs_to_check list, found in privs_granted
Notes:
* If privs_granted='', then always return 0
* If privs_to_check='', then always return 0
* a "*" in Privs_to_check matches anything (thus, if * is the 3 element in
privs_to_check, then always return 1, 2, or 3).
SREL2_GET_USERINFO
Determine username, password, and privileges; given either a list
of possible usernames, or (more commonly) based on information found
in an authorization request header
Syntax:
imatch=srel2_get_userinfo(userlist,authh,host_nick,id_info)
where:
userlist: Optional.
The list of users to try finding privileges for.
The first "existing" user in this list is used
If blank, then construct a user list (see below)
If userlist is not specified (which is the usual mode of operation),
then the following two variables may be used:
authh: optional. The authorization header. If not provided, it will
be looked up
host_nick: optional. The host nickname.
If not provided, it will be looked up.
If there is no host nickname for this request, the "generic"
host is assumed.
id_info: optional, The id_info (include this to speed up processing a bit)
and
Imatch:
' ' -- No match. This can happen for a number of reasons:
1) none of the the names in the userlist could be found in the
userfile
Note that if userlist IS specified, then passwords are NOT checked
2) userlist was not specified, and
a) there was no authorization request header
b) the username in the authorization request header was not
found in the userlist, or had a mismatching password
user_record -- Match found. The user_record contains:
username password priv1 ... privn
Note that the username indicates which username (in the
possibly auto-generated userlist) was matched.
Notes:
* When userlist is not specified, a userlist containing 4 usernames is constructed.
These are derived from the authorization header; and are subject to "password" checking.
The 4 names consist of:
1) The "host-specific" username.
For request that are not to host for which a host-nickname exist (that is, for
requests to the "generic" host), use /username (i.e.; preface the username
with a /).
2) The non-host-specific username.
3) The host-specific wildcard
4) The default wildcard
Thus, if the host nickname is TIGER and the username is JONES
then the following entries will be looked for in the userfile
TIGER/JONES
JONES
TIGER/*
*
Or, for a request to the "generic host" (i.e.; if you did NOT specify any
host nicknames), and the username is PAUL:
/PAUL
PAUL
/*
*
In any case, if a username is found, it's password is compared to what the
client provided. If the password does not match, then the username is NOT
used (a ' ' is returned).
* A return of ' ' often means you should send an authorization response
(i.e.; using sre_auth_response)
SREL2_MULT_SEND:
Send a piece or a part of a response.
For the details, see MULTSEND.DOC.
SREL2_RESET:
Reset the sreLite2 configuration parameters -- re-read sreLite2.CFG,
USERS.IN, or HOSTINFO.CFG.
Syntax:
astat=srel2_reset(not_params,douser,dohost)
where all the parameters are optional:
doparams = if not_params<>1, then reread sreLite2 configuration
parameters file (sreLite2.CFG)
douse = douser=1, then reread the username file (USERS.IN)
dohost = if dohost=1, then reread the sre2003 host definitions file
(HOSTINFO.CFG)
astat = if no errors, a 1 is returned
Otherwise, 'ERROR an_error_message'
Example:
f=srel2_reset() -- just reread sreLite2 configuration parameters
f=srel2_reset(,1) -- configuration parameters and user
f=srel2_reset(1,,1) -- reset hostinfo, do NOT reset configuration
As an component of the sre2003 suite, the disclaimer for SRElite2 is the same. Basically,
Permission to use this program for any purpose is hereby granted without fee, provided that the author's name not be used in advertising or publicity pertaining to distribution of the software without specific written prior permision.For the complete disclaimer, please see sre2003.HTM.SRELITE2 and related product are NOT guaranteed to be secure.
THIS SOFTWARE PACKAGE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.