{{tag>Brouillon Crypt X11}} # Gostcrypt Voir : * http://www.nolimitsecu.fr/gostcrypt/ * http://www.gostcrypt.org/gostcrypt.php?langue=fr * http://www.gostcrypt.org/download/1.0/doc/GostCryptUserGuide.pdf * https://www.esiea.fr/de-truecrypt-a-gostcrypt/ Voir aussi : * VeraCrypt (anciennement TrueCrypt) * Cryptsetup - luks * wipefs Installation ~~~bash wget "https://www.gostcrypt.org/download/1.0/linux/Gostcrypt_1.0.deb" sha256sum Gostcrypt_1.0.deb dpkg -i Gostcrypt_1.0.deb apt-get -f install ~~~ config du sudoers Normalement pas nécessaire, sauf pour disque ou partition entière ** Attention a ne pas autoriser n'importe qui !\\ Car droit de détruire le système de fichier ** ~~~bash visudo -f /etc/sudoers.d/gostcrypt ~~~ `/etc/sudoers.d/gostcrypt` ~~~ jean ALL=(root) NOPASSWD: /usr/bin/gostcrypt ~~~ Test ~~~bash gostcrypt --test ~~~ Pour une utilisation en ligne de commande sans sortie sur le serveur X ~~~bash unset DISPLAY ~~~ Création d'un clef ~~~bash gostcrypt --create-keyfile key < /dev/urandom ~~~ Pour l'aide ~~~bash gostcrypt -t --help | less ~~~ Création d'un volume en ligne de commande (mode fichier) ~~~bash gostcrypt -t -k key -c disk --encryption="GOST 28147-89" --hash="GOST R 34.11-2012" -password="" --volume-type=normal --random-source=/dev/urandom --filesystem=none --size=$((100 * 1024 * 1024)) ~~~ Création d'un volume en ligne de commande (mode disque / partition) ~~~bash gostcrypt -t -k /home/jean/key -c /dev/sdg --encryption="GOST 28147-89" --hash="GOST R 34.11-2012" -password="" --volume-type=normal --random-source=/dev/urandom --filesystem=none ~~~ ~~~bash sudo gostcrypt -t --filesystem=none --protect-hidden=no -password="" -k /home/jean/key /dev/sdb ~~~ ~~~bash $ gostcrypt -t -l 1: /home/jean/disk /dev/loop0 - ~~~ Vérifions que la taille correspond bien à notre nouveau volume chiffré ~~~bash fdisk -l /dev/loop0 ~~~ Formatons ! ~~~bash mkfs.ext4 /dev/loop0 ~~~ On monte la partition ~~~bash mount -o noatime /dev/loop0 /mnt/gostcrypt/ ~~~ ~~~bash df -hP /mnt/gostcrypt/ ~~~ ## Quand on a fini ~~~bash umount /mnt/gostcrypt gostcrypt -t -d ~~~ ## Bug ~~~ Error: No such file or directory ~~~ Solution : Prendre l'ancienne version gostcrypt_debian_7.4_amd64 Liens : * https://www.gostcrypt.org/archive.php * https://www.gostcrypt.org/download/1.0/linux/gostcrypt_debian_7.4_amd64 ## Accroire la sécurité en utilisant plusieurs clefs La taille fixe de clef, limité à 64 octets n'est pas une limite. Ici nous allons utiliser un gros fichier (monfichierclef) que nous allons chiffrer avec une petite sous-clef (k1.txt). Tout cela pour créer une nouvelle clef (k2) ~~~bash cat monfichierclef | openssl enc -bf -S abcd -out k2 -pass file:k1.txt ~~~ L'option **-S**, c'est le sel (salt), ici **abcd**. Il doit être en hexadécimal. \\ Sans cela la commande openssl, créerai à chaque fois un fichier **k2** différant Les clefs doivent obligatoirement faire une taille de 64 octets, découpons **k2** en plusieurs petites clefs ~~~bash mkdir plop cd plop split -b 64 ../k2 ~~~ Nous effaçons le seul fichier qui ne fait pas exactement 64 octets, c'est à dire le dernier généré (tronqué) ~~~bash find ../plop -not -size 64c -delete ~~~ Voilà comment utiliser toutes les clefs pour créer un volume ~~~bash gostcrypt -t -k $(echo *| tr " " ",") -c ../disk --encryption="GOST 28147-89" --hash="GOST R 34.11-2012" -password="" --volume-type=normal --random-source=/dev/urandom --filesystem=none --size=$((100 * 1024 * 1024) ~~~ ## Pb install ~~~bash wget https://www.gostcrypt.org/download/1.0/linux/Gostcrypt_1.0.deb dpkg -i Gostcrypt_1.0.deb ~~~ ~~~ # apt-get -f install Unpacking libgl1-mesa-dri:amd64 (from .../libgl1-mesa-dri_8.0.5-4+deb7u2_amd64.deb) ... dpkg: error processing /var/cache/apt/archives/libgl1-mesa-dri_8.0.5-4+deb7u2_amd64.deb (--unpack): trying to overwrite shared '/etc/drirc', which is different from other instances of package libgl1-mesa-dri:amd64 Processing triggers for man-db ... Errors were encountered while processing: /var/cache/apt/archives/libgl1-mesa-dri_8.0.5-4+deb7u2_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) ~~~ Si erreur, relancer la commande : ~~~bash apt-get -f install ~~~