February 4, 2024
openssh
server in initrd
. Even with this, synchroneous intervention is still required.clevis
, the automated encryption frameworkhttps://github.com/latchset/clevis
The clevis
project is a pluggable framework for automated decryption.
The encryption-decryption is left to jose
, a C
implementation of the JavaScript Object Signing and Encryption standard.
In clevis
terminology, a pin is a plugin which implements automated decryption.
To encrypt some data with clevis
, one can use this command:
The clevis
command provides support to encrypt a key in a Trusted Platform Module 2.0 (TPM 2.0) chip.
First, a key \(K\) is generated to encrypt the message. Then \(K\) is encrypted using the TPM 2.0 chip, and will be decrypted the same way when clevis
needs \(K\) to decrypt the message stored in the JWE.
tang
pinhttps://github.com/latchset/tang
The tang
project is a server implementation which provides cryptographic binding services without the need for an escrow. The clevis
command has full support for tang
.
Adi Shamir (1979)
The clevis
command provides a way to mix pins together to provide sophisticated unlocking policies. This is accomplished by using an algorithm called Shamir Secret Sharing (SSS).
tang
protocol\(g\) is a public parameter.
Hypothesis: Given \(C = A*B\), is is computationally infeasible to retrieve \(A\) and \(B\).
After the protocol execution, both parties have agreed on a common symmetric encryption key \(K\), while an eavesdropper has not aquired any information.
\[\begin{aligned} K' &= y - gSE = xS - gSE \\ &= (gE + gC)S - gSE = gES + gCS - gSE \\ &= gCS = K \end{aligned}\]
tang
servertang
server is not able to recover the secret if it does not have access to the clientNixOS
implementationtang
moduleAdded in #247037 by jfroche, thanks!
Enable it with:
Specify the range of IPs allowed to communicate with the tang
server:
(This has to be a trusted subnet that you fully control)
Don’t forget to open the TCP port in the firewall:
You can customize it with:
clevis
moduleRuns in initrd
just before root disk decryption
Tries to run
with provided secret
If success, uses the value to decrypt root partition
If failure, fallbacks on interactive unlocking
First, create a secret using the clevis
CLI:
Declare you encrypted devices in your NixOS
configuration:
Supported encrypted systems:
zfs
bcachefs
luks
Profit!
bcachefs
as root partitiontang
servers (because why not)tang
servers to be available at boot timeYubiKey
for example)