Skip to content

Commit 784c968

Browse files
committed
added autoretry stop mechansm
Signed-off-by: Zen <[email protected]>
1 parent 0cbf5ab commit 784c968

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ This configuration can be overriden in the specified user config if an actual se
255255

256256
Depends on the `ugrd.crypto.gpg` submodule, meant to be used with a YubiKey.
257257

258+
> Sets `cryptsetup_autoretry` to false
259+
258260
`sc_public_key` should point to the public key associated with the smarcard used to decrypt the GPG protected LUKS keyfile.
259261
This file is added as a dependency and pulled into the initramfs.
260262

@@ -301,6 +303,7 @@ Cryptsetup global config:
301303

302304
* `cryptsetup_key_type` (keyfile) Used to determine how a key is unlocked, setting it globally changes the default for definitions
303305
* `cryptsetup_retries` (5) The default number of times to try to unlock a device.
306+
* `cryptsetup_autoretry` (false) Whether or not to automatically retry mount attempts.
304307

305308
##### Key type definitions
306309

ugrd/crypto/cryptsetup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ def open_crypt_device(self, name, parameters):
132132
' break',
133133
' else',
134134
f' echo "Failed to open device: {name} ($i / {retries})"']
135+
# Halt if the autoretry is disabled
136+
if not self.config_dict['cryptsetup_autoretry']:
137+
out += [' read -sr -p "Press enter to retry"']
135138
# Add the reset command if it exists
136139
if reset_command := parameters.get('reset_command'):
137140
out += [' echo "Running key reset command"',

ugrd/crypto/cryptsetup.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ paths = [ "run" ]
55
_kmod_depend = [ "dm_crypt", "crc32c" ]
66

77
cryptsetup_retries = 5
8+
cryptsetup_autoretry = true
89
cryptsetup_key_type = "keyfile"
910

1011
[imports.config_processing]
@@ -30,3 +31,4 @@ cryptsetup = "dict" # Dict of cryptsetup volume to be unlocked, keyed by mapped
3031
cryptsetup_key_type = "str" # The default key type to use for unlocking devices
3132
cryptsetup_key_types = "dict" # Dict containing key types and their associated mount commands
3233
cryptsetup_retries = "int" # Number of times to retry unlocking a device
34+
cryptsetup_autoretry = "bool" # Whether to automatically retry unlocking devices

ugrd/crypto/smartcard.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ modules = [ "ugrd.crypto.gpg" ]
33
binaries = [ "/usr/libexec/scdaemon" ]
44

55
_kmod_depend = "uhid"
6+
cryptsetup_autoretry = false
67

78
[cryptsetup_key_types.gpg]
89
reset_command = "gpgconf --reload scdaemon && gpg --card-status"

0 commit comments

Comments
 (0)