Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt unlock policy #306

Merged
merged 6 commits into from
Jun 28, 2024
Merged

Conversation

tmuehlbacher
Copy link

This should fix some issues brought up in #292 as well as a request from NixOS/nixpkgs#316695

It's probably best to first wait for some feedback before merging. :)

We lose that bit of info but it's weird to require a parameter simply
because we want to use it for a log message.

Signed-off-by: Thomas Mühlbacher <[email protected]>
The term option is already used for mount options and the `Option` type.
In other modules it's just called `cli`, so let's do that here as well.

Signed-off-by: Thomas Mühlbacher <[email protected]>
This changes the semantics of some arguments related to unlocking and
slightly changes the unlocking logic. Also update help formatting/text.

Instead of defaulting to `UnlockPolicy::Ask`, the argument becomes
optional. That means if it is specified, the user really wants that
specific policy. Similar to how `passphrase_file` also works.

This also extends `UnlockPolicy` to override `isatty` detection.

Fixes: koverstreet#292
Signed-off-by: Thomas Mühlbacher <[email protected]>
Less repetition and no nested if/else.

Signed-off-by: Thomas Mühlbacher <[email protected]>
This is more similar to the existing C code, which is already in nice
small chunks.

Signed-off-by: Thomas Mühlbacher <[email protected]>
We already can check if an fs is encrypted with `bcachefs unlock -c`.
With this option we can now instead check if we have a key but not
actually mount by not specifying a mount point. e.g.

```sh
if bcachefs mount -k fail "$blkdev"`; then
    echo "device is unlocked!"
fi
```

Not sure what the original intent for this was. For scenarios where
encryption is simply not supported on principle?

Signed-off-by: Thomas Mühlbacher <[email protected]>
@koverstreet koverstreet merged commit 7a17d42 into koverstreet:master Jun 28, 2024
1 check passed
@tmuehlbacher tmuehlbacher deleted the adapt-unlock-policy branch June 28, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants