|
|
@@ -21,7 +21,7 @@ Tuto à refaire: on va partir en RAID0 car plus simple pour un déchiffrement en
|
|
|
|
|
|
## Partition de boot
|
|
|
|
|
|
-On crée une partition de boot uniquement sur le premier disque: 512 Mo
|
|
|
+On crée une partition de boot sur les deux disques: 512 Mo
|
|
|
|
|
|
## *Swap*
|
|
|
|
|
|
@@ -154,47 +154,132 @@ Syncing disks.
|
|
|
|
|
|
## Partitionnement du second disque
|
|
|
|
|
|
-Cette fois, on ne crée que deux partitions:
|
|
|
+On fait un dump du disque précédent:
|
|
|
|
|
|
-- une Swap de `+24117248` secteurs
|
|
|
-- une principale sur le reste du disque
|
|
|
+```bash
|
|
|
+sfdisk --dump /dev/sda > sda.dump
|
|
|
+```
|
|
|
|
|
|
```bash
|
|
|
-fdisk /dev/sdb
|
|
|
+# cat sda.dump
|
|
|
+label: gpt
|
|
|
+label-id: F4C65904-AE36-9840-8A8E-896F80BB3E44
|
|
|
+device: /dev/sda
|
|
|
+unit: sectors
|
|
|
+first-lba: 2048
|
|
|
+last-lba: 3907029134
|
|
|
+sector-size: 512
|
|
|
+
|
|
|
+/dev/sda1 : start= 2048, size= 1048576, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=28EE3FC6-31D0-9940-AE6D-747516CA9E60
|
|
|
+/dev/sda2 : start= 1050624, size= 24117249, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=4112F137-A11E-434B-A6FF-A8BB94479F62
|
|
|
+/dev/sda3 : start= 25169920, size= 3881859072, type=E6D6D379-F507-44C2-A23C-238F2A3DF928, uuid=1E816DE5-C4FE-594A-9577-E5617373F36A
|
|
|
```
|
|
|
|
|
|
+On duplique vers le second disque :
|
|
|
+
|
|
|
+```bash
|
|
|
+sfdisk /dev/sdb < sda.dump
|
|
|
```
|
|
|
-Command (m for help): g
|
|
|
-Created a new GPT disklabel (GUID: EB07A51E-0F98-0949-8126-E55071DD5879).
|
|
|
|
|
|
-Command (m for help): n
|
|
|
-Partition number (1-128, default 1):
|
|
|
-First sector (2048-3907029134, default 2048):
|
|
|
-Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3907029134, default 3907028991): +24117248
|
|
|
+# Chiffrement
|
|
|
|
|
|
-Created a new partition 1 of type 'Linux filesystem' and of size 11.5 GiB.
|
|
|
+Voir [Chiffrement sur cette page](gnu-linux/serveurs/installation/ecaz-serveur-proxmox.md)
|
|
|
|
|
|
-Command (m for help): t
|
|
|
-Selected partition 1
|
|
|
-Partition type or alias (type L to list all): 19
|
|
|
-Changed type of partition 'Linux filesystem' to 'Linux swap'.
|
|
|
+## Chiffrement des swap
|
|
|
|
|
|
-Command (m for help): n
|
|
|
-Partition number (2-128, default 2):
|
|
|
-First sector (24119297-3907029134, default 24121344):
|
|
|
-Last sector, +/-sectors or +/-size{K,M,G,T,P} (24121344-3907029134, default 3907028991):
|
|
|
+```bash
|
|
|
+swapoff -a
|
|
|
+cryptsetup open --type plain --cipher aes-xts-plain64 --key-file /dev/urandom /dev/sda2 cryptswapa
|
|
|
+cryptsetup open --type plain --cipher aes-xts-plain64 --key-file /dev/urandom /dev/sdb2 cryptswapb
|
|
|
+mkswap /dev/mapper/cryptswapa
|
|
|
+mkswap /dev/mapper/cryptswapb
|
|
|
+swapon /dev/mapper/cryptswapb
|
|
|
+swapon /dev/mapper/cryptswapa
|
|
|
+```
|
|
|
|
|
|
-Created a new partition 2 of type 'Linux filesystem' and of size 1.8 TiB.
|
|
|
+# Configuration du RAID
|
|
|
|
|
|
-Command (m for help): t
|
|
|
-Partition number (1,2, default 2):
|
|
|
-Partition type or alias (type L to list all): 43
|
|
|
+## Partitions de démarrage
|
|
|
|
|
|
-Changed type of partition 'Linux filesystem' to 'Linux LVM'.
|
|
|
+On se met en RAID1
|
|
|
|
|
|
-Command (m for help): w
|
|
|
+```bash
|
|
|
+# mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sd[a-b]1
|
|
|
+mdadm: Note: this array has metadata at the start and
|
|
|
+ may not be suitable as a boot device. If you plan to
|
|
|
+ store '/boot' on this device please ensure that
|
|
|
+ your boot-loader understands md/v1.x metadata, or use
|
|
|
+ --metadata=0.90
|
|
|
+mdadm: size set to 523264K
|
|
|
```
|
|
|
|
|
|
+Il faut confirmer avec `y`:
|
|
|
+
|
|
|
+```
|
|
|
+Continue creating array? y
|
|
|
+```
|
|
|
+
|
|
|
+Confirmation:
|
|
|
+
|
|
|
+```
|
|
|
+mdadm: Defaulting to version 1.2 metadata
|
|
|
+mdadm: array /dev/md1 started.
|
|
|
+```
|
|
|
+
|
|
|
+Ensuite on formate cette partition:
|
|
|
+
|
|
|
+```bash
|
|
|
+mkfs.ext4 /dev/md1
|
|
|
+```
|
|
|
+
|
|
|
+## Partitions de données
|
|
|
+
|
|
|
+On utilise RAID1 pour le serveur de redondance
|
|
|
+
|
|
|
+```bash
|
|
|
+mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sd[a-b]3
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+### Chiffrement LUKS de la partition principale
|
|
|
+
|
|
|
+Initialiser le chiffrement LUKS sur le RAID :
|
|
|
+
|
|
|
+```bash
|
|
|
+cryptsetup -q -s 512 -c aes-xts-plain64 luksFormat /dev/md0
|
|
|
+```
|
|
|
+
|
|
|
+```bash
|
|
|
+# cryptsetup -q -s 512 -c aes-xts-plain64 luksFormat /dev/md0
|
|
|
+Enter passphrase for /dev/md0:
|
|
|
+```
|
|
|
+
|
|
|
+On récupère l'UUID et **on le note précieusement** :
|
|
|
+
|
|
|
+```bash
|
|
|
+cryptsetup luksDump /dev/md0 | grep UUID | awk '{print $2}'
|
|
|
+```
|
|
|
+
|
|
|
+:::information
|
|
|
+
|
|
|
+Cette information (UUID) sera nécessaire au moment de configurer le déchiffrement au démarrage
|
|
|
+
|
|
|
+:::
|
|
|
+
|
|
|
+Ouvrir le conteneur chiffré :
|
|
|
+
|
|
|
+```bash
|
|
|
+cryptsetup luksOpen /dev/md0 raid_crypt
|
|
|
+```
|
|
|
+
|
|
|
+Saisir la passphrase:
|
|
|
+
|
|
|
+```
|
|
|
+Enter passphrase for /dev/md0:
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
# Configuration de LVM
|
|
|
|