Tue 29 May 2007
Both in Windows, and in Linux, the files are normally free available, that gives to each "accidental passerby" (or also not especially accidental) the free access to each information.
If you would like to keep something a secret from the stranger - this article is for you. Especially it has to do with notebook-owner (everybody heard of notebook thefts).
I have busied myself with the encoding thing, looked what the people write, and found only a few clever articles, and almost none for Linux, than I had to reinvent the wheel myself. Maybe it also will be usefully for somebody.
I didn't encrypt all partitions but only the user dates. It is just as certain as the all partitions with all packages and the libraries would be encoded!

Therefore the user dates are following:
For the encoding swap you can depend on the Linux-tools.
Therefore shortly and detailed:
Anymore. Put in tmpfs:
Now we put the folders from /var in cryptopartition
Than reboot and delete the folders /ttmp, /var/ttmp.
The encoding of the partition /home proper comes as next. I have used the instructions of MasterGnome, only corrected some trifles that concern the installation and formatting.
For Ubuntu Feisty the installation is somewhat simpler:
We install the package Automatix2, if it is not yet available. By means of the Automatix we adjust TrueCrypt.
Test TC:
Truecrypt allows the encoding with the using of the algorithms of AES, Twofish, Serpent.
All three are certain enough and momentarily it doesn't even exists the theoretical possibility of the break-in, except for brute force.
AES - serves as a government standard into USA
Twofish - is the fastest on the processor AMD64 (Linux kernel I386 2.6.20-16). It overtakes AES about around 20%
Serpent - is considerably slower then the above-mentioned.
I have noted, that Twofish are faster on AMD, and AES - on Intel, at the same time the two are approximate equally fast on Intel mobile. You can select any algorithm, but I recommend however to check it on the own computer for the speed first.
At the same time you must also select one of the following Hash-functions: RIPEMD-160, SHA-1 and Whirlpool.
SHA-1 - theoretically there is a break-in possibility, and although it has to do with the letters and the digital signatures first, is not recommended for using.
RIPEMD-160 - is by default. Theoretically it doesn't still exist the break-in possibility for this algorithm. But its predecessor RIPEMD was, however, already broken.
Whirlpool - is slow, some sources even assert, that it is 2-3 times slower than the other. However, according to my tests, it isn't so in TrueCrypt. Both in Linux, and in Windows XP it is no more as around 5% of the other behind. Momentary it is the stablest. And the youngest.
You also can use Whirlpool or RIPEMD-160.
In TC it is possible to work with the Cascade of algorithms. AES-Twofish together with Whirlpool and the hidden container in addition - is the composition for the super secret files ;)
Before you continue, save /home somewhere. After that if your home is on the single partition (e.g. sda3), it must be unmounted:
Truecrypt is also practical because you can hide in the encrypted container yet another one. Although is written in documentation, that the external container must be formatted as FAT, it also unproblematically works with ext2. By the exceed of the limits between the containers with the key -P the system doesn't say anything (like it is possible in Windows), the files simply go lost.
Journal of the file system is automatically situated in cryptocontainer.
Now we install the script in the boot process (thanks to MasterGnome again), which asks the password and mounts:
Now copy
One problem remains only, that the password appears b y input, i.e., that "stty -echo" doesn't work by the starting... Perhaps somebody can help...
I have busied myself with the encoding thing, looked what the people write, and found only a few clever articles, and almost none for Linux, than I had to reinvent the wheel myself. Maybe it also will be usefully for somebody.
I didn't encrypt all partitions but only the user dates. It is just as certain as the all partitions with all packages and the libraries would be encoded!

Therefore the user dates are following:
- swap
- /home - to put in container tc (also possible as a file or as a partition)
- /tmp - these files are only needed for a session, therefore, simply to put it in tmpfs
- /var/tmp - the same
- /var/spool - here are the cron-tasks of the user, tasks for printer, it's better to put these in container together with the home file
- /var/mail - in container
- /var/lib/slocate - in container
- /var/log - In container. Although not everything comes here by the starting, but it has nothing to do with the user logs.
For the encoding swap you can depend on the Linux-tools.
Therefore shortly and detailed:
sudo -i apt-get install cryptsetup echo aes >> /etc/modules echo dm_mod >> /etc/modules echo dm_crypt >> /etc/modules [ restart computer ] sudo -i swapoff -a cryptsetup -d /dev/urandom create cryptoswap /dev/sda2 mkswap /dev/mapper/cryptoswap -L accessisdenied -v1 echo 'cryptoswap /dev/sda2 /dev/urandom swap' >> /etc/crypttab in fstab replace your swap with: /dev/mapper/cryptoswap none swap sw 0 0 dd if=/dev/urandom of=/dev/sda2 count=100 swapon -a
Anymore. Put in tmpfs:
mv /tmp /ttmp mkdir tmp chmod 777 tmp /etc/fstab complete with: echo 'tmpfs /tmp tmpfs rw,nosuid,nodev,mode=0777' >> /etc/fstab mv /var/tmp /var/ttmp ln -s /tmp /var/tmp
Now we put the folders from /var in cryptopartition
mkdir /home/.var chmod 755 /home/.var mv /var/spool/ /home/.var/spool ln -s /home/.var/spool /var/spool mv /var/mail /home/.var/mail ln -s /home/.var/mail /var/mail mkdir /home/.var/lib chmod 755 /home/.var/lib mv /var/lib/slocate /home/.var/lib/slocate ln -s /home/.var/lib/slocate /var/lib/slocate mv /var/log home/.var/log ln -s /home/.var/log /var/logYou must deactivate the indexing of the encoded partitions, add in file /etc/updatedb.conf, in PRUNEPATHS - /home.
Than reboot and delete the folders /ttmp, /var/ttmp.
The encoding of the partition /home proper comes as next. I have used the instructions of MasterGnome, only corrected some trifles that concern the installation and formatting.
For Ubuntu Feisty the installation is somewhat simpler:
We install the package Automatix2, if it is not yet available. By means of the Automatix we adjust TrueCrypt.
Test TC:
if truecrypt --test &> /dev/null; then echo "Ok"; else echo "Error"; fiTrueCrypt allows to create the cryptocontainers both in partitions and in files, that must be mounted as a partitions. For substitute the partition for the file in commands it is enough to change the partition name (e.g. /dev/sda3) against the name of the file (e.g. home.tc).
Truecrypt allows the encoding with the using of the algorithms of AES, Twofish, Serpent.
All three are certain enough and momentarily it doesn't even exists the theoretical possibility of the break-in, except for brute force.
AES - serves as a government standard into USA
Twofish - is the fastest on the processor AMD64 (Linux kernel I386 2.6.20-16). It overtakes AES about around 20%
Serpent - is considerably slower then the above-mentioned.
I have noted, that Twofish are faster on AMD, and AES - on Intel, at the same time the two are approximate equally fast on Intel mobile. You can select any algorithm, but I recommend however to check it on the own computer for the speed first.
At the same time you must also select one of the following Hash-functions: RIPEMD-160, SHA-1 and Whirlpool.
SHA-1 - theoretically there is a break-in possibility, and although it has to do with the letters and the digital signatures first, is not recommended for using.
RIPEMD-160 - is by default. Theoretically it doesn't still exist the break-in possibility for this algorithm. But its predecessor RIPEMD was, however, already broken.
Whirlpool - is slow, some sources even assert, that it is 2-3 times slower than the other. However, according to my tests, it isn't so in TrueCrypt. Both in Linux, and in Windows XP it is no more as around 5% of the other behind. Momentary it is the stablest. And the youngest.
You also can use Whirlpool or RIPEMD-160.
In TC it is possible to work with the Cascade of algorithms. AES-Twofish together with Whirlpool and the hidden container in addition - is the composition for the super secret files ;)
Before you continue, save /home somewhere. After that if your home is on the single partition (e.g. sda3), it must be unmounted:
umount /homeFor folder /home we create an external cryptocontainer:
truecrypt --encryption AES --type normal -c /dev/sda3the file system - as None, the any Hash-algorithm and two times the password. After that:
truecrypt /dev/sda3Then comes the format of the container:
mkfs.ext2 -v /dev/mapper/truecrypt0
mount /dev/mapper/truecrypt0 /homeRewrite there the stored /home with all your files. Do not forget .var of the stored /home and delete there all files.
umount /home truecrypt -dInstead of ext2 you can also use the other file systems: ext3, ReiserFS.
Truecrypt is also practical because you can hide in the encrypted container yet another one. Although is written in documentation, that the external container must be formatted as FAT, it also unproblematically works with ext2. By the exceed of the limits between the containers with the key -P the system doesn't say anything (like it is possible in Windows), the files simply go lost.
Journal of the file system is automatically situated in cryptocontainer.
Now we install the script in the boot process (thanks to MasterGnome again), which asks the password and mounts:
cd /usr wget http://privat.heinzelzwerg.de/howtos/debian -->> -->> /truecrypt/tcbootscreen.tar.bz2 tar -xvjf tcbootscreen.tar.bz2 chown root:root /usr/tcbootscreen/* chmod ugo+x /usr/tcbootscreen/* chmod ugo-x /usr/tcbootscreen/tcscreen.tmp chmod ugo-x /usr/tcbootscreen/main.logand change around #! /bin/sh against #! /bin/bash everywhere in all scripten, otherwise in Ubuntu a mistake arises with declare.
Now copy
mv /usr/tcbootscreen/tcbootscreen /etc/init.d/tcbootscreen update-rc.d tcbootscreen defaultsIn file /usr/tcbootscreen/decrypt set own values for device and mountpoint.
One problem remains only, that the password appears b y input, i.e., that "stty -echo" doesn't work by the starting... Perhaps somebody can help...
English
Deutsch
Русский

June 2nd, 2007 at 7:56 a.m.
А как шифрованный своп подружить с suspend-to-disk ?
June 2nd, 2007 at 1:55 p.m.
Это основная проблема при любом шифровании. Если не шифровать своп, то данные все в чистом виде пишутся на диск, если шифровать, то невозможно восстановить при спячке.
Я не знаю решения этой проблемы. Тут каждый выбирает для себя, безопасность или возможность засыпания.
June 2nd, 2007 at 2:16 p.m.
Еще стоит написать про то где и как можно хранить ключи.
June 2nd, 2007 at 2:17 p.m.
там есть скрипт, запускаемый при старте с убунтой, так вот у него есть возможность автоподмонтирования USB-флешки, и после проверки ключа и пароля, авторазмонтирование
June 2nd, 2007 at 2:18 p.m.
В вашем случае, чтобы не плодить контейнеры, проще было бы зашифровать корневой раздел целиком. На ноутбуке для этого лучше использовать loop-aes, т.к. c он поддерживает soft suspend. Я бы так же добавил ключ с flash брелка.
Если немного поиграться с алгоритмами шифрования и хэширования, можно увеличить скорость работы swap/tmp. Нет смылса защищать временные данный сильным и медленным алгоритмом.
Единственный плюс в иcпользовании truecrypt в linux - возможность использовать криптоконтейнер из windows. Полезность plausible deniability при шифровании целых файловых систем сомнительность.
На десктопе /var/log обычно тоже можно поместить на tmpfs.
June 2nd, 2007 at 2:19 p.m.
я обхожусь одним контейнером, в котором только /home, естественно, что весь диск не надо размещать одновременно в внешнем и скрытом контейнерах, а вот для домашней папки я думаю - в самый раз. И алиби-данные, и свои - все в одном месте.
сначала я так и сделал c /var/log, но потом обнаружил, что например CUPS ругается. Хотя это не принципиально, можно немножко подкрутить ;)
June 2nd, 2007 at 2:21 p.m.
Пользуюсь TrueCrypt'ом уже полгода, доволен полностью: бесплатный, кросплатформенный. Там есть чудная функция "Traveller Disk Setup" - создает свой автозапуск на флешке, удобно - воткнул флешку, ввел пароль и твой секретный диск уже тут.
June 15th, 2007 at 10:57 a.m.
А зачем TrueCrypt, если есть штатные cryptsetup, dm-crypt, LUKS? И _большинство_ дистрибутивов имеют в своем составе не только их поддержку, но и средства для работы с зашифрованными дисками в KDE, Gnome, etc? И, что характерно, это совместимо (с использованием FreeOTFE) с Windows. В том числе - portable.
Так что пример - неудачный...
June 16th, 2007 at 1:16 p.m.
2ABATAPA:
Все очень просто...а есть ли во всех этих средствах реализация скрытого контейнера внутри зашифрованного?
April 3rd, 2008 at 11:32 a.m.
в debian юзаю cryptsetup (в 2.6 стандарт как бы)
на http://linuxgazette.mirrors.org.ua/14... можно прочесть что к чему
April 3rd, 2008 at 6:04 p.m.
2slav0nic:
насколько я знаю, скрытые тома он не поддерживает
January 5th, 2009 at 7:24 a.m.
Некропост конечно, но скрытые тома нужны только тем, кого будут пытать фашисты. Тем более по некоторым причинам лицензирования truecrypt исключен из некоторых дистрибутивов.
May 13th, 2009 at 9:30 p.m.
Привет,
Посмотрите пожалуйста данный топик http://forums.truecrypt.org/viewtopic... и если у Вас есть эта проблема, отпишите пожалуйста.
Спасибо.
May 20th, 2009 at 11:35 p.m.
да есть такая проблема с новыми версиями, но мне она не мешает, потому как одномоментно работает только один пользователь с ноутбуком
August 11th, 2009 at 8:14 p.m.
После update-rc.d tcbootscreen defaults
при следующей загрузке отваливается сеть, приглашение к вводу пароля не выводится и соответственно ничего не монтируется. Если запускать tcbootscreen уже из системы все монтируется нормально.
August 17th, 2009 at 5:42 a.m.
У меня работало, хотя я уже пару лет использую свой маленький скрипт вместо tcbootscreen (там просто спрашивание пароля и монтирование). Также он грузится не по дефаултс, а с другими значениями (чтобы загружалось раньше всего и выгружалось позже)
Вот скрипт:
#!/bin/sh
export MKE2FS_SYNC=10
if [ -e /dev/mapper/truecrypt1 ]; then
echo "unmount...";
truecrypt -d
exit 0;
fi
echo "enter password:"
stty -echo
read password
stty echo
truecrypt -t -k '' --password=$password --protect-hidden=no --non-interactive /var/home.tc /home &> /dev/null
if [ -e /dev/mapper/truecrypt1 ]; then
echo "truecrypt ok";
fi
exit 0
Запуск (может отличаться, просто для представления):
/etc/init.d/truecrypt
/etc/rc0.d/K98truecrypt
/etc/rc1.d/S16truecrypt
/etc/rc2.d/S13truecrypt
/etc/rc3.d/S13truecrypt
/etc/rc4.d/S13truecrypt
/etc/rc5.d/S13truecrypt
/etc/rc6.d/K98truecrypt
August 23rd, 2009 at 8:13 p.m.
Удалось все таки заставить tcbootscreen загружаться, дописав в начале скрипта:
### BEGIN INIT INFO
# Provides: tcbootscreen
# Required-Start: $local_fs $remote_fs $network $named $time
# Required-Stop: $local_fs $remote_fs $network $named $time
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tcbootscreen
# Description: tcbootscreen
### END INIT INFO
#---- configuration ----#
Следующим этапом пришлось править decrypt -
строка с запуском truecrupt (добавил --non-interactive):
/usr/bin/truecrypt $device $mountpoint --non-interactive -p "$1" &> /dev/null; then
После этого диск монтировался в папку, но с правами записи-чтения-выполнения только для root, соответственно пользователь, под которым я работал, писать и читать ничего не мог!
Проишлось дописать в строку запуска (добавил --fs-options=umask=0000):
/usr/bin/truecrypt $device $mountpoint --non-interactive --fs-options=umask=0000 -p "$1" &> /dev/null
Теперь папка папка имела права чтение-запись-выполнение для всех. Однако после ввода логина и пароля пользователя появлялся фон рабочего стола и все висло (((
На этом пока остановился и не знаю что делать дальше. Все файлы в примонтированной папке обладают этими правами, и владелец их root. Думаю что все дело в этом. У вас нет такой проблемы?
August 24th, 2009 at 4:47 p.m.
Труекрипт довольно прозрачная система.
Я например использую линуксовые разделы как во внешнем контейнере, так и в секретном (например для флешек), что не совсем обычно для труекрипта, но реализуемо.
Поэтому и работа со всем этим хозяйством веду исключительно обычными средствами.
umask не использую, а просто сделал (уже после монтирования!) пользователя владельцем папки и всех файлов внутри. Truecrypt монтируется как /home
права папки(это уже в примонтированном состоянии)
drwxr-xr-x 5 root root 1024 2009-01-06 12:49 home
права домашней папки в /home
drwxr-xr-x 87 myuser myuser 20480 2009-08-24 14:27 myuser
August 25th, 2009 at 3:36 p.m.
Так в том то и дело, что изменить права после монтирования не получается! Команда проходит успешно, но права не меняются (((. То же и с пользователем. Единственное что пришло в голову, это разрешить всем - все (при помощи umask при монтировании), но это не проходит, что в общем то логично ((
August 30th, 2009 at 8:47 p.m.
Какой командой вы меняете права и владельца?
August 31st, 2009 at 12:53 p.m.
Если в форме контакта сверху сайта скините email или скайп - будет быстрее :)
права меняю через mc, да и обычный chmod подойдет
мне кажется у вас где-то в другом проблема, а это всё лишь следствия. скиньте команду запуска, затерев пароль иксами.