Ads
Tom's Guide > Forum > Linux/Free BSD > General Discussion > Time restricted internet access

Time restricted internet access

Forum Linux/Free BSD : General Discussion Time restricted internet access

Word :    Username :           
 

I feel kinda stupid asking, but how exactly do I use PAM_TIME? Do I need to activate the service or edit some other file? I can only find really outdated guides on the internet.

 

OS: Scientific Linux

 

I went:

 

su
cd /etc/security/
sudo nano -w time.conf

 

added:

 

http ; *; !user; !Al0900-2100

 

Tried to follow

 

http://www.techrepublic.com/blog/s [...] ystems/319

 

I want the user not to be able to access the internet via http before 9am and after 9pm. If there is any easy solution... been stumped for ages...

 

For reference, here is the time.conf default file

 
Code :
  1. # this is an example configuration file for the pam_time module. Its syntax
  2. # was initially based heavily on that of the shadow package (shadow-960129).
  3. #
  4. # the syntax of the lines is as follows:
  5. #
  6. #    services;ttys;users;times
  7. #
  8. # white space is ignored and lines maybe extended with '\\n' (escaped
  9. # newlines). As should be clear from reading these comments,
  10. # text following a '#' is ignored to the end of the line.
  11. #
  12. # the combination of individual users/terminals etc is a logic list
  13. # namely individual tokens that are optionally prefixed with '!' (logical
  14. # not) and separated with '&' (logical and) and '|' (logical or).
  15. #
  16. # services
  17. #    is a logic list of PAM service names that the rule applies to.
  18. #
  19. # ttys
  20. #    is a logic list of terminal names that this rule applies to.
  21. #
  22. # users
  23. #    is a logic list of users or a netgroup of users to whom this
  24. #    rule applies.
  25. #
  26. # NB. For these items the simple wildcard '*' may be used only once.
  27. # times
  28. #    the format here is a logic list of day/time-range
  29. #    entries the days are specified by a sequence of two character
  30. #    entries, MoTuSa for example is Monday Tuesday and Saturday. Note
  31. #    that repeated days are unset MoMo = no day, and MoWk = all weekdays
  32. #    bar Monday. The two character combinations accepted are
  33. #
  34. #              Mo Tu We Th Fr Sa Su Wk Wd Al
  35. #
  36. #    the last two being week-end days and all 7 days of the week
  37. #    respectively. As a final example, AlFr means all days except Friday.
  38. #
  39. #    each day/time-range can be prefixed with a '!' to indicate "anything
  40. #    but"
  41. #
  42. #    The time-range part is two 24-hour times HHMM separated by a hyphen
  43. #    indicating the start and finish time (if the finish time is smaller
  44. #    than the start time it is deemed to apply on the following day).
  45. #
  46. # for a rule to be active, ALL of service+ttys+users must be satisfied
  47. # by the applying process.
  48. #
  49. #
  50. # Here is a simple example: running blank on tty* (any ttyXXX device),
  51. # the users 'you' and 'me' are denied service all of the time
  52. #
  53. #blank;tty* & !ttyp*;you|me;!Al0000-2400
  54. # Another silly example, user 'root' is denied xsh access
  55. # from pseudo terminals at the weekend and on mondays.
  56. #xsh;ttyp*;root;!WdMo0000-2400
  57. #
  58. # End of example file.



Message edited by amdfangirl on 02-04-2012 at 06:31:07 AM
------------------------------ Dying
Is an art, like everything else.
I do it exceptionally well.
-Slyvia Plath Lady Lazarus
Reply to amdfangirl
Register or log in to remove.

http://ask.fedoraproject.org/quest [...] pam-a-kind

 

Reading this right now... might all be good.

 

Edit: Because it refers to GDM, I've taken the liberty of installing Scientific Linux so I can eliminate any change because of GNOME2 -> GNOME 3.


Message edited by amdfangirl on 02-04-2012 at 06:30:47 AM
------------------------------ Dying
Is an art, like everything else.
I do it exceptionally well.
-Slyvia Plath Lady Lazarus
Reply to amdfangirl

I really need help, I tried what the guide afformented said. Nothing really happened and nothing was blocked.

------------------------------ Dying
Is an art, like everything else.
I do it exceptionally well.
-Slyvia Plath Lady Lazarus
Reply to amdfangirl

do not know about specifics behind PAM (the man pages were less than helpful), but as a side solution many routers (ddwrt and tomato for sure) provide this ability with a nice gui :)

 

Message quoted 1 times
Message edited by skittle on 02-04-2012 at 06:55:12 PM
Reply to skittle

skittle wrote :

do not know about specifics behind PAM (the man pages were less than helpful), but as a side solution many routers (ddwrt and tomato for sure) provide this ability with a nice gui :)


^This.

You can also target particular machines for these access restrictions.

Did you simply want to control Internet use or complete computer use? (if it's complete computer access, there's a script that's called timekpr that seems to do what you want)


Message edited by bmouring on 02-06-2012 at 07:29:27 AM
Reply to bmouring

Last release 2009 :/

------------------------------ Dying
Is an art, like everything else.
I do it exceptionally well.
-Slyvia Plath Lady Lazarus
Reply to amdfangirl

amdfangirl wrote :

Last release 2009 :/


Like a fine wine :)

Spoiler :

but seriously tho, that is kinda meh, although what it's using under the hood is pretty much standard and hasn't changed in quite some time, I'm willing to bet that it would work on some other UNIX's

Reply to bmouring

I'll give it a go then eh?

------------------------------ Dying
Is an art, like everything else.
I do it exceptionally well.
-Slyvia Plath Lady Lazarus
Reply to amdfangirl

It'll take a little tweaking and cajoling to get it installed properly, but it does seem like just what the doctor ordered. I would just keep the original archive around since, if the reason should arise, you may have to refer to the contents installed to do a manual un-installation.

 

...ooor, you could try using something like alien or, even better yet, how to create your own RPMs. Perhaps fund an unofficial RPM repo, talk to them, try to get them to carry it, etc.


Message edited by bmouring on 02-09-2012 at 07:36:54 AM
Reply to bmouring
TomsGuide.com: Over 800,000 questions and answers to address all your high-tech questions. Sign up now! Its free!
Tom's Guide > Forum > Linux/Free BSD > General Discussion > Time restricted internet access
Go to:

There are 41 identified and unidentified users. To see the list of identified users, Click here.

Tom's Guide around the World