Nick Holland wrote:
Assuming you want to limit time-per-day, but don't care when, how about
this:
Use authpf to control and track usage. In order for the user to
actually get access to the "regulated" sites, they must first state
their intention by running authpf to open access to that site.
I've been thinking more about this today and think I may be able to
leave authpf out of the picture - instead using tcpdump ie: tcpdump -i
vr1 -c 1 -q 'host 207.46 and 192.168.0.4' which will tell me if she's
connected with msn and will print out a timestamp if she is.
Every minute, a cron job looks for running authpf processes, and if
found, logs a line to a file. If that file gets to 60, 90, 120,
whatever lines long, the same cron job will add the user's name to the
/etc/authpf/banned directory, and killing the existing authpf session.
I'll create a file with the date as the filename and the time limit in
minutes echoed to it each morning after midnight and run another cron
which will check if there is any time left on msn and increment the
number of minutes down whenever the the tcpdump message returns a valid
time.
The problem I have now is how do I code tcpdump to exit after a period
of time if a packet is not found?