Table des matières
- 2026:
- 2025:
1 billet(s) pour avril 2026
| Notes ping ICMP | 2026/04/03 23:01 | Jean-Baptiste |
Notes Grub
Voir aussi :
- systemd-boot (Remplace Grub pour les machines compatibles EFI)
- u-boot
Voir les infos / config du GRUB
grubby --info=ALL
Exemple de pb
…Ensuite, s'installait Debian remplaçant ma racine sur la racine Xubuntu et en me servant du home précédemment créé.. De la sorte, plus de soucis de “operating system not found” mais un bel écran noir avec l'invite grub>. Un peu aride quand même… En fouillant un peu, j'ai fini par trouver dans le répertoire /boot/efi/EFI, un sous-répertoire ubuntu que j'ai supprimé. Ensuite, pour être sûr:
sudo os-prober sudo update-grub sudo update-initramfs -u
Redémarrage du pc et un bel écran grub en mode graphique ou j'ai pu choisir directement ma debian et booter dessus.
RedHat - Pour ajouter un paramètre
grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"
RedHat - Enlever un paramètre
Par exemple pour enlever ipv6.disable=1
# grub2-editenv - list | grep kernelopts kernelopts=root=/dev/mapper/vgsys01-lvroot ro crashkernel=auto resume=/dev/mapper/vgsys01-lvswap rd.lvm.lv=vgsys01/lvroot rd.lvm.lv=vgsys01/lvswap rhgb quiet ipv6.disable=1
grub2-editenv - set "kernelopts=root=/dev/mapper/vgsys01-lvroot ro crashkernel=auto resume=/dev/mapper/vgsys01-lvswap rd.lvm.lv=vgsys01/lvroot rd.lvm.lv=vgsys01/lvswap rhgb quiet"
Autres
Install grub Debian
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Debian --force
Notes GPG - Two cards with same subkeys
GPG - carte a puce - utiliser plusieurs cartes avec les mêmes clefs secrètes
Voir :
Backup GPG cards
Voir :
Pb - Error Please insert card with serial number 0001 12345678
$ diff .gnupg.nitrokey/private-keys-v1.d/AF710C976166A34B065DAF48430F30FEE69DA9D9.key .gnupg.yubykey/private-keys-v1.d/AF710C976166A34B065DAF48430F30FEE69DA9D9.key 6c6 < (#D27600012401030400050000A44B0000# OPENPGP.1)))) --- > (#D2760001240103040006142373880000# OPENPGP.1)))) $ diff .gnupg.nitrokey/private-keys-v1.d/C98A50CAD33BE20FCC23425F9FAA782B5195A9D2.key .gnupg.yubykey/private-keys-v1.d/C98A50CAD33BE20FCC23425F9FAA782B5195A9D2.key 6c6 < (#D27600012401030400050000A44B0000# OPENPGP.2)))) --- > (#D2760001240103040006142373880000# OPENPGP.2))))
$ gpg --card-status |grep 'card-no'
card-no: 0006 14237388
card-no: 0006 14237388
$ gpg --card-status |grep "^Application ID" Application ID ...: D27600012401030400050000A44B0000
$ opensc-tool -l # Detected readers (pcsc) Nr. Card Features Name 0 Yes Nitrokey Nitrokey Pro (00000000000000000000A44B) 00 00
D276000124010304 00050000A44B0000 D276000124010304 + '0006 14237388' + '0000' D2760001240103040006142373880000
Voici comment trouver ce numéro
$ opensc-explorer OpenSC Explorer version 0.21.0 Using reader with a card: Nitrokey Nitrokey Pro (00000000000000000000A44B) 00 00 OpenSC [3F00]> ls FileID Type Size 004F wEF 16 005E wEF 19 [0065] DF 32 [006E] DF 244 [007A] DF 5 00C4 wEF 7 0101 wEF 0 0102 wEF 0 0103 wEF 0 0104 wEF 0 5F50 wEF 0 5F52 wEF 10 7F21 wEF 0 [A400] DF 0 A401 wEF 0 [B600] DF 136 B601 wEF 158 [B800] DF 136 B801 wEF 158 OpenSC [3F00]> cat 004F 00000000: D2 76 00 01 24 01 03 04 00 05 00 00 A4 4B 00 00 .v..$........K..
Seulement voilà cette manip ne fonctionne pas la Yubikey
$ openpgp-tool -C Using reader with a card: Yubico YubiKey OTP+FIDO+CCID 00 00 AID: d2:76:00:01:24:01:03:04:00:06:14:23:73:88:00:00 Version: 3.4 Manufacturer: Yubico Serial number: 14237388
Voir aussi
$ opensc-tool --atr Using reader with a card: Yubico YubiKey OTP+FIDO+CCID 00 00 3b:fd:13:00:00:81:31:fe:15:80:73:c0:21:c0:57:59:75:62:69:4b:65:79:40
$ opensc-tool -a -v Using reader with a card: Yubico YubiKey OTP+FIDO+CCID 00 00 Card ATR: 3B FD 13 00 00 81 31 FE 15 80 73 C0 21 C0 57 59 ;.....1...s.!.WY 75 62 69 4B 65 79 40 ubiKey@
Exemple
La commande ci dessous ne fonctionne pas, ce n'est pas la bonne clef
$ gpg ~/tmp/plop.txt.gpg Please insert the card with serial number: 0005 0000BD62
Mais où est donc (ornicar ?) l'id 0000BD62 ?
$ rgrep 0000BD62 ~/.gnupg ~/.gnupg/private-keys-v1.d/F66AA9329AEA6F09D69DD852BF8233DE68119AF5.key:Token: D27600012401030400050000BD620000 OPENPGP.3 - 0005+0000BD62 ~/.gnupg/private-keys-v1.d/F66AA9329AEA6F09D69DD852BF8233DE68119AF5.key: (#D27600012401030400050000BD620000# OPENPGP.3)))) ~/.gnupg/private-keys-v1.d/3F5417680639FCEF05C54803B408B83BA496E964.key:Token: D27600012401030400050000BD620000 OPENPGP.1 - 0005+0000BD62 ~/.gnupg/private-keys-v1.d/3F5417680639FCEF05C54803B408B83BA496E964.key: (#D27600012401030400050000BD620000# OPENPGP.1)))) ~/.gnupg/private-keys-v1.d/DC81057888D07B12268226B9F136013C4D32566D.key:Token: D27600012401030400050000BD620000 OPENPGP.2 - 0005+0000BD62 ~/.gnupg/private-keys-v1.d/DC81057888D07B12268226B9F136013C4D32566D.key: (#D27600012401030400050000BD620000# OPENPGP.2))))
Trouver l'id la clef actuelle
$ gpg --card-status |grep "^Application ID" Application ID ...: D2760001240103040006142373880000
On remplace l'ancien id par le nouveau
cp -a ~/.gnupg ~/.gnupg.bak sed -i -e 's/D27600012401030400050000BD620000/D2760001240103040006142373880000/g' ~/.gnupg/private-keys-v1.d/*.key
Ça fonctionne
gpg ~/tmp/plop.txt.gpg
Autre
Python et carte GPG
Export / Import
python3 -m gpgcard.gpgcli --backup --pinpad --backup-keys --file gpg-key.pickle python3 -m gpgcard.gpgcli --restore --pinpad --file gpg-key.pickle
Gostcrypt
Voir :
Voir aussi :
- VeraCrypt (anciennement TrueCrypt)
- Cryptsetup - luks
- wipefs
Installation
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
visudo -f /etc/sudoers.d/gostcrypt
- /etc/sudoers.d/gostcrypt
jean ALL=(root) NOPASSWD: /usr/bin/gostcrypt
Test
gostcrypt --test
Pour une utilisation en ligne de commande sans sortie sur le serveur X
unset DISPLAY
Création d'un clef
gostcrypt --create-keyfile key < /dev/urandom
Pour l'aide
gostcrypt -t --help |less
Création d'un volume en ligne de commande (mode fichier)
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)
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
sudo gostcrypt -t --filesystem=none --protect-hidden=no -password="" -k /home/jean/key /dev/sdb
$ gostcrypt -t -l 1: /home/jean/disk /dev/loop0 -
Vérifions que la taille correspond bien à notre nouveau volume chiffré
fdisk -l /dev/loop0
Formatons !
mkfs.ext4 /dev/loop0
On monte la partition
mount -o noatime /dev/loop0 /mnt/gostcrypt/
df -hP /mnt/gostcrypt/
Quand on a fini
umount /mnt/gostcrypt gostcrypt -t -d
Bug
Error: No such file or directory
Solution : Prendre l'ancienne version gostcrypt_debian_7.4_amd64
Liens :
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)
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
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é)
find ../plop -not -size 64c -delete
Voilà comment utiliser toutes les clefs pour créer un volume
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
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 :
apt-get -f install
Notes GostCrypt package deb
Ouverture du paquage Debian
wget http://www.gostcrypt.org/download/1.3/Linux/Deb/GostCrypt_1.3_Debian.x86_64.deb mkdir ~/GostCrypt_1.3_Debian_Wheezy cd ~/GostCrypt_1.3_Debian_Wheezy/ ar x ../GostCrypt_1.3_Debian.x86_64.deb tar --same-owner xvf data.tar.xz mkdir DEBIAN cd DEBIAN tar xvf ../control.tar.gz rm control.tar.gz data.tar.xz debian-binary
Compilation
https://www.gostcrypt.org/wiki/doku.php?id=compilation_installation:compilation:linux:ubuntu
Install des dépendances
sudo apt-get install libfuse-dev libwxgtk2.8-dev pkg-config
wget http://www.gostcrypt.org/download/1.3/Linux/Sources/GostCrypt_1.3_Linux.tar.gz tar xvf GostCrypt_1.3_Linux.tar.gz make NOGUI=1
L'éxecutable est ici :
./Main/gostcrypt.cli
Modification du paquage
rm -f ~/GostCrypt_1.3_Debian_Wheezy/usr/bin/gostcrypt.cli ~/GostCrypt_1.3_Debian_Wheezy/usr/bin/gostcrypt cp -p Main/gostcrypt.cli ~/GostCrypt_1.3_Debian_Wheezy/usr/bin cd ~/GostCrypt_1.3_Debian_Wheezy rm -rf usr/share/applications/ usr/share/Gostcrypt/
$ cat DEBIAN/control - Depends: libc6, libfuse2, libgcc1, libstdc++6, libwxbase3.0-dev , libwxgtk3.0-dev + Depends: libc6, libfuse2, libgcc1, libstdc++6, libwxbase2.8-dev - Version: 1.3 + Version: 1.3~Jb
cd /usr/bin ln -s gostcrypt.cli gostcrypt
Reconstruction du paquet
cd ~/GostCrypt_1.3_Debian_Wheezy md5sum $(find . -not -wholename "./DEBIAN/*" -type f -not -name "debian-binary" )> DEBIAN/md5sums cd ~ dpkg-deb --build GostCrypt_1.3_Debian_Wheezy
Installation
dpkg -i GostCrypt_1.3_Debian_Wheezy.deb
