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 (cc -o timecon timecon.c) and place it in /usr/bin.
Also put timecon.init in /usr/bin and give it execute permissions.

Copy timeconrc to /etc and edit it, changing what you need to.

You will need to create a file /usr/lib/timecon-admin (see /etc/timeconrc for 
changing this location). This should be mode 0600 because it contains a
password. 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. (You should also give it execute permissions).
For example, in Debian GNU/Linux, to have the timers reset every day put it
in /etc/cron.daily. If you reboot, the timers will also be reset.

You will need to edit timecon.cron, and change the lines beginning with
"timecon.init". 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 . /etc/timeconrc; kill -USR1 `cat "$PIDDIR"/%u`
	ondisconnect . /etc/timeconrc; kill -USR2 `cat "$PIDDIR"/%u`

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 end of 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 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.
