This is for creating time limits for how long users can remain connected within a certain time period. (e.g. Mary is allowed to be connected for 3 hours per
day).

If you run dwun as a non-root user, then you will have to tweak the file 
locations. This setup requires netcat. (Try http://www.l0pht.com/~weld/netcat/).

Compile timecon.c with
	cc -o timecon timecon.c
and place it at /usr/bin/timecon. Also put timecon.init in /usr/bin.

Put timeconrc in /etc and edit it, changing what you need to. (Probably at least
DWUN_HOST).

You will need to create a file /usr/lib/dwun-admin (see /etc/timeconrc for 
changing this location). This should be mode 0600 for security reasons. Enter in
it
	user admin
	pass my_admin_password
Obviously replace my_admin_password with the password for the admin user in
dwun.

Put timecon.cron somewhere where it will be run on cron on the basis you want
the timers to be reset. For example, in Debian GNU/Linux, to have the timers
reset every day put it in /etc/cron.daily.

You will need to change the lines beginning with "timecon.init" in timecon.cron.
The format for these is
	timecon.init username seconds
Username is the username you wish to set the timer for and seconds is the number
of seconds they are allowed to be connected between timecon.cron runs.
(e.g. 3 * 60 * 60 = 10800 for 3 hours).

Edit /etc/dwunrc and add the following
	onconnect kill -USR1 `cat /var/run/time-control.%u`
	ondisconnect kill -USR2 `cat /var/run/time-control.%u`
	max_from_one 1

You will want to do something else in the onconnect/ondisconnect lines to make
sure people with locked accounts can't access the internet when other people
are connected. For example, on Linux 2.2 systems, 
	/sbin/ipchains -A forward -j MASQ -s %b -i ppp0
could be added to the onconnect command and
	/sbin/ipchains -D forward -j MASQ -s %b -i ppp0
to the ondisconnect command. (And make sure masquerading isn't enabled for users
elsewhere).

Restart dwun (telnet in as admin and issue the RESTART command), do an initial
run of timecon.cron (ignore the error message) and you're all set.

If you want to have a user account LOCKed, but it is already LOCKed by
time-control, remove the username from /usr/lib/timecon-locks so it won't be
UNLOCKed by the cron time-control job.
