Menu

Home

Jared Jacobson

pam_duration

Background

This project was born out of frustration that no similar project appears to exist. pam_duration provides a way to limit the number of minutes a given user is allowed to access a system on a given day of the week. This is mostly useful for parental control.

For example, suppose I have three kids: a fifteen year old, a ten year old, and a five year old. The fifteen year old needs access to the computer to work on school reports and homework during the week, and is allowed up to two hours per day on the weekend. The ten year old needs access to the computer to do homework during the week, but his homework requires much less time on the computer. He is granted one hour per day on the weekend. The five year old gets half an hour per day, any day of the week.

Existing PAM modules do not answer this need. pam_duration provides a way to do it. So far it has only been tested on Ubuntu 12.04, since that's what I run. It should run on any POSIX system that supports PAM and has a Python 2.7 interpreter.

There is a PAM module that restricts the hours of the day that users can log in. For example, it can specify that a user is allowed to log in between the hours of 8 am and 5 pm. It doesn't, however, provide a way to limit how much time the user can spend logged in during those hours.

There is another project, Timekpr, that used to do the same thing this module does, but timekpr has not been updated for some time, and is not very portable. Specifically, it does not work with versions of Ubuntu that use the lightdm login manager. The duration-limiting functions of timekpr also don't integrate into the most prevalent authorization framework for Posix systems: PAM.

While pam_duration is not yet as user-friendly as Timekpr (for instance, it does not yet provide notifications to the window manager that the user is about to be logged off, and there is no GUI to configure how long users can log in on what days), it should operate on many more systems.

Code state

pam_duration is functional, but unpolished. It needs work in the following areas:

  • Code to daemonize the python task-watching/killing service on startup on other Linux/Unix distributions. This will undoubtedly be OS/distribution dependent. An upstart script is provided.
  • Smoother installation process: installing default config file if one doesn't already exist, creating directories, putting the shared object file in the right place for 32-bit systems, etc.
  • More flexible installation locations for the config file and user time tracking logs. Right now the locations are pretty hard-coded.
  • Messaging protocol to communicate with GUI clients to allow users warning that they're about to be shut down without the right to protest.
  • man page documentation for pam_duration.

Building

For guidance on building the software, see the [Building] page.

Configuration

For configuration guidance, see the [Configuration] page.

Project Admins:


MongoDB Logo MongoDB