ZFS GELI/ZFS volumes automount

Hi, I have tried with both Mate and KDE, but it looks like there is no automatism to mount encrypted volumes. Something like LUKS volumes automount on Linux. It shows a nice dialog box asking for the password and then does all its things. I have a usb "data disk" that I insert when needed, so it would be great to have some form of automatism to mount it.

Currently I need to open up a terminal, geli attach, zfs import and voilà. Maybe I can write a script to automate things, but I don't know how to listen for storage events ( attach/detach, a la udev ) on FreeBSD.
 
s2h is a partition I use for special purpose, so this code triggers on the existance of that specific partition on a stick.

There are two steps involved. The first detects the stick, and runs geli. You can probably do other things there, e.g. call some little script that opens a dialog box with x11/xprompt, or such.

The second does in my case use (a modified version of) automount. But that does afaik not support ZFS. So there you need to insert the proper command to manage your ZFS. And later for detach as well.

/usr/local/etc/devd/automount_devd.conf:
Code:
notify 1000 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "da[0-9]+s2h";
  # Prüfen ob das device schon beim Boot freigeschaltet wurde
  action "/bin/test -c /dev/$cdev.eli || /sbin/geli attach -k /path/to/key -p $cdev";
};

notify 1000 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "da[0-9]+s2h.eli";
  # ein bischen warten bis beim boot auch der syslogd da ist
  action "( sleep 30; /usr/local/sbin/automount $cdev attach /j/admn/var/bk/usb )&";
};
notify 1000 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "da[0-9]+s2h.eli";
  action "/usr/local/sbin/automount $cdev detach /j/admn/var/bk/usb";
};
 
Top