Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
lpi2:cryptsetup-luks [2014/06/30 14:49] ingo_wichmann [Neuen Schlüssel hinzufügen] |
lpi2:cryptsetup-luks [2024/05/20 11:14] (aktuell) ingo_wichmann [Pakete] |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== cryptsetup-luks ====== | ====== cryptsetup-luks ====== | ||
| TODO: http://www.heise.de/security/artikel/Erfolgreicher-Angriff-auf-Linux-Verschluesselung-2072199.html beachten | TODO: http://www.heise.de/security/artikel/Erfolgreicher-Angriff-auf-Linux-Verschluesselung-2072199.html beachten | ||
| - | ===== Pakete ===== | + | ===== Vorbereitung ===== |
| + | ==== Pakete ==== | ||
| ''cryptsetup-luks'' | ''cryptsetup-luks'' | ||
| - | Partition oder logical volume anlegen: | + | Debian (ab 10): ''cryptsetup'' |
| + | |||
| + | ==== Kernel-Modul ==== | ||
| + | modinfo dm_crypt | ||
| + | muss vorhanden sein | ||
| + | |||
| + | ===== Verschlüsseltes Dateisystem anlegen ===== | ||
| + | ==== Partition oder logical volume anlegen ==== | ||
| + | fdisk /dev/<platte> | ||
| + | oder | ||
| lvcreate --size 1G --name lv_cryptsetup vg_centos6 | lvcreate --size 1G --name lv_cryptsetup vg_centos6 | ||
| - | Partition verschlüsseln: | + | ==== alte (Meta)daten von Partition entfernen ==== |
| - | cryptsetup luksFormat /dev/vg_centos6/lv_cryptsetup | + | wipefs -af /dev/<partition> |
| - | (( moderner: | + | ((oder |
| - | cryptsetup --cipher aes-xts-plain -s 512 luksFormat /dev/vg_centos6/lv_cryptsetup | + | dd if=/dev/zero of=/dev/<partition> status=progress bs=1M |
| + | oder | ||
| + | cryptsetup open --type plain -d /dev/urandom /dev/<partition> wipe_me | ||
| + | dd if=/dev/zero of=/dev/mapper/wipe_me status=progress bs=1M | ||
| + | cryptsetup close /dev/mapper/wipe_me | ||
| )) | )) | ||
| - | | ||
| - | Partition öffnen: | ||
| - | cryptsetup luksOpen /dev/vg_centos6/lv_cryptsetup crypt | ||
| - | Neues Device anzeigen: | + | ==== Partition verschlüsseln ==== |
| + | cryptsetup --verbose luksFormat --type luks2 /dev/<partition> | ||
| + | (( | ||
| + | Ausgabe genau lesen: da steht "UPPERCASE" ;-) | ||
| + | )) | ||
| + | |||
| + | === testen === | ||
| + | cryptsetup luksDump /dev/<partition> | ||
| + | |||
| + | ==== Partition öffnen ==== | ||
| + | cryptsetup open --type luks2 /dev/<partition> crypt | ||
| + | |||
| + | === Testen === | ||
| + | == Neues Device anzeigen == | ||
| dmsetup ls | dmsetup ls | ||
| + | ls -l /dev/mapper/crypt | ||
| - | Verschlüsselungsverfahren anzeigen: | + | == Verschlüsselungsverfahren anzeigen == |
| cryptsetup status crypt | cryptsetup status crypt | ||
| - | Dateisystem anlegen und mounten: | + | ==== Dateisystem anlegen ==== |
| mkfs.ext4 /dev/mapper/crypt | mkfs.ext4 /dev/mapper/crypt | ||
| + | |||
| + | ===== mounten und rebootfest machen ===== | ||
| + | ==== mounten ==== | ||
| mkdir /mnt/crypt | mkdir /mnt/crypt | ||
| mount /dev/mapper/crypt /mnt/crypt | mount /dev/mapper/crypt /mnt/crypt | ||
| - | Rebootfest machen: | + | ==== Rebootfest machen ==== |
| umount /mnt/crypt | umount /mnt/crypt | ||
| - | cryptsetup luksClose crypt | + | cryptsetup close crypt none |
| - | ''/etc/crypttab'' : | + | <file txt /etc/crypttab> |
| - | <file> | + | crypt /dev/<partition> none |
| - | crypt /dev/vg_centos6/lv_cryptsetup | + | |
| </file> | </file> | ||
| + | === testen === | ||
| + | TODO: ist das debian-spezifisch? | ||
| + | |||
| + | cryptdisks_start crypt | ||
| ===== Neues Passwort hinzufügen ===== | ===== Neues Passwort hinzufügen ===== | ||
| - | cryptsetup luksAddKey /dev/loop0 | + | cryptsetup luksAddKey /dev/<partition> |
| Vergebene Passwortslots anzeigen: | Vergebene Passwortslots anzeigen: | ||
| - | cryptsetup luksDump /dev/loop0 | + | cryptsetup luksDump /dev/<partition> |
| - | ====== cryptsetup (ohne luks) ====== | + | |
| - | //obsolet: heute benutzt man luks// | + | |
| - | ===== Pakete ===== | + | |
| - | ''cryptsetup-luks'' | + | |
| - | + | ||
| - | Partition oder logical volume anlegen: | + | |
| - | lvcreate --size 1G --name lv_cryptsetup vg_centos6 | + | |
| - | + | ||
| - | Partition verschlüsseln: | + | |
| - | cryptsetup create crypt /dev/vg_centos6/lv_cryptsetup | + | |
| - | + | ||
| - | Neues Device anzeigen: | + | |
| - | dmsetup ls | + | |
| - | ====== dmsetup ====== | + | |
| - | dmsetup ls | + | |
| - | dmsetup rm /dev/mapper/xy | + | |
| ====== Links ====== | ====== Links ====== | ||
| * http://en.wikipedia.org/wiki/Disk_encryption_theory | * http://en.wikipedia.org/wiki/Disk_encryption_theory | ||
| + | * https://cryptsetup-team.pages.debian.net/cryptsetup/encrypted-boot.html | ||
| + | * https://0pointer.net/blog/authenticated-boot-and-disk-encryption-on-linux.html | ||