Koozali.org: home of the SME Server

limit internet access by time.

luisc

limit internet access by time.
« on: March 29, 2004, 08:53:18 PM »
Is there a contrib to limit internet access by time and day?

boringgit

limit internet access by time.
« Reply #1 on: March 29, 2004, 10:43:28 PM »
For everyone or just a few?

If you are looking to prevent either all users, or allow only one (to access the net outside hours) I can help. (This can be done using an IPtables command in Crontab)

If you want to except more than one user I never worked out how  :-( There are things like setting the proxy to authenticate users, this presumably could be timed, not that I could help.....

luisc

Hi Ed
« Reply #2 on: March 29, 2004, 10:56:34 PM »
for everyone.

boringgit

limit internet access by time.
« Reply #3 on: March 30, 2004, 12:50:27 AM »
in the /etc directory you will find the "crontab" file. This is used by the cron scheduling service to run programs or commands at specified times. While you can edit this file directly, it will be overwritten each time you change something in the server manager, so use that file for monitoring only, actually make changes to the templates.

You will find the crontab templates in the /etc/e-smith/templates/etc/crontab directory (I think this was slightly different in pre 6 releases?)

I chose to put my commands into the 00setup file, so that they appear at the beginning of the crontab file - you can probably use any of the files in that directory though...

I then used the following command to drop all but my own MAC address

20 00 * * * root iptables -I FORWARD -j DROP -m mac --mac-source ! {MAC addy}
20 00 * * * root iptables -I INPUT -j DROP -m mac --mac-source ! {MAC Addy}

IF you want all blocked I think you can probably sustitute the -m mac with all or similar, but lets face it, given that the "!" inverts the command, (as in it drops all but the specified MAC) all you need to do is enter a MAC addy not on you LAN.

The bit at the beginning of the line controls the crontab scheduling. In this instance it tells it to execute the command at 20 past midnight. The "root" tells it to run as root (miss this out and it will not work)

For more details on crontab scheduling see http://www.mkssoftware.com/docs/man1/crontab.1.asp Using this you can schedule the commands to occur at different times at weekdays / weekends, different every day etc etc... It is flexible if a wee bit convoluted.

To reinstate I simply put the following:

30 12 * * * root iptables -D FORWARD -j DROP -m mac --mac-source ! {mac addy}
30 12 * * * root iptables -D INPUT -j DROP -m mac --mac-source ! {mac addy}

Which switches all back on at half past midday.

I found that I needed to block both the forward and input chains, as IRC and the like seems to work differently to HTTP....

I am sure somebody else will have a far more elegant solution than mine, but if you want any more help on this ugly duckling I am happy to give it

 :-D

Offline byte

  • *
  • 2,183
  • +2/-0
limit internet access by time.
« Reply #4 on: March 30, 2004, 09:59:09 AM »
or your could try abe's beta contrib which adds a panel for setting time/day

http://mirror.contribs.org/smeserver/contribs/aloveless/contribs/ipblock_inet/beta/

HTH
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

ztasevski

limit internet access by time.
« Reply #5 on: March 30, 2004, 11:54:52 AM »
hi,

i've also achived the save just by writing 2 scripts one for staring and one for stopping and just stuck them in the crontab

works like a charm  :-D

boringgit

limit internet access by time.
« Reply #6 on: March 30, 2004, 08:42:53 PM »
Quote from: "byte"
or your could try abe's beta contrib which adds a panel for setting time/day
http://mirror.contribs.org/smeserver/contribs/aloveless/contribs/ipblock_inet/beta/


Wish there was one for MAC addy as well.

On my home server I am trying to restrict My wee brothers access. While I am comfortable with my current solution it is rather longwinded. Trouble is he does have some techie mates who may think of changing IP in order to circumvent restrictions.....

Offline byte

  • *
  • 2,183
  • +2/-0
limit internet access by time.
« Reply #7 on: March 30, 2004, 09:30:08 PM »
Quote from: "boringgit"
Quote from: "byte"
or your could try abe's beta contrib which adds a panel for setting time/day
http://mirror.contribs.org/smeserver/contribs/aloveless/contribs/ipblock_inet/beta/


Wish there was one for MAC addy as well.

On my home server I am trying to restrict My wee brothers access. While I am comfortable with my current solution it is rather longwinded. Trouble is he does have some techie mates who may think of changing IP in order to circumvent restrictions.....


well that contrib does mac addys as well read the thread from the dev list here http://lists.contribs.org/mailman/public/devinfo/msg07510.html

test and post back there.

Thanks Abe for the great contrib looks like its gonna be popular :-D

REMEMBER THIS IS BETA SO TEST FIRST
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Marcos

limit internet access by time.
« Reply #8 on: April 01, 2004, 07:17:47 PM »
Is possible to install this contrib (the beta 2)in an 5.6 version?

Thanks

Marcos

Offline byte

  • *
  • 2,183
  • +2/-0
limit internet access by time.
« Reply #9 on: April 01, 2004, 10:31:13 PM »
Quote from: "Marcos"
Is possible to install this contrib (the beta 2)in an 5.6 version?

Thanks

Marcos


At the start of Abe's thread it says it supports 5.6 and up whether beta 2 version does I'm not sure try on a test machine and post back. (As we run SME 6.0.1-01 takeoff)

HTH
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
new feature: suspend rule
« Reply #10 on: May 12, 2004, 01:30:22 AM »
Abe

I installed your contrib...
I´d like to see a new feature on it:

Suspend rule.

A new link, to allow suspend rule (do not delete it!)

would be great allow release internet access (for example to use WindowsUpdate) with just a click!
...

Offline Chrille

  • *
  • 45
  • +0/-0
Limit internetaccess by time on the Internet
« Reply #11 on: May 13, 2004, 12:35:37 PM »
Hi,

Does anybody know of a solution to limit different users time on the internet? Not by hour but on total "access time".

Problem.
I want to limit my sons access to the Internet, because he plays Counterstrike a lot more then we agreed on, to x hours every day except on weekends where he can get y hours. I have three XP clients, with 4 user accounts on each client, in my house. It shall be possible for me to set different limits for each user (not client), i.e. 1 hour/day to unlimited access. It shall not affect the possibilities to access files in an Ibay. It would be nice if there is a "5-minutes left" warning. I'm running 6.0 and is allways connected to Internet by ADSL

Suggestions?

Regards,

/Chrille