localdev and fixed devices

Helmut Lichtenberg <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Hi,
there was a discussion on the ltsp-discuss list about the well known problem
about removable and fixed devices on the client.

Oliver Grawert schrieb am 27. Aug 2008 um 14:44:55 CEST:
> it used to be without checks for removable devices in the original
> implementation, due to massive complaints from skolelinux (schools with
> dual booted client machines suddenly gave full acccess to the XP
> partition to everyone logged in on a thin client) we decided to accept
> their hardcoded patch to disable HDDs completely until someone else
> comes up with a better solution ... so patches are indeed appreciated
> any happily accepted ;)

I sent a patch for this problem to the list, but Jim McQuillan redirected me
to ltsp-developers. So here's my suggestion:

1. udev must provide all devices, not only removables. Otherwise we could not
   select between them via lts.conf.

2. It seems easier for me not to allow certain devices but to deny them.

3. Let's restrict it for now for the two traits 'removable' and 'fixed'.
   Introduce a variable in lts.conf like this:

   LOCALDEV_DENY = fixed      # possible values: [fixed|removable]

4. Maybe later we can enhance it for certain named devices or partitions. This
   needs a more complicated retrieval of udev information and decisions about
   the syntax in lts.conf.

To implement this for the new ltspfs-trunk, Oliver pointed to, there are only
two new functions for ltspfs_entry: is_removable() and is_denied().

I've put a first implementation into a shell script, where you can test it
easily. 

Comments welcome.

Helmut

==============================================================================
#!/bin/sh

# just for testing:
DEVICENAME=sda1         # from udev
LOCALDEV_DENY=fixed     # from lts.conf [removable|fixed]

is_denied()
{
    test -z "$LOCALDEV_DENY" && return 1

    case $LOCALDEV_DENY in
        fixed)
            is_removable $1 && return 1
            return 0
            ;;
        removable)
            is_removable $1 && return 0
            return 1
            ;;
        *)
            return 1
            ;;
    esac
}

is_removable()
{
    IS_REM=`udevadm info --attribute-walk -n $1 \
        |grep removable \
        |sed -e 's/.*\([0|1]\).*/\1/'`
    test $IS_REM = 1 && return 0   # true in sh context (is removable)
    return 1                       # false (is not removable)
}

if is_denied $DEVICENAME ; then
    echo "Don't run call_ltspfsmounter on device $DEVICENAME in ltspfs_entry"
    # ignore this device in add_device()
else
    echo "Run call_ltspfsmounter on device $DEVICENAME in ltspfs_entry"
    # do the real work:
    # start_ltspfsd
    # call_ltspfsmounter add ${MOUNTPOINT}
fi
==============================================================================

-- 
-------------------------------------------------------------------------
Helmut Lichtenberg  <[email protected]>  Tel.: 05034/871-128
Institut für Nutztiergenetik (FLI)         31535 Neustadt         Germany
-------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.