RHEL:FDEパスワードなし - パーティションのキーから起動

RHEL:FDEパスワードなし - パーティションのキーから起動

RHEL 7.2では、LVMを使用してOSを暗号化し、暗号化されていないパーティションのキーを使用してパスワードを入力せずに起動しようとしています。

 LV    VG    Attr     LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
 home rhel -wi-ao---- 22.35g                                                 
 root rhel -wi-ao---- 27.94g                                                 
 swap rhel -wi-ao----  1.86g   

/media次のコマンドを使用して、鍵を生成した暗号化されていないマウントポイントを作成しました。

dd bs=512 count=4 if=/dev/urandom of=/media/fdekey iflag=fullblock

次のパスワードでキーを追加しました。

 cryptsetup luksAddKey /dev/mapper/rhel-root /media/fdekey
 cryptsetup luksAddKey /dev/mapper/rhel-home /media/fdekey
 cryptsetup luksAddKey /dev/mapper/rhel-swap /media/fdekey

次に編集して/etc/crypttabキーを追加します。

luks-b7ac522a-52fd-4540-917d-3454dafdf7dc UUID=b7ac522a-52fd-4540-917d-3454dafdf7dc /media/fdekey luks
luks-ad431e02-a49d-4ba3-bf9c-06e7a9f9a7f9 UUID=ad431e02-a49d-4ba3-bf9c-06e7a9f9a7f9 /media/fdekey luks
luks-a3819933-91d5-434b-bb6c-42d273bb34c2 UUID=a3819933-91d5-434b-bb6c-42d273bb34c2 /media/fdekey luks

修正済み/etc/dracut.conf

# dracut modules to omit
omit_dracutmodules+="systemd"

# dracut modules to add to the default
add_dracutmodules+="crypt lvm"

修正済み/etc/default/grub:

rd.luks.key=/media/fdekey:LABEL=media

生成されたグラブ:

grub2-mkconfig -o /boot/grub2/grub.cfg

生成された initramfs:

dracut -fv

出力df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-3        28G  876M   28G   4% /
devtmpfs        9.6G     0  9.6G   0% /dev
tmpfs           9.6G     0  9.6G   0% /dev/shm
tmpfs           9.6G  8.4M  9.6G   1% /run
tmpfs           9.6G     0  9.6G   0% /sys/fs/cgroup
/dev/sda2       4.5G   19M  4.2G   1% /media
/dev/sda1       950M  133M  818M  14% /boot
/dev/dm-5        23G   33M   23G   1% /home
tmpfs           2.0G     0  2.0G   0% /run/user/0

出力fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a0a6e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1953791      975872   83  Linux
/dev/sda2         1953792    11718655     4882432   83  Linux
/dev/sda3        11718656   121114623    54697984   8e  Linux LVM

Disk /dev/mapper/rhel-root: 30.0 GB, 30001856512 bytes, 58597376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/rhel-swap: 2000 MB, 2000683008 bytes, 3907584 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/luks-b7ac522a-52fd-4540-917d-3454dafdf7dc: 1998 MB, 1998585856 bytes, 3903488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/luks-a3819933-91d5-434b-bb6c-42d273bb34c2: 30.0 GB, 29999759360 bytes, 58593280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/rhel-home: 24.0 GB, 23999807488 bytes, 46874624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/luks-ad431e02-a49d-4ba3-bf9c-06e7a9f9a7f9: 24.0 GB, 23997710336 bytes, 46870528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

いくつかのステップが欠けているようです。起動すると、まだパスワードの入力を求められます。

ベストアンサー1

ディスク構成を変更した後にinitramfsを再生成することを忘れたようです。 RHEL 6/7で再生成するには、rootとして実行してください。

dracut --force

おすすめ記事