=========================================================================
 BBLinux 0.3 - Bulleting Board Linux
=========================================================================

The following collection of files and text will help converting a Linux
system into a BBS in (almost) no time. Most of it a quick hack but should
serve as a good starting point. Any help or improvements are welcome ...
as you can see most of the contents is contributed.
I will try to collect changes and additions, incorporate them and make 
them available in the same package. 

Everything is under the GPL of course.

Andreas Schiffler, andreas@karlsberg.usask.ca, andreas@milo.usask.ca
1230 11th St. E, Saskatoon, Sask, S7H 0G3, Canada


Changes
-------

0.1	- initial release
0.2	- added dialog based menu
	- added fidonet section (contributed)
0.3	- added html-registration form and cgi-script (contributed)
	- updated README slightly
	- added Makefile
[0.3 released Nov 95]


Files
-----

 README			- this file
 README.fidonet 	- explains how to tie in fidonet
 README.register	- explains how to use registration form
 listcheck.c		- kick-out-program
 timecheck		- shows time left
 limitcheck		- shows exceeded quotas
 newuser		- creates an account
 mainmenu		- sample menu system based on the 'dialog' program
 xxx.sample 		- sample files from The Gnu BBS
 register.html  	- HTML registration form
 register-cgi.c 	- cgi-program to handle registration form

Quick note
----------

You are encouraged (and required) to change almost every script, textfile
and program that is in the package. That might seem like a lot of work, but
that way you have a UNIQUE board and get to know the tools that make it a
BBS - also, that's what Linux is all about!


Listcheck - Login-Time Manager for Linux
========================================

The purpose of this program is to give certain users only a certain amount
of login time. This would be a common use for Linux as a BBS system. The
program is simple and completely unoptimized but does its job well. 

Check the source code for a quick overview of what it does - all the files
and settings are hardcoded into listcheck.c at the beginning.

How it works:
-------------

The key to the timing checking is a ASCII list in /etc with two number on
each line: the user ID and the number of time intervals left. The listcheck
program is called in regular intervals with a crontab entry. If a user has a
process running, it will decrement his/her interval counter in the list. If 
the counter reaches 0, all processes of that particular user are terminated. 
The list gets reset by copying a backup list onto the current list via cron. 
Crude but effective. A warning message when time is low is currently not 
implemented (I don't care - but it should be a piece of cake to put in).

Installation:
-------------

1.) The current timing interval is 5 minutes. If you want to change that
    listcheck.c, the crontab entry and the timecheck program have to be
    changed. The current guest user ID is 500. Change it or leave it.

2.) Compile the 'listcheck' program:

     make

3.) Move the program 'listcheck' to the desired location i.e.

     cp listcheck /usr/bin/listcheck

4.) Create a file '/etc/usertimes' with the following syntax:

     UID1 TICK1
     UID2 TICK2
     ....
    where GIDn is the user ID for the n-th user and TICKn is the
    corresponding online time as the number of calls to 'listcheck'.

     vi /etc/usertimes

5.) Make a copy of '/etc/usertimes':

     cp /etc/usertimes /etc/usertimes.backup

6.) Add the following two lines to root's crontab:

     0,5,10,15,20,25,30,35,40,45,50,55  * * * * /usr/bin/listcheck
     59 23 * * * cp /etc/usertimes.backup /etc/usertimes

    The first line will check every 5 minutes for users to be
    kicked out (can be any interval). If TICK in /etc/usertimes is zero all
    processes of the user with UID will be terminated and killed using
    the 'kill' command. Thus giving a user a TICK of 12, will give him
    access for 1 hour each day.
    The second line will reset the count at 23:59 every day. Make sure that 
    both processes are not started at the same time as results of this
    are unknown.
    Users not listed in /etc/usertimes are unaffected.

7.) To prevent users from logging in again after their time has expired add
    the following to the '/etc/profile' file:
     
     # check timeout #
     if [ "$UID 0" = "`grep $UID /etc/usertimes`" ]; then
      echo
      echo No more time for today ... 
      echo
      logout
     fi 

     see 'profile.add' for a copy of this

8.) Reboot to activate ... if you trust init :-) just to a:
	kill -HUP 1

9.) Included is a shell program to tell people when they will be logged out:

    timecheck

    A sensible place for this is again /usr/bin and a call from /etc/profile

10.) Included is a shell program used to create an account

     newuser

    It will attempt to mail 'hello.letter' to the new user and show you 
    'userlevels' to remind you how many minutes per $$$ you give out.

11.) The 'profile' is usually more complicated. I use lynx as the BBS front
     end. A copy of my profile is included in 'profile.sample'.

12.) Consider putting people into a 'dialog' based menu to give them access
     to mail and news by selecting from a range of choices. 
     Included is a shell script for doing just thatplus more (also has
     configuration capabilities):

     mainmenu 

Other considerations for BBS use:
=================================

Just some tips from my BBS (formerly "The Gnu", Saskatoon, Canada - offline)
which can get you a BBS in a matter of hours.


1. Filespace:
-------------

So prevent users from hanging the system by filling up all space (i.e. with
a 'yes >junk &') the quota kernel patches are used. 
The quota system on Linux is crude but works (1.1.8x). Three things make it
run smoothly. Give people a high LIMIT value, so that they can create large
files in /tmp. That is important for editors, downloading with lynx and
general unix power. I clean up the /tmp directory once per day check the
quota limits of all users like that, whenever I log in:

  #!/bin/bash
  echo Checking exceeded quotas of users
  echo --------------------------------------------------
  for i in /home/*; do quota -q ${i##/home/}; done


2. The Interface
----------------

As interface I use a httpd server and Lynx. That way users get a cool
hypertext interface to everything. People can download from within Lynx via
the 'D' command and the 'sz' program. The setup to get the filenames right
is as follows:

... in file /usr/lib/lynx/lynx.cfg ...

 DOWNLOADER:Xmodem:i=%s;j=/tmp/%s;mv $i $j;sx -a $j;mv $j $i:TRUE
 DOWNLOADER:Ymodem:i=%s;j=/tmp/%s;mv $i $j;sb -a $j;mv $j $i:TRUE
 DOWNLOADER:Zmodem:i=%s;j=/tmp/%s;mv $i $j;sz -aw 1024 $j;mv $j $i:TRUE

Included in this package is a shell script that uses the "dialog" program
(you know that from the Slackware installation) to provide a menu - it
should be run from /etc/profile and is used to start all the other clients
like lynx, pine, tin, games, ... . 
Just run the "mainmenu" script and have a look. 


3. News and Mail
----------------

Well, mail is already installed (i.e. from the Slackware N disk set) and for 
news services just install a package and it's done. To actually get a local
news pool to work, a bit more configuration and installation is necesary and
I'll refer you to the documentation of the relevant packages.


4. Registration
---------------

I have a guest account (UID=500) with 10 minutes time. People get an intro
message and are placed into the 'mail' program to leave me their name and
address. Or better even: use a custom HTML form with cgi-script to get the 
personal information.

See the README.register file 


5. Login Program
----------------

I use mgetty, since I could not get uugetty to work with modems <14.4K. Its
nice, since people can use the same phone-line as a Fax line. Other than
that a simple getty connected to a serial port will do. Edit the file
	/etc/inittab
To get a nice screen before the login prompt, edit
	/etc/issue
I usually start it with a clear-screen command which you can generate using
	clear >/etc/issue


6. Fidonet
----------

See the README.fidonet file.
