Luks

De Linuxmemo.

(Différences entre les versions)
(Automatime)
(Auto mount)
 
(5 versions intermédiaires masquées)
Ligne 33 : Ligne 33 :
Créer un fichier cle
Créer un fichier cle
  dd if=/dev/random bs=32 count=1 of=/etc/lukskey
  dd if=/dev/random bs=32 count=1 of=/etc/lukskey
 +
chmod 400 /etc/lukskey
  xxd /etc/lukskey
  xxd /etc/lukskey
Ajouter la cle au disque /partition
Ajouter la cle au disque /partition
  cryptsetup luksAddKey /dev/sdb1 /etc/lukskey
  cryptsetup luksAddKey /dev/sdb1 /etc/lukskey
lier la cle au disque /partition
lier la cle au disque /partition
 +
cryptsetup luksDump /dev/sdb1|grep UUID
  vim etc/crypttab
  vim etc/crypttab
  sdb1_crypt UUID=658e8adb-778a-4bd6-b636-a0c5f7b353bb /etc/lukskey luks,discard
  sdb1_crypt UUID=658e8adb-778a-4bd6-b636-a0c5f7b353bb /etc/lukskey luks,discard
Ligne 43 : Ligne 45 :
  /dev/mapper/sdb1_crypt /backup              ext4    errors=remount-ro 0      1
  /dev/mapper/sdb1_crypt /backup              ext4    errors=remount-ro 0      1
-
==Automatime==
+
==Automatisme==
  cryptdisks_start labelvolume
  cryptdisks_start labelvolume
  cryptdisks_stop labelvolume
  cryptdisks_stop labelvolume
lit le fichier "/etc/crypttab"
lit le fichier "/etc/crypttab"
-
The first field, "target, describes the mapped device name" The second field, source device UUID=<luks_uuid> The third field, key file or "none" The fourth field, options
+
*The first field, "target, describes the mapped device name"
 +
*The second field, source device UUID=<luks_uuid> - cryptsetup luksDump /dev/sdb1|grep UUID
 +
*The third field, key file or "none"
 +
*The fourth field, options

Version actuelle en date du 28 janvier 2020 à 12:55

LUKS, pour Linux Unified Key Setup (sous Linux:cryptsetup, utilisant dm-crypt)

Sommaire

[modifier] Initialisation

Creation d'une partition type "83 linux":

Lsblk

fdisk /dev/sdb
o
n
p
w

Initialisation du chiffrement:

cryptsetup luksFormat /dev/sdb1

Mappage de la partition avec "device-mapper" et le module "crypt":

cryptsetup open /dev/sdb1 sdb1-crypt

Formatage de la partition:

mkfs.ext4 -L backup-crypt /dev/mapper/sdb1-crypt

Démontage propre:

cryptsetup close /dev/mapper/sdb1-crypt

[modifier] utilisation manuelle

cryptsetup open /dev/sdb1 sdb1-crypt
mount /dev/mapper/sdb1-crypt /backup

[modifier] Auto mount

Savoir si il existe déjà une cle

cryptsetup luksDump /dev/sdb1

Créer un fichier cle

dd if=/dev/random bs=32 count=1 of=/etc/lukskey
chmod 400 /etc/lukskey
xxd /etc/lukskey

Ajouter la cle au disque /partition

cryptsetup luksAddKey /dev/sdb1 /etc/lukskey

lier la cle au disque /partition

cryptsetup luksDump /dev/sdb1|grep UUID
vim etc/crypttab
sdb1_crypt UUID=658e8adb-778a-4bd6-b636-a0c5f7b353bb /etc/lukskey luks,discard

Montage automatique

vim /etc/fstab
/dev/mapper/sdb1_crypt /backup               ext4    errors=remount-ro 0       1

[modifier] Automatisme

cryptdisks_start labelvolume
cryptdisks_stop labelvolume

lit le fichier "/etc/crypttab"

  • The first field, "target, describes the mapped device name"
  • The second field, source device UUID=<luks_uuid> - cryptsetup luksDump /dev/sdb1|grep UUID
  • The third field, key file or "none"
  • The fourth field, options
Outils personnels