「Clevis」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(booster ページより記事をコピー)
(booster ページより記事をコピー)
15行目: 15行目:
 
* 普通の人間が覚えられるパスワードの長さには限界があり (エントロピーにして ~20-30 ビット)、近代的なブロック暗号に使う鍵としては弱すぎます (128/256 ビット)。
 
* 普通の人間が覚えられるパスワードの長さには限界があり (エントロピーにして ~20-30 ビット)、近代的なブロック暗号に使う鍵としては弱すぎます (128/256 ビット)。
   
  +
解決策としては強固な鍵を別のどこかに保持しておくという方法があります。例えば [[TPM]] チップや [[Yubikey]]、あるいは他のネットワークサービスなどが考えられます。[https://github.com/latchset/clevis/ Clevis] はこのアイデアを実現するフレームワークです。抜き差し可能な ''pin'' を使ってデータを暗号化します (clevis の用語では ''bind'')。現在 clevis には3つの pin が存在します:
A solution for it would be encrypting data with a strong key stored securely somewhere else, for example at your [[TPM]] chip or [[YubiKey]] or some network service. [https://github.com/latchset/clevis/ Clevis] is a framework that implements this idea. It allows to encrypt (in terms of clevis ''bind'') data with a pluggable ''pin''. Currently clevis implements 3 pins:
 
   
* TPM2 data binding (works only if you have a [[Trusted Platform Module]] chip at your computer)
+
* TPM2 データバインディング (works only if you have a [[Trusted Platform Module]] chip at your computer)
* Network service (called [https://github.com/latchset/tang Tang]) data binding
+
* ネットワークサービス (別名 [https://github.com/latchset/tang Tang]) データバインディング
* [[Wikipedia:Shamir's Secret Sharing|Shamir's Secret Sharing]] that allows you to combine other pins.
+
* [[Wikipedia:Shamir's Secret Sharing|シャミア秘密分散]]で他の pin を組み合わせる
 
* YubiKey binding using an [https://github.com/anatol/clevis.go/blob/main/clevis-encrypt-yubikey external plugin].
 
* YubiKey binding using an [https://github.com/anatol/clevis.go/blob/main/clevis-encrypt-yubikey external plugin].
   

2022年10月24日 (月) 12:05時点における版

関連記事

clevis allows binding a LUKS volume to a system by creating a key and encrypting it using the TPM, and sealing the key using PCR values which represent the system state at the time of the Clevis pin creation.

暗号化された LUKS パーティションの解錠に、ユーザーによるパスワードの入力を使うというのは伝統的で広く使われる方法ですが、デメリットも存在します:

  • 手動で入力する必要があるため、自動的に起動したい場合には使えません (例: 巨大なサーバーファーム)。
  • 普通の人間が覚えられるパスワードの長さには限界があり (エントロピーにして ~20-30 ビット)、近代的なブロック暗号に使う鍵としては弱すぎます (128/256 ビット)。

解決策としては強固な鍵を別のどこかに保持しておくという方法があります。例えば TPM チップや Yubikey、あるいは他のネットワークサービスなどが考えられます。Clevis はこのアイデアを実現するフレームワークです。抜き差し可能な pin を使ってデータを暗号化します (clevis の用語では bind)。現在 clevis には3つの pin が存在します:

警告: If you use this method on your root volume, this means that, as long as the previously mentioned certain conditions are met, your computer will unlock automatically at boot without needing to enter an encryption password.
  • This means that access to data is not protected in case the hardware gets stolen.
  • Be aware that this method makes you more vulnerable to cold boot attacks, because even if your computer has been powered off for a long time (ensuring the memory is completely cleared), an attacker could simply turn it on and wait for the TPM to load the key automatically. This may be a concern for high-value targets.

Installation

To use clevis install clevis package.

Bind some data

Here is an example of data binding with TPM2:

$ clevis encrypt tpm2 '{}' <<< 'hello, world'
eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlJQkxxT3FVenVDU1FmWkprNmdDN2wzMW43V3M2Y2FZd0VZS1BSR3Q0OHJEQUJBV2Z4M3pTUUNUTmtHZE9BM2FZd2RTZk9GcXZWdnVlQ3lPamFsWldCT2R4RlJKSzl5ZVRCM0pkNFktcF9HalhhNmlnLWxxNmtmMHZTWWkzOWMxVEpES1RYRVZTdnlXSlpEbGdxQ0JPMVNxeGJBd2tfSnIyRlRNY3hvNGtpSmNtMEVjbWd5dFdyME00QmcySlg4aVo3MEt1MTVjNzFORU5Ra3RjdGMtREhBVGFQcHJ2VzI2Z3d1YmUxckRfX19aV2tHaG9mX053M0M1OHlOcXF2RUpPZUwzNTZHNXJHNVVtYmUtWWV4Ujl2SEppZWlua3ZaNTJoMFVRYWVNSm9LYjJuNjlVTGZHb2J1NElTN20iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJQ2poWDBVeTJKZVpSNU9pRU0ySktSeEtnUElYQ3dGNnRNR09NTDZ0ZnE5aiIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..1P2Emag_4k-GlhyY.MuQQYPa8QHrysZ74uA.0ddDxfZA3R-cCmaKu5yUZA

This long base64-encoded message is our text encrypted with an internal TPM key. It can be decrypted at the current computer only. Trying to decrypt it from another computer (or rather with another TPM chip) will return an error.

$ clevis decrypt tpm2 '{}' <<< 'eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlJQkxxT3FVenVDU1FmWkprNmdDN2wzMW43V3M2Y2FZd0VZS1BSR3Q0OHJEQUJBV2Z4M3pTUUNUTmtHZE9BM2FZd2RTZk9GcXZWdnVlQ3lPamFsWldCT2R4RlJKSzl5ZVRCM0pkNFktcF9HalhhNmlnLWxxNmtmMHZTWWkzOWMxVEpES1RYRVZTdnlXSlpEbGdxQ0JPMVNxeGJBd2tfSnIyRlRNY3hvNGtpSmNtMEVjbWd5dFdyME00QmcySlg4aVo3MEt1MTVjNzFORU5Ra3RjdGMtREhBVGFQcHJ2VzI2Z3d1YmUxckRfX19aV2tHaG9mX053M0M1OHlOcXF2RUpPZUwzNTZHNXJHNVVtYmUtWWV4Ujl2SEppZWlua3ZaNTJoMFVRYWVNSm9LYjJuNjlVTGZHb2J1NElTN20iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJQ2poWDBVeTJKZVpSNU9pRU0ySktSeEtnUElYQ3dGNnRNR09NTDZ0ZnE5aiIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..1P2Emag_4k-GlhyY.MuQQYPa8QHrysZ74uA.0ddDxfZA3R-cCmaKu5yUZA'
hello, world

Bind a LUKS volume

この記事あるいはセクションで使われている用語や表現には問題が存在します。
議論: please use the first argument of the template to provide a brief explanation. (議論: トーク:Clevis#)
警告: Set a strong backup password in case the TPM unsealing fails, using:
# cryptsetup luksAddKey /dev/sdX

To bind a LUKS volume to the TPM, use:

# clevis luks bind -d /dev/sdX tpm2 '{}'

where '{}' contains the configuration: even with no parameters the drive cannot be decrypted from another computer, unless the attacker knows the backup password.

ノート: To seal the LUKS key against the UEFI settings and the Secure Boot policy, use:
'{"pcr_ids":"1,7"}'

If the UEFI or Secure Boot settings are modified, the TPM will compute different PCR values and decryption will fail. This gives protection against evil maid attacks.

For a list of parameters, see clevis-encrypt-tpm2(1) § CONFIG.

For a full explanation of the meanings of PCRs, see the TCG specification (§ 2.3.4).

If this fails with ERROR: pcr-input-file filesize does not match pcr set-list, you should specify a different pcr bank:

'{"pcr_bank":"sha256","pcr_ids":"1,7"}'

As of August 2022 Clevis only supports sha1 (default) and sha256 banks, so naturally the only different option is sha256 - you can look up available and used banks using # tpm2_pcrread.

To generate a new Clevis pin after changes in system configuration that result in different PCR values, for example updating the UEFI when PCR 0 is used, run

# cryptsetup luksDump /dev/sdX
Tokens:
  token slot: clevis
        Keyslot:  keyslot

to find the slot used for the Clevis pin, then

# clevis luks regen -d /dev/sdX -s keyslot

To remove the Clevis binding, run:

# clevis luks unbind -d /dev/sdX -s keyslot 
警告: Double check you have chosen the right slot, or you might lose access to your volume.

You can unlock a TPM-bound volume using:

# clevis luks unlock -d /dev/sdX

For automated decryption of volumes in /etc/crypttab, enable clevis-luks-askpass.path.

For automated decryption of the root volume, we should make some changes to our Initramfs generators:

Mkinitcpio hook

Install the mkinitcpio-clevis-hookAUR package. Then enable the clevis hook editing mkinitcpio.conf:

/etc/mkinitcpio.conf
# Edit the hooks and add clevis before the 'encrypt' hook. Eg:
HOOKS=(.. clevis encrypt ..)
ノート: If you are using plymouth, replace the plymouth-encrypt hook with encrypt. plymouth-encrypt is reported to be buggy when the device is already unlocked. More info.

At the end regenerate the initramfs.

Booster

Luckily Booster automatically decrypts LUKS volumes bound using Clevis out of the box!

Booster is also able to read the LUKS tokens, decode clevis information, reconstruct the password and unlock the partition automatically.

Tang (network binding) pin requires network enabled. Please refer to Booster#Configuration section for more information on network configuration with booster.

Dracut

Dracut needs the following extra packages:

Followed by an initramfs regeneration:

# dracut -f

Tips and tricks

YubiKey binding

Clevis allows binding a LUKS partition using YubiKey's challenge-response mode. To bind a LUKS partition, run

# clevis luks bind -d /dev/sdX yubikey '{"slot":1}'

Install yubikey-personalization. Edit the configuration file and add following option:

/etc/booster.yaml
extra_files: ykchalresp

Regenerate the booster images. Booster will detect this configuration during boot and use the present YubiKey to unlock the drive.

See also