Sunday, January 24, 2010

Git: русское описание

Басня о Git   http://hades.name/blog/2009/05/23/the-git-parable-ru/
Git - блог на хабре   http://habrahabr.ru/blogs/Git/
Перевод книги «Волшебство Git»   http://habrahabr.ru/blogs/Git/80909/

Thursday, December 17, 2009

dm-crypt & LUKS

Немного сумбурно, но просто очень много инфы за раз.

Домашняя страница - dm-crypt: a device-mapper crypto target
http://www.saout.de/misc/dm-crypt/

cryptsetup является самостоятельной прогой,
а вообще раньше это был шелл-скрипт - обёртка для более общей утилиты dmsetup
скрипт можно также скачать. Описано как это всё работает с dmsetup
(
Там же даны ссылки на исходники dmsetup: ftp://sources.redhat.com/pub/dm/
где можно на них посмотреть, а также можно посмотреть на старые патчи ядра от RedHat для device-mapper
В README_CODE_MOVED сказано что код утилиты dmsetup перенесён в ветку для LVM2
Он нахродится ftp://sources.redhat.com/pub/lvm2/
В общем можно скачать и собрать статически-скомпонованный утилиты для device-mapper и LVM2
нужные для создания initrd
Единственное что для хэширования пассфразы будет необходима какая-нибудь тулза.
В скрипте использовался hashalot: http://www.paranoiacs.org/~sluskyb/hacks/hashalot/
А бинарник cryptsetup использует libgcrypt: http://www.g10code.de/p-libgcrypt.html

Также не забыть:
Don't forget to call scripts/devmap_mknod.sh (only once) in the device-mapper package to create the /dev/mapper/control device node if you don't use devfs or udev.

В исходниках LVM2.2.02.56.tgz кстати есть скрипты для создания initrd-диска с поддержкой LVM
)

-----

Домашняя страница кода cryptsetup и LUKS
http://code.google.com/p/cryptsetup/

cryptsetup wiki:
http://code.google.com/p/cryptsetup/w/list

Теория LUKS содержится в двух документах:

http://code.google.com/p/cryptsetup/wiki/Specification --> http://cryptsetup.googlecode.com/svn-history/r42/wiki/LUKS-standard/on-disk-format.pdf

и TKS1 - An anti-forensic, two level, and iterated key setup scheme:
http://code.google.com/p/cryptsetup/wiki/TKS1 --> http://clemens.endorphin.org/cryptography --> http://clemens.endorphin.org/TKS1-draft.pdf

Из упомянутого cryptsetup wiki:
http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions

можно перейти на описание примера с файлом подмонтированным через loop
http://feraga.com/library/howto_use_cryptsetup_with_luks_support_0

-----

dm-crypt wiki:
http://www.saout.de/tikiwiki/tiki-index.php
http://www.saout.de/tikiwiki/tiki-index.php?page=LUKS
где много полезных ссылок в частности с последней страницы можно перейти на очень интересный HOWTO

-----

Encrypted Root File System with SUSE HOWTO
http://en.opensuse.org/Encrypted_Root_File_System_with_SUSE_HOWTO
http://en.opensuse.org/Encrypted_Root_File_System

-----

где в конце даны ссылки в том числе на ценный практический HOWTO
http://en.gentoo-wiki.com/wiki/SECURITY_System_Encryption_DM-Crypt_with_LUKS
в котором есть всё, включая тексты и состав initrd

=====

Что такое за аббревиатура 'IV' - Initialization Vector можно прочесть в википедии
http://en.wikipedia.org/wiki/Initialization_vector

там же можно прочесть про сопутствующие вещи:
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation
http://en.wikipedia.org/wiki/Disk_encryption_theory

и конкретно про dm-crypt
http://en.wikipedia.org/wiki/Dm-crypt

=====

где в конце есть ссылка на замечаетелное описание всего дела в целом:
All about dm-crypt and LUKS on one page
- a page covering dm-crypt/LUKS, starting with theory and ending with many practical examples about its usage.
http://sunoano.name/ws/public_xhtml/dm-crypt_luks.html

+++++

Информация:
man cryptsetup(8)
Documentation/device-mapper/dm-crypt.txt
Documentation/power/swsusp-dmcrypt.txt

+++++

Дальше породились вопросы а с каким chainmode (Block Cipher Modes of Operation) может работать dm-crypt
т.к. в http://sunoano.name/ws/public_xhtml/dm-crypt_luks.html написано что только с
* ECB (Electronic Code Book)
* CBC (Cipher Block Chaining)

И для того чтобы включить поддержку соответствующих модулей в ядре и правильно задавать
cipher spec string в формате cipher-chainmode-ivopts:ivmode для cryptsetup?

Запрос в google: which chain mode does dm-crypt support
некотороая информация которая может пригодиться:
http://www.mail-archive.com/linux-crypto@vger.kernel.org/msg01449.html
http://lkml.org/lkml/2005/1/24/54
http://grouper.ieee.org/groups/1619/email/msg00253.html
http://lkml.org/lkml/2005/2/8/63

Следует посмотреть исходники ядра
drivers/md/dm-crypt.c
чтобы узнать какие могут быть опции ivopts:
/*
 * Different IV generation algorithms:
 *
 * plain: the initial vector is the 32-bit little-endian version of the sector
 *        number, padded with zeros if necessary.
 *
 * essiv: "encrypted sector|salt initial vector", the sector number is
 *        encrypted with the bulk cipher using a salt as key. The salt
 *        should be derived from the bulk cipher's key via hashing.
 *
 * benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1
 *        (needed for LRW-32-AES and possible other narrow block modes)
 *
 * null: the initial vector is always zero.  Provides compatibility with
 *       obsolete loop_fish2 devices.  Do not use for new devices.
 *
 * plumb: unimplemented, see:
 * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454
 */
а всё это передаётся в crypto api ядра и его исходники надо смотреть в
crypto/
./tcrypt.c
./lrw.c
./seqiv.c
./cbc.c
./cts.c
./pcbc.c
./xts.c
./ecb.c
./ctr.c
./proc.c

может там тоже можно найти полезные комментарии
и также исходники cryptsetup


В описании стандарта http://cryptsetup.googlecode.com/svn-history/r42/wiki/LUKS-standard/on-disk-format.pdf
описаны некоторые режимы шифрования которые поддерживает LUKS:
APPENDIX B. CIPHER AND HASH SPECIFICATION REGISTRY 13

Table 1: Valid cipher names
cipher name   normative document
-----------   ------------------
aes           Advanced Encryption Standard - FIPS PUB 197
twofish       Twofish: A 128-Bit Block Cipher
              http://www.schneier.com/paper-twofish-paper.html
serpent       http://www.cl.cam.ac.uk/~rja14/serpent.html
cast5         RFC 2144
cast6         RFC 2612


Table 2: Valid cipher modes
mode             description
----             -----------
ecb              The cipher output is used directly.
cbc-plain        The cipher is operated in CBC mode. The CBC chaining
                 is cut every sector, and reinitialised with the sector number
                 as initial vector (converted to 32-bit and to little-endian).
                 This mode is specified in [Fru05b], Chapter 4.
cbc-essiv:hash   The cipher is operated in ESSIV mode using hash for
                 generating the IV key for the original key. For instance,
                 when using sha256 as hash, the cipher mode spec is “cbc-essiv:sha256”.
                 ESSIV is specified in [Fru05b], Chapter 4.


Table 3: Valid hash specifications
hash-spec string   normative document
----------------   ------------------
sha1               RFC 3174 - US Secure Hash Algorithm 1 (SHA1)
sha256             SHA variant according to FIPS 180-2
sha512             SHA variant according to FIPS 180-2
ripemd160          http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
=====

Для виндов (из http://www.saout.de/tikiwiki/tiki-index.php):
http://www.freeotfe.org/index.html

Tuesday, December 1, 2009

LDAP: LDAP Operations HOWTO

LDAP Operations HOWTO   http://tille.garrels.be/training/ldap/
Афтар похоже больше нигде ни в каком формате не выкладывает этот HOWTO, на tldp.org его нет, так что сохраним линк.

Friday, September 4, 2009

rsync: грабли

Rsync copies cookbook   http://www.owlriver.com/tips/rsync-cookbook/
Полезные рецепты при работе с rsync   http://www.opennet.ru/tips/info/1768.shtml
Rsync, Rsync ...не забывайте использовать --timeout=...   http://tigro.info/wp/?p=653
Запись файлов на удалённую машину при помощи rsync   http://tigro.info/wp/?p=548
Советы по созданию зеркала дистрибутивов   http://tigro.info/wp/?p=431

dump: в чём состоит проблема при снятии дампа работающей файловой системы

Dump (non-)deprecation FAQ, for those who worry about something Linus said in 2001

А это ссылка на саму дискуссию в mlist.linux.kernel:
http://groups.google.com/group/mlist.linux.kernel/browse_thread/thread/bedfa6f025ad9daf/8e741a7ce76e6014?hl=en#

Thursday, August 20, 2009

dd: dcfldd - усовершенствованный dd

http://dcfldd.sourceforge.net/
http://sourceforge.net/projects/dcfldd/develop

Программа не обновлялась с декабря 2006г., в трекере патчсет от dloveall за 2008-04-15