Page 1 of 2 12 LastLast
Results 1 to 10 of 527

Thread: Account Lease time / Content filtering

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time / Content filtering

    Timekeepr - Keep control of computer usage

    timekpr developers are .nedberg, forger

    This program will track and control the computer usage of your kids. You can limit their daily usage and configure periods when they cannot log in.

    Developers Even Nedberg and Savvas Radević (or .nedberg and forger) of the Ubuntu forums have rewritten the package using python as opposed to the bash shell script of it's previous form. timekpr now has a full featured interface with the ability to change and grow as needed. The current version supports Ubuntu, Kubuntu and Xbuntu. Please report any bugs you find. Current status indicated below:

    • Ubuntu -- Lucid, Karmic, Jaunty, Intrepid, Hardy
    • Kubuntu - Lucid, Karmic, Jaunty, Intrepid, Hardy
    • Xubuntu - Lucid, Karmic, Jaunty, Intrepid, Hardy


    INSTRUCTIONS

    Please add the software repository as listed below, and install from synaptic or terminal.

    Quote Originally Posted by .nedberg View Post
    The PPAs have changed. For Stable Versions Use:
    Code:
    deb http://ppa.launchpad.net/timekpr-maintainers/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/timekpr-maintainers/ppa/ubuntu jaunty main
    For Beta Versions Use:
    Code:
    deb http://ppa.launchpad.net/nedberg/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/nedberg/ppa/ubuntu jaunty main
    Follow these instructions for installing packages from these PPAs.
    Attached Images Attached Images
    Last edited by crjackson; May 3rd, 2010 at 03:43 AM. Reason: Add Latest FIles - Instructions
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

  2. #2
    Join Date
    Nov 2006
    Location
    Norway
    Beans
    795
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: Account Lease time / Content filtering

    Never used dansguardian before, but I found this thread: http://ubuntuforums.org/showthread.php?t=207008

    EDIT: Also have a look here: http://ubuntuforums.org/showthread.php?t=769671 for a gui to configure dansguardian.

    My children are not old enough to use computers yet, but I will have a look at this myself just to be prepared!
    Last edited by .nedberg; August 12th, 2008 at 07:12 PM.
    Open mind, open source!
    Keep control of computer usage with timekpr
    Screensaver for Amarok? AmarokScreenSaver
    My (Norwegian) blog about motorcycles and MotoGP

  3. #3
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time - Timekeeper Developement

    Okay, I've found a home brewed script from this page called Waggle Dance it's supposed to do EXACTLY what I want, for EXACTLY the same reasons.

    I had a little permissions issue during setting up the time limits for my test account, but I overcame that with sudo -i

    I have two issues that I'm hoping someone (I posted to the script writer too) will help me with.

    In my test scenario, I gave the user 300 seconds of use. The script then added another 450 in grace time to log off. I watched the clock ticking in the time keeping file but here's the problem(s);

    1) None of the warning pop-ups activated (possibly due to allocated time was lower than grace period. I changed grace period to 0 but it had no effect).

    2) Once it kicked the test user off, it allowed an immediate re-login to the test account, and another 450 seconds were allowed thereby allowing the test user to login every few minutes. It would be annoying but a determined child would do that all night long.

    Could someone have a look at the script and help me modify it so that those problems are fixed please?

    Code:
    #!/bin/bash
    ###
    # timekpr.sh - simple 
    # watches gnome sessions and logs them out once the user has exceeded a set, per day limit
    # /var/lib/timekpr/$username.time hold a count of seconds user has had a gnome session
    # /var/lib/timekpr/$username hold the daily allowed seconds for the user
    #
    # you may need to install notify-send with: $apt-get install libnotify-bin
    #
    # Copyright 2008 Chris Jackson <chris@91courtstreet.net>
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # See <http://www.gnu.org/licenses/>. 
    #
    
    default_limit=87000 #all day
    grace_period=450
    poll_time=20
    
    #Ubuntu uses alternatives so we look for x-session-manager instead of gnome-session
    SESSION_MANAGER=x-session-manager
    
    # get the usernames and PIDs of sessions
    
    while(true); do
        sleep $poll_time
        pidlists=$( ps --no-heading -fC $SESSION_MANAGER | awk 'BEGIN{ FS=" " } { print $1 "," $2 }' )
        for pidlist in $pidlists; do
            # split username and pid - FIXME - I bet this would be faster with bash arrays and substitution 
            username=$( echo $pidlist | awk 'BEGIN{ FS=","} { print $1}' )
            pid=$( echo $pidlist | awk 'BEGIN{ FS=","} { print $2}' )
            if [[ ! -e "/var/lib/timekpr/$username" ]]
            then 
                echo $default_limit > /var/lib/timekpr/$username
            fi
            
            # if the time file is missing or was last touched yesterday, start over
            if [[ -e "/var/lib/timekpr/$username.time" && `( stat -c '%z' /var/lib/timekpr/$username.time|cut -c9,10 )` == `date +%d` ]]
            then 
                #add $poll_time seconds to it
                timekpr=$(( `cat /var/lib/timekpr/$username.time` + $poll_time ))
                echo $timekpr > /var/lib/timekpr/$username.time
            else
            	timekpr=$poll_time
                echo $timekpr > /var/lib/timekpr/$username.time
            fi
    
            echo $username, $pid, $timekpr
            
            if [[ $timekpr -gt `cat /var/lib/timekpr/$username` ]]
            then
                ## get the display and xauthority used by out session manager
                UDISPLAY=`grep -z DISPLAY \
                    /proc/$pid/environ | sed -e 's/DISPLAY=//'`
                XAUTHORITY=`grep -z XAUTHORITY \
                    /proc/$pid/environ | sed -e 's/XAUTHORITY=//'`
                
                # find DBUS session bus for this session
                DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
                    /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
                # use it - give a warning, then another one 1/2 way through grace_period
                XAUTHORITY="$XAUTHORITY" DISPLAY="$UDISPLAY" DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" \
                    notify-send --icon=gtk-dialog-warning --urgency=critical -t 30000 "Daily Time Limit" "Your session time is about to expire! You have $grace_period sec. to save your work and logout."
                sleep $(($grace_period/2))   # FIXME: this gives other sessions a free grace_period added to their accounting
    
                XAUTHORITY="$XAUTHORITY" DISPLAY="$UDISPLAY" DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" \
                    notify-send --icon=gtk-dialog-warning --urgency=critical -t 30000 "Daily Time Limit" "Your session time is about to expire! You have $(($grace_period/2)) sec. to save your work and logout."
                sleep $(($grace_period/2))   # FIXME: this gives other sessions a free grace_period added to their accounting
    
                XAUTHORITY="$XAUTHORITY" DISPLAY="$UDISPLAY" DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" \
                    notify-send --icon=gtk-dialog-warning --urgency=critical -t 10000 "Shutting Down" "Shutting down session ($pid) now!" 
                # FIXME - should really check to see if user has logged out yet 
                sleep 10
                kill -HUP $pid    #this is a pretty bad way of killing a gnome-session, but we warned 'em
                
                ## uncomment the following to brutally kill all of the users processes
                sleep 10
                pkill -u $username  
                
                ## killing gnome-session should be more like:
                #DISPLAY=":0" XAUTHORITY="/tmp/.gdmEQ0V5T" SESSION_MANAGER="local/wretched:/tmp/.ICE-unix/$pid" su -c 'gnome-session-save --kill --silent' $username
                ## but this can still leave processes to cleanup - plus it's not easy to get SESSION_MANAGER
            fi
        done
    done
    Attached Files Attached Files
    Last edited by crjackson; October 1st, 2008 at 10:35 PM.
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

  4. #4
    Join Date
    Nov 2006
    Location
    Norway
    Beans
    795
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: Account Lease time / Content filtering

    To get the notifications:
    Code:
    # you may need to install notify-send with: $apt-get install libnotify-bin
    Looks like it will not prevent a relogin. Short grace_period should "fix" this...
    Open mind, open source!
    Keep control of computer usage with timekpr
    Screensaver for Amarok? AmarokScreenSaver
    My (Norwegian) blog about motorcycles and MotoGP

  5. #5
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time - Timekeeper Developement

    Quote Originally Posted by .nedberg View Post
    To get the notifications:
    Code:
    # you may need to install notify-send with: $apt-get install libnotify-bin
    Looks like it will not prevent a relogin. Short grace_period should "fix" this...
    Okay, I installed the libnotify-bin and the grace period was changed to 0. I'll try it again and see what happens.
    Last edited by crjackson; October 1st, 2008 at 10:36 PM.
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

  6. #6
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time - Timekeeper Developement

    Quote Originally Posted by crjackson View Post
    Okay, I installed the libnotify-bin and the grace period was changed to 0. I'll try it again and see what happens.
    Installing libnotify gave me the missing notifications. Lowering the grace period doesn't seem to do anything at all.


    Anyone who knows how to make this work can feel free to jump in here...
    Last edited by crjackson; October 1st, 2008 at 10:36 PM.
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

  7. #7
    Join Date
    Jul 2007
    Location
    Brugge, België
    Beans
    2,933

    Re: Account Lease time / Content filtering

    Quote Originally Posted by crjackson View Post
    Here's the deal,

    I've got 4 underage children in the house and I need some software controls. My wife was at a friends house and learned that their computers are configured to do the following.

    Each child has there own Time limited user account. Each account is allowed only a predefined about of user time. The way it works is like this. If the user is allowed 120 minutes, they can login and out as many times as they like, but the minutes are logged and when the limit is reached their access expires.

    The next issue is content filtering. I found dansguardian in the repositories and installed it. The problem is I can't find any menu entries to activate it, and it also doesn't run by typing dansguardian from the terminal.

    How do I activate this thing so that I can configure it?

    Thanks...
    This kind of thing isn't good for children.

    Let them see the world as it really is instead of trying to shelter them from everything.

  8. #8
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time - Timekeeper Developement

    Quote Originally Posted by billgoldberg View Post
    This kind of thing isn't good for children.

    Let them see the world as it really is instead of trying to shelter them from everything.
    Sorry Bill - Go hunt for a Knee-Jerk reaction elsewhere. This is a support thread.
    Last edited by crjackson; October 1st, 2008 at 11:05 PM.
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

  9. #9
    Join Date
    Nov 2006
    Location
    Norway
    Beans
    795
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: Account Lease time / Content filtering

    To install the script try this:
    Code:
    #!/bin/bash
    if [ ! -d /usr/local/bin ]; then
    sudo mkdir /usr/local/bin
    fi
    wget nedberg.net/timekpr/addtime.sh -O /usr/local/bin/addtime.sh
    wget nedberg.net/timekpr/extendlimits.sh -O /usr/local/bin/extendlimits.sh
    wget nedberg.net/timekpr/timekpr.sh -O /usr/local/bin/timekpr.sh
    wget nedberg.net/timekpr/timekprGUI.py -O /usr/local/bin/timekprGUI.py
    wget nedberg.net/timekpr/Timekpr.glade -O /usr/local/bin/Timekpr.glade
    chmod 744 /usr/local/bin/addtime.sh /usr/local/bin/extendlimits.sh /usr/local/bin/timekpr.sh /usr/local/bin/timekprGUI.py
    if [ ! -d /var/lib/timekpr ]; then
    mkdir /var/lib/timekpr
    fi
    I thought the folder /usr/local/bin already existed... This version checks if it exists, and only creates it if it doesn't.

    Launcher:
    You should launch the GUI with 'gksudo /usr/local/bin/timekprGUI.py'.
    In Ubuntu/Gnome you can right click your menu and select "Edit Menus", then add a new item wherever you want it. Make the command 'gksudo /usr/local/bin/timekprGUI.py', name it what ever you want and select an icon. You need to do this as your own user, and it cannot be run as an unprivileged user (make sure your kids are not in the sudoers group!).
    Open mind, open source!
    Keep control of computer usage with timekpr
    Screensaver for Amarok? AmarokScreenSaver
    My (Norwegian) blog about motorcycles and MotoGP

  10. #10
    Join Date
    Jun 2007
    Location
    Charlotte, NC, USA
    Beans
    3,135
    Distro
    Ubuntu Development Release

    Account Lease time - Timekeeper Developement

    Quote Originally Posted by .nedberg View Post
    To install the script try this:
    Code:
    #!/bin/bash
    if [ ! -d /usr/local/bin ]; then
    sudo mkdir /usr/local/bin
    fi
    wget nedberg.net/timekpr/addtime.sh -O /usr/local/bin/addtime.sh
    wget nedberg.net/timekpr/extendlimits.sh -O /usr/local/bin/extendlimits.sh
    wget nedberg.net/timekpr/timekpr.sh -O /usr/local/bin/timekpr.sh
    wget nedberg.net/timekpr/timekprGUI.py -O /usr/local/bin/timekprGUI.py
    wget nedberg.net/timekpr/Timekpr.glade -O /usr/local/bin/Timekpr.glade
    chmod 744 /usr/local/bin/addtime.sh /usr/local/bin/extendlimits.sh /usr/local/bin/timekpr.sh /usr/local/bin/timekprGUI.py
    if [ ! -d /var/lib/timekpr ]; then
    mkdir /var/lib/timekpr
    fi
    I thought the folder /usr/local/bin already existed... This version checks if it exists, and only creates it if it doesn't.

    Launcher:
    You should launch the GUI with 'gksudo /usr/local/bin/timekprGUI.py'.
    In Ubuntu/Gnome you can right click your menu and select "Edit Menus", then add a new item wherever you want it. Make the command 'gksudo /usr/local/bin/timekprGUI.py', name it what ever you want and select an icon. You need to do this as your own user, and it cannot be run as an unprivileged user (make sure your kids are not in the sudoers group!).
    I didn't know how to make that thing actually check for the existance of a directory so I just told it to make one. I'm glad you jumped in and fixed it up.

    I tried the gksudo thing the other day and it didn't work. It launched the GUI, but it would modify the file settings. I'll give that a try again. I was tired and may have done wrong somehow.

    OH NO!! No Kiddies with sudoers privileges - I haven't even given that to the wife yet.
    Last edited by crjackson; October 1st, 2008 at 11:06 PM.
    Mac Pro 5,1 6-Core 3.33GHz, 48GB, Sapphire RX580
    Optical -- Apple Super Drive & MCE Internal Blu-ray
    512GB SM 970 Pro NVMe/HighPoint 7101A/10.14.5
    SonnetAllegro Pro USB 3/ 4TB WD/4TB - Barracuda

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •