io.systemd.CryptEnroll¶
API for enrolling credentials into LUKS2 volumes via systemd-cryptenroll.
| Property | Value |
|---|---|
| Go package | github.com/rossedman/sdvarlink/systemd/latest/cryptenroll |
| Socket | /run/systemd/io.systemd.CryptEnroll |
| Available since | systemd v262 |
| Methods · types · errors | 2 · 1 · 5 |
Methods¶
Enroll¶
streaming optional · passes file descriptors
Enroll a credential into a LUKS2 volume. When enrolling a FIDO2 token that requires user presence, the call must be made with the 'more' flag, so that the server can report when a touch is required via a 'touch' state notification.
func (c *Client) Enroll(ctx context.Context, in EnrollIn) (*EnrollOut, error)
func (c *Client) EnrollMore(ctx context.Context, in EnrollIn) iter.Seq2[*EnrollOut, error]
Parameters
| Field | Type | Description |
|---|---|---|
node |
string |
Path to the LUKS2 block device or image to operate on. |
mechanism |
EnrollMechanism |
Which kind of credential to enroll. Only 'password', 'recovery' and 'fido2' may be enrolled via this interface for now; 'pkcs11' and 'tpm2' are rejected with an InvalidParameter error, currently. |
unlockPassword |
?string |
How to unlock the volume for the enrollment operation is inferred from which of the following fields are set: setting unlockPassword unlocks via that password, unlockKeyFile/unlockKeyFileDescriptor via a key file, unlockFido2Device via FIDO2, unlockTpm2Device via TPM2. Exactly one must be set. |
unlockKeyFile |
?string |
Path to a key file to unlock the volume with. |
unlockKeyFileDescriptor |
?int |
Index into the file descriptors passed along with this call, identifying a key file to unlock the volume with. |
unlockFido2Device |
?string |
Path to a FIDO2 device to unlock the volume with. Leave the path empty to automatically discover a suitable device. |
unlockTpm2Device |
?string |
Path to a TPM2 device to unlock the volume with. Leave the path empty to automatically discover a suitable device. |
password |
?string |
The passphrase to enroll, when mechanism is 'password'. Contains key material. |
fido2Device |
?string |
Path to the FIDO2 device to enroll, when mechanism is 'fido2'. Leave empty to automatically discover a suitable device. |
fido2Pin |
?string |
The FIDO2 token PIN to use for enrollment. Contains key material. |
fido2WithClientPin |
?bool |
Whether unlocking the FIDO2 enrollment shall require a client PIN. Defaults to true. |
fido2WithUserPresence |
?bool |
Whether unlocking the FIDO2 enrollment shall require user presence (touch). Defaults to true. |
fido2WithUserVerification |
?bool |
Whether unlocking the FIDO2 enrollment shall require user verification. Defaults to false. |
wipeSlots |
?[]int |
Explicit list of keyslot indexes to wipe after enrolling. |
wipeTypes |
?[]EnrollMechanism |
Wipe all already-enrolled slots of these types after enrolling. |
allowInteractiveAuthentication |
?bool |
Controls whether interactive authentication (via polkit) shall be allowed. If unspecified defaults to false. |
Reply
| Field | Type | Description |
|---|---|---|
slot |
?int |
The keyslot the new credential was enrolled into. Set on the terminating reply only. |
wipedSlots |
?[]int |
The keyslots wiped as part of this call, if any. |
recoveryKey |
?string |
The generated recovery key, when mechanism is 'recoveryKey'. Contains key material. |
state |
?string |
Progress indicator, only sent on intermediate replies when 'more' was set. Currently the only value is 'touch', signalling that the FIDO2 token is waiting for a touch. Unset on the terminating reply. |
ListSlots¶
streaming (requires more)
Enumerate the keyslots currently enrolled in a LUKS2 volume, one per reply. Must be called with the 'more' flag.
Parameters
| Field | Type | Description |
|---|---|---|
node |
string |
Path to the LUKS2 block device or image to operate on. |
Reply
| Field | Type | Description |
|---|---|---|
slot |
?int |
A currently enrolled keyslot index. |
type |
?EnrollMechanism |
The type of the keyslot. |
Types¶
EnrollMechanism¶
The credential types this interface knows about, used both as the enrollment mechanism and as the slot type reported by ListSlots.
| Value | Description |
|---|---|
password |
A regular passphrase |
recovery |
A randomly generated recovery key |
pkcs11 |
A PKCS#11 security token (not enrollable via this interface) |
fido2 |
A FIDO2 security token |
tpm2 |
A TPM2 device (not enrollable via this interface) |
Errors¶
| Error | Go type | Description |
|---|---|---|
VolumeUnderForeignManagement |
VolumeUnderForeignManagementError |
The volume is managed by another subsystem (e.g. systemd-homed) and may not be enrolled into directly. |
PasswordRequired |
PasswordRequiredError |
A password is required to unlock the volume, but none was provided. |
PasswordIncorrect |
PasswordIncorrectError |
The provided password did not unlock the volume. |
FidoDeviceNotFound |
FidoDeviceNotFoundError |
No matching FIDO2 device was found. |
FidoActionTimeout |
FidoActionTimeoutError |
The FIDO2 token was not interacted with in time. |