From: Farkas Levente <lfarkas@bppiac.hu>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev remove ATTR(S) not working
Date: Sat, 09 Jun 2007 20:16:20 +0000 [thread overview]
Message-ID: <466B0A94.2000408@bppiac.hu> (raw)
In-Reply-To: <46673B9D.3000205@bppiac.hu>
Andrey Borzenkov wrote:
> On Friday 08 June 2007, Farkas Levente wrote:
>> Andrey Borzenkov wrote:
>>> On Thursday 07 June 2007, Farkas Levente wrote:
>>>> ok so what i really need to somehow properly identify my pen drive. my
>>>> home partition is luks encrypted and the key on on my pen drive. when i
>>>> pug in the pen, udev recognize it and mount
>>> Any reason you are not using HAL for this? udev is simply the wrong place
>>> to do such things. And HAL supports LUKS natively AFAIR.
>> i don't see how can i use hal here? would you explain it to me?!
>>
>
> you never mentioned before that you want to mount encrypted partition when you
> are ot logged on. I am not sure how it works (you need to enter you key at
> some point, do not you?) but you can use something like ivman or write
> trivial handler in python that listens to device insert events and mounts
> them via HAL API.
my home directory is a luks encrypted volume:
----------------------------------------
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
34692928 5613204 27288956 18% /
/dev/sda1 101086 12297 83570 13% /boot
tmpfs 517532 0 517532 0% /dev/shm
/dev/mapper/home-lfarkas
39509616 27716680 11391540 71% /home/lfarkas
# cryptsetup status home-lfarkas
/dev/mapper/home-lfarkas is active:
cipher: twofish-cbc-essiv:sha256
keysize: 256 bits
device: /dev/mapper/VolGroup00-LogVol02
offset: 2056 sectors
size: 80279544 sectors
mode: read/write
----------------------------------------
the keyfile (ie. the password to the encrypted partition) is on the
pendrive hidden partition. _before_ i login i just plug in the pendrive
and udev recognize it and mount the pendrive and use the file which
contains the encryption key and mount my volume. this's my udev rules:
----------------------------------------
# cat /etc/udev/rules.d/10-local.rules
ACTION="add", KERNEL="sd[a-z]", SUBSYSTEM="block",
ATTR{size}="2880", ATTRS{serial}="07530736300A", ATTRS{product}="USB
DISK Pro", SYMLINK+="lfarkas", RUN+="/root/bin/home-up
/dev/VolGroup00/LogVol02 lfarkas"
ACTION="remove", KERNEL="sd[a-z]", SUBSYSTEM="block",
RUN+="/root/bin/home-down lfarkas"
----------------------------------------
and the used scripts:
----------------------------------------
# cat /root/bin/home-up
#!/bin/bash
if [ -z "`grep /home/$2 /proc/mounts`" ]; then
TMPDEV="/mnt/tmp"
mount -t vfat $DEVNAME $TMPDEV
KEY="$TMPDEV/.$2.key"
if [ ! -f $KEY ]; then
exit 1
fi
/root/bin/luks-up $1 /home/$2 < $KEY
RES=$?
umount $TMPDEV
exit $RES
fi
# cat /root/bin/home-down
#!/bin/bash
if [ -z "`ps -u $1|grep .Xclients|egrep -v grep`" ]; then
killall -u $1
umount /media/*
sleep 5
/root/bin/luks-down /home/$1
fi
----------------------------------------
this's working. the only problem i'd like to do it better ie somehow
recognize only _my_ pendrive. in case of add i can use ATTR{size},
ATTRS{serial}, ATTRS{product}, but in remove i can't do any better then
KERNEL="sd[a-z]", SUBSYSTEM="block" which is a satisfied by all kind
of removable device:-( so that's my problem. ie if i plug and remove my
camera it also try to remove my home partition:-(
i hope it's clear now.
--
Levente "Si vis pacem para bellum!"
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2007-06-09 20:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-06 22:56 udev remove ATTR(S) not working Farkas Levente
2007-06-06 23:08 ` Kay Sievers
2007-06-07 3:38 ` Andrey Borzenkov
2007-06-07 8:38 ` Farkas Levente
2007-06-07 16:30 ` Andrey Borzenkov
2007-06-07 21:13 ` Farkas Levente
2007-06-09 13:03 ` Farkas Levente
2007-06-09 15:37 ` Andrey Borzenkov
2007-06-09 15:40 ` Andrey Borzenkov
2007-06-09 17:54 ` Kay Sievers
2007-06-09 19:58 ` Farkas Levente
2007-06-09 20:16 ` Farkas Levente [this message]
2007-06-10 4:18 ` Andrey Borzenkov
2007-06-10 11:33 ` Farkas Levente
2007-06-10 11:38 ` Andrey Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=466B0A94.2000408@bppiac.hu \
--to=lfarkas@bppiac.hu \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.