			  BBS-Util v0.9 for Linux
		 	       by Adam McKee


BBS-Util was inspired by Andreas Schiffler's BBLinux package.  BBLinux was
written by Andreas in short order so that he could enforce time limits on
his BBS "The GNU", and it does this quite well.  BBS-Util simply provides more
utilities to make administration of a BBS under Linux easier.  Here is a quick
summary of each utility:

--- Programs Used by Users ----------------------------------------------------

timeleft:
	Tells users how much time they have left before they will be
	booted from the system (i.e. all their processes killed with
	extreme prejudice ;-).

daysleft:
	Tells users how many days they have left before their account
	expires.  Upon expiration, an account may be either deleted or
	unsubscribed.  (see user_renew, user_subscribe, user_unsubscribe)

--- Programs Used by Administrator --------------------------------------------

user_add <login>:
	Creates passwd file entry AND record in the BBS user database.
	user_add prompts for "days to live" and "time per day", in addition
	to prompting for the usual user-creation information.  "days to live"
	is the # of days the account will be allowed to exist.  If it equals
	0, the account will be allowed to exist indefinitely.  "time per day"
	is simply the # of minutes / day the user should be allowed.

user_del <login>:
	Removes passwd file entry AND record in the BBS user database.

user_data <login>:
	Shows BBS user record in a readable format.

user_kick <login>:
	Give a user the boot (i.e. kill all of their processes).

user_purge <days>:
	Remove accounts which have not been used in a certain # of days.
	The <days> argument must be > 14, or the program will terminate
	with an error message.

user_renew:
	At midnight (or some other time), it is necessary to renew each users's
	time.  This is done by simply calling user_renew from root's crontab:

0 0 * * *	/home/root/bin/user_renew

	user_renew also takes care of expired accounts and subscriptions.

user_subscribe <login> <days> <minutes>:
	Give a user x minutes / day for the next y days.  For example, you
	could specify that you want user "smith" to be given 90 minutes / day
	for the next month, and his present time limit would be restored
	automatically at the end of the month.  user_subscribe records certain
	fields in the user's BBS record, so that they can be restored later by
	user_unsubscribe.  (see user_unsubscribe)

user_sync:
	Used to synchronize the BBS user file with the password file.  Any
	records with a uid field that is NOT associated with a login name in
	/etc/passwd are deleted.  user_sync should be run every month or so
	just to ensure things are kept relatively sane.

user_time <login> <days> <minutes>:
	Directly change the expiry date and daily time limit of a user.  A
	<days> argument of 0 means that there will be *no* expiry date for
	the user.

user_touch:
	Modify a user's "last online" field to equal the current date.  This
	is useful if you want to exempt certain users from the effects of
	user_purge.  (see user_purge)

user_unsubscribe <login>:
	Terminate a users's subscription.  This is normally called from
	user_expire, but can be run directly.  Terminating a subscription is
	simply a matter of restoring a user's daily time limit and expiry
	date to their values before the subscription was given.

user_updated:
	user_updated is a daemon that comes alive every 60 seconds to:

	for any users currently logged in:
	  - update their "time left" field (i.e. subtract 1 from it)
	  - update their "last time online" field, so that user_purge can
	    use this information.
          - if they have used up all of their time, give 'em the BOOT.
	if "guest" is not logged in, refresh his time remaining to 10 minutes.

	You'll probably want to have user_updated started automatically upon
	system boot.  If you want "guest" to get more than 10 minutes, just
	edit user_updated.c.

--- General Instructions ------------------------------------------------------

To install BBS-Util:

	- edit the Makefile to your liking (if you change ROOT_BINPATH, also
	  change it in "bbs-util.h")
	- run "make install"
	- make addition to root's crontab as outlined above

You should also implement a check in /etc/profile and /etc/csh.login (and
whatever other shell startup files...) to ensure that only users who actually
have some time left are allowed to get an interactive session.  It is also
a good idea to make sure there is not already another guest user using the
system.  Here are examples for /etc/profile and /etc/csh.login:

/etc/profile: ----------------------------------------

if [ "`timeleft`" = "0 minute(s) remaining." ]; then
  echo
  echo No time left... 
  sleep 2
  logout
fi

if [ "$LOGNAME" = "guest" -a "`timeleft`" != "10 minute(s) remaining." ]; then
  TLEFT=`timeleft | cut -d " " -f 1`
  echo
  echo There is already one guest user using the system. 
  echo
  echo Call back in ${TLEFT} minute\(s\).
  sleep 2
  logout
fi

/etc/csh.login: --------------------------------------

if ( "`timeleft`" == "0 minute(s) remaining." ) then
  echo -n \\n
  echo No time left...
  sleep 2
  logout
endif

if ( "$LOGNAME" == "guest" && "`timeleft`" != "10 minute(s) remaining." ) then
  set TLEFT = timeleft | cut -d " " -f 1
  echo -n \\n
  echo There is already one guest user using the system. 
  echo -n \\n
  echo Call back in ${TLEFT} minute\(s\).
  sleep 2
  logout
endif

-------------------------------------------------------------------------------

Bug reports, and ideas for improving BBS-Util will both be appreciated.
Also, feel free to let me know if BBS-Util is working great and serving
you well :-)

	- Adam McKee		<Adam.McKee@usask.ca>
