RFC (Request for Comments, Запрос на комментарии) - серия документов, публикуемая сообществом исследователей и разработчиков, руководствующихся практическими интересами, в которой описывается набор протоколов и обобщается опыт функционирования Интернет.
[?]Enter 'y' to mount or 'n' to umount GEOM-ELI partition: [y/n] y [?]Enter the encrypted partition: ar0s1g [?]Enter the mounting point: /crypto [!]Your partition is ar0s1g [!]Mounting point is /crypto [!]Trying to mount USB Flash drive on /mnt ... [?]Enter the USB Flash device (da0s1 da1s1): [da0s1] [!]USB FLASH Device /dev/da0s1 successfully mounted on /mnt Enter passphrase: [!]Key for GEOM-ELI provider attached to /dev/ar0s1g [!]GEOM-ELI encrypted provider mounted to /crypto
[?]Enter 'y' to mount or 'n' to umount GEOM-ELI partition: [y/n] n [?]Deattach the GEOM-ELI provider ? [y/n] y [!]Found GEOM-ELI provider at /dev/ar0s1g.eli [!]GEOM-ELI provider deattached
Вообщем, мне так удобней. Да, и еще. Желательно не забыть из /etc/fstab убрать строку устройства ar0s1g, а то система не загрузится
# sed -ie '/ar0s1g/d' /etc/fstab
Ну вот в принципе и все. Связываем главный ключ с провайдером, ключевая фраза и сгенерированный файл на флешке служат дешифрацией главного ключа для создания нового GEOM провайдера. В каталоге /dev должен появиться файл /dev/ar0s1g.eli:
# geli attach -k /mnt/ar0s1g.key /dev/ar0s1g Enter passphrase: # ls /dev | grep eli ar0s1g.eli
Далее достаточно продолжительная процедура создания файловой системы (у меня ушло на это около 4-часов):
# dd if=/dev/random of=/dev/ar0s1g.eli bs=1m dd: /dev/ar0s1g.eli: short write on character device dd: /dev/ar0s1g.eli: end of device 80000+0 records in 79999+1 records out 83886075904 bytes transferred in 14054.799294 secs (5968500 bytes/sec)
Теперь отмонтируем /crypto, отсоединим провайдера /dev/ar0s1g.eli и выведем список файлов директории. Тестового файла там нету.
# umount /crypto # geli detach /dev/ar0s1g.eli # ls -lh /crypto total 0
Попробуем смонтировать устройство /dev/ar0s1g - неверный супер-блок:
# mount /dev/ar0s1g /crypto mount: /dev/ar0s1g on /crypto: incorrect super block
Попробуем с неверным ключем или фразой попытаться подключить провайдера - как видим, ничего не получается:
# dd if=/dev/random of=/root/wrong.key bs=64 count=1 1+0 records in 1+0 records out 64 bytes transferred in 0.000058 secs (1104673 bytes/sec)
# geli attach -k /root/wrong.key /dev/ar0s1g Enter passphrase: Wrong key for ar0s1g.
# geli attach -k /mnt/ar0s1g.key /dev/ar0s1g Enter passphrase: Wrong key for ar0s1g.
Для своего удобства, накатал несложный скрипт на $BASH для монтирования-демонтирования шифрованной файловой системы (при условии, что она единственная на сервере). особо его не тестил, но у меня работает вроде все:
printf "[?]Enter 'y' to mount or 'n' to umount GEOM-ELI partition: [y/n] "; read answer
case "${answer}" in
y|Y) printf "[?]Enter the encrypted partition: "; read partition;
if [ ! -c /dev/${partition} ] then printf "[!]There is no such device - ${partition}"; exit 1 fi
printf "[?]Enter the mounting point: "; read mount;
if [ ! -d ${mount} ] then printf "[!]There is no such directory - ${mount}\n"; exit 1 fi
printf "[!]Your partition is ${partition} [!]Mounting point is ${mount} [!]Trying to mount USB Flash drive on /mnt ...\n";
declare -a flash=( $(ls /dev | egrep 'da\ws\w') )
if [ ${#flash[@]} -ge 1 ] then for usbd in ${flash} do umount -f /dev/${usbd} 2&>1 done
printf "[?]Enter the USB Flash device (${flash[*]:0}): [${flash[0]}]"; read usbdevice;
if [ -z ${usbdevice} ] then usbdevice=${flash[0]}
if [ ! -d /mnt ] then mkdir /mnt fi
if mount_msdosfs -o ro /dev/${usbdevice} /mnt then printf "[!]USB FLASH Device /dev/${usbdevice} successfully mounted on /mnt\n"; else printf "[!]Can't mount USB Flash Device\n"; exit 1; fi fi fi
findgeli=$(df -H | grep eli | /usr/bin/awk '{print $1}')
if [ ${findgeli} ] then printf "[!]You have already the GEOM-ELI encrypted provider at ${findgeli}\n"; exit 1; else
if geli attach -k /mnt/${partition}.key /dev/${partition} &> /dev/null then printf "[!]Key for GEOM-ELI provider attached to /dev/${partition}\n"; mount /dev/${partition}.eli ${mount} &> /dev/null printf "[!]GEOM-ELI encrypted provider mounted to ${mount}\n\n"; geli list umount -f /dev/${usbd} 2&>1 else printf "[!]Can't attach the key /mnt/${partition}.key\n"; exit 1; fi fi ;;
n|N) printf "[?]Deattach the GEOM-ELI provider ? [y/n]" read answer
[?]Enter 'y' to mount or 'n' to umount GEOM-ELI partition: [y/n] y [?]Enter the encrypted partition: ar0s1g [?]Enter the mounting point: /crypto [!]Your partition is ar0s1g [!]Mounting point is /crypto [!]Trying to mount USB Flash drive on /mnt ... [?]Enter the USB Flash device (da0s1 da1s1): [da0s1] [!]USB FLASH Device /dev/da0s1 successfully mounted on /mnt Enter passphrase: [!]Key for GEOM-ELI provider attached to /dev/ar0s1g [!]GEOM-ELI encrypted provider mounted to /crypto
[?]Enter 'y' to mount or 'n' to umount GEOM-ELI partition: [y/n] n [?]Deattach the GEOM-ELI provider ? [y/n] y [!]Found GEOM-ELI provider at /dev/ar0s1g.eli [!]GEOM-ELI provider deattached
Вообщем, мне так удобней. Да, и еще. Желательно не забыть из /etc/fstab убрать строку устройства ar0s1g, а то система не загрузится