🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: bit.listserv.openbsd-pf
3 messages
3 total messages Started by Sebastian Singer Fri, 12 Apr 2013 11:03
throttle traffic by amount of time or amount of used traffic in GB?
#179
Author: Sebastian Singer
Date: Fri, 12 Apr 2013 11:03
76 lines
4747 bytes
--b1_640f1d1d2f4d8709af0e499c17a42466
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi,

I am not generally against video games and other related online stuff. But =
my son (age 16) is in WOW, COD, Mindcraft and the like by approximatly 8 to=
 12 h a day. The same is to be observed in my friends families. Our childre=
n get lost to their loved ones because of computer game addiction. Cutting =
of the Internet completely doesn't work. He would walk over to one of his f=
riends and keep on gaming there. Talking to him for hope of reaching common=
 sense has been a vain endeavour so far.

So I do not want to cut him off the internet completely, just limit his ban=
dwidth so much that he is throttled if he has reached a set time limit or e=
lse if he reaches a certain amount of gb used.

So the question is: is pf (ALTQ especially) able to cope with these require=
ments? And if how would such rules in pf.conf look? I am by far no pf guru =
but have run a OpenBSD SOHO server for about 10 years. So I think I do have=
 a basic unterstanding of pf matters.

Every helpful answer is whole-heartedly appreciated.

Just one thing: Please stick to the technical focus of the question. Educat=
ional advice need not be given as I have received enough of it in the past =
already. And as far as I have seen and heard I am not the only father havin=
g to deal with these kind of problems. Thank you.


Sebastian
Founding member of
"Awfully Livid Parents Against Computer Addiction - ALPACA"
-- 



--b1_640f1d1d2f4d8709af0e499c17a42466
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi,<br />
<br />
I  am not generally against video games and other related online stuff.  Bu=
t my son (age 16) is in WOW, COD, Mindcraft and the like by  approximatly 8=
 to 12 h a day. The same is to be observed in my friends  families. Our chi=
ldren get lost to their loved ones because of computer  game addiction. Cut=
ting of the Internet completely doesn't work. He  would walk over to one of=
 his friends and keep on gaming there. Talking to him  for hope of reaching=
 common sense has been a vain endeavour so far.<br />
<br />
So  I do not want to cut him off the internet completely,&#160; just limit =
his  bandwidth so much that he is throttled if he has reached a set time li=
mit  or else if he reaches a certain amount of gb used.<br />
<br />
So the question is: is pf (ALTQ especially) able to cope with these require=
ments? And if how would such rules in pf.conf look? I am by far no pf guru =
but have run a OpenBSD SOHO server for about 10 years. So I think I do have=
 a basic unterstanding of pf matters.<br />
<br />
Every helpful answer is whole-heartedly appreciated.<br />
<br />
Just  one thing: Please stick to the technical focus of the question. Educa=
tional advice need not be given as I have received enough of it in the past=
 already. And as far as I  have seen and heard I am not the only father hav=
ing to deal with these  kind of problems. Thank you.<br />
<br />
<br />
Sebastian<br />
Founding member of<br />
"Awfully Livid Parents Against Computer Addiction - ALPACA"<hr style=3D"bor=
der:dotted 1px silver; width:90%; border:dotted 1px silver;"><br />


--b1_640f1d1d2f4d8709af0e499c17a42466--
Re: throttle traffic by amount of time or amount of used traffic in GB?
#180
Author: Kirk Ismay
Date: Sat, 13 Apr 2013 06:04
52 lines
3536 bytes
On 2013-04-12 1:34 AM, Sebastian Singer wrote:
>
> Just one thing: Please stick to the technical focus of the question. 
> Educational advice need not be given as I have received enough of it 
> in the past already. And as far as I have seen and heard I am not the 
> only father having to deal with these kind of problems. Thank you.
Sebastian,

On our family Windows box, I use this to limit the time on the computer 
and ensure fair use:
http://www.timesupkidz.com/

It can be set to allow 1/2 hour of use and force a 15 minute break, for 
example. It also has time of day restrictions.  You mention WoW and 
Minecraft, so windows use is a fair assumption here.

To use PF to enforce restrictions, you could have Cron update a PF table 
and add or remove all the ip's (the xbox, tablet, windows box, etc) 
based on the time of day. Once you've got the table in place, you can 
either do blocking rules (no access to WoW server for ips in the table), 
or altq rules (throttle access to a list of IPs from the table).

A shell/perl/whatever script run from cron could also be used to parse & 
tally data used by IP from PF.  Assuming you have a table called 
internal listing all your IPs on your lan, the following command shows 
how much data has been used per ip:

pfctl -v -t internal -Tshow
192.168.1.12
         Cleared:     Fri Apr 12 08:13:16 2013
         In/Block:    [ Packets: 0                  Bytes: 
0                  ]
         In/Pass:     [ Packets: 125                Bytes: 
9395               ]
         Out/Block:   [ Packets: 0                  Bytes: 
0                  ]
         Out/Pass:    [ Packets: 91                 Bytes: 
6460               ]


AuthPF can be used to further alter pf rules, requiring your son to log 
in to the gateway using ssh:
http://www.openbsd.org/faq/pf/authpf.html

PuTTy for windows has an ssh-agent, so it should be possible to quietly 
log him in to the gateway from his windows account by adding it to his 
startup folder. Look at plink and pagent commands
http://the.earth.li/~sgtatham/putty/

Hope that helps.

~~ Kirk
Re: throttle traffic by amount of time or amount of used traffic in GB?
#182
Author: Peter N. M. Hansteen
Date: Sat, 13 Apr 2013 06:20
50 lines
3911 bytes
Sebastian Singer <sebastian.singer@kesslar.de> writes:

> So I do not want to cut him off the internet completely,  just limit
> his bandwidth so much that he is throttled if he has reached a set
> time limit or else if he reaches a certain amount of gb used.
>
> So the question is: is pf (ALTQ especially) able to cope with these
> requirements? And if how would such rules in pf.conf look? I am by far
> no pf guru but have run a OpenBSD SOHO server for about 10 years. So I
> think I do have a basic unterstanding of pf matters.

Most if not all queueing options that come to mind (mostly the hfsc
ones) only operate on a per connection (per state) level, but it's
possible to collect statistics on traffic from a specific IP address,
either via rules with labels (see eg [1] onwards) or if the address is
part of a table, from the statistics collected on table entries, ie do a
pfctl -vt tablename -T show and you'll get something like this per table
entry:

   219.142.91.125
        Cleared:            Mon Apr  1 14:54:30 2013
        In/Block:           [ Packets: 874                Bytes: 51983              ]
        In/Pass:            [ Packets: 0                  Bytes: 0                  ]
        Out/Block:          [ Packets: 0                  Bytes: 0                  ]
        Out/Pass:           [ Packets: 0                  Bytes: 0                  ]

You could then whip up a script that parses either that or pfctl -vsl
output for the labels scenario and if your rules assign traffic to
queues based on membership in tables, have your script shift the source
address to the table whose traffic gets assigned to a smaller bandwidth
queue, and run your script at short intervals from a system crontab.

Or in a 'no online games after 10 PM' or similar scenario, have a
slightly simpler script do the tables shuffling at a specific time
(again assuming you slice your traffic according to table membership).

Off the top of my head, I think those are the most workable options, I
hope this was a tiny bit helpful.

- Peter

[1] http://home.nuug.no/~peter/pf/newest/labelstats.html and also
    covered in The Book of PF (http://nostarch.com/pf2.htm and at 
    better bookstores)

-- 
Peter N. M. Hansteen, member of the first RFC 1149 implementation team
http://bsdly.blogspot.com/ http://www.bsdly.net/ http://www.nuug.no/
"Remember to set the evil bit on all malicious network traffic"
delilah spamd[29949]: 85.152.224.147: disconnected after 42673 seconds.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads