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

passing args to 'cryptsetup open' #317

Merged

Conversation

somewhere-or-other
Copy link
Contributor

Quick attempt to allow passing of arbitrary args to 'cryptsetup open' when unlocking volume. Related to the discussion here.

@somewhere-or-other
Copy link
Contributor Author

This is just a quick, minimally-tested version, so feel free to give feedback here, if I've made any egregious errors, etc.

@somewhere-or-other somewhere-or-other changed the title passing args to 'crypsetup open' passing args to 'cryptsetup open' Jun 10, 2021
@@ -75,5 +80,5 @@ else
exit 1
fi

echo -n "${pt}" | cryptsetup open -d- "${DEV}" "${NAME}"
echo -n "${pt}" | cryptsetup ${OPENARGS} open -d- "${DEV}" "${NAME}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered putting the new ${OPENARGS} in double-quotes, but was concerned about what would happen if someone wanted to include a space in their parameter string, like passing two different parameters (eg. -a -b, as a contrived example), or a space-separated name/value pair. From my tests, it seemed as though enclosing ${OPENARGS} in double-quotes, made cryptsetup consider it a single parameter that happened to contain spaces.

For my personal use, I only had one parameter to pass, so it would work either way. I just wanted to make a solution for a more general use case.

If there's a better way to handle this, I'm happy to take suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had not considered about the issues when using quotes. So change looks good to me.

Copy link
Contributor Author

@somewhere-or-other somewhere-or-other Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm being honest, I did put it in quotes in a private/dev repo, and discovered the problem, before removing them, and subsequently squashing/rebasing everything into a single pull request.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. In my opinion, it can be merged, but let's wait for @sergio-correia to review it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As additional improvement, it would be nice to add a test to src/luks/tests to simulate a call to clevis-luks-unlock with a cryptsetup option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarroutbi I've just submitted an initial attempt at a test. Basically it just uses a bash function to hijack cryptsetup temporarily, and verifies that the arbitrary value makes it through.

It's very possible I've done something incorrectly, though, so don't just take my word for it. Took me a while to figure out the testing/development environment. And that's why I'm mostly a sysadmin, not a developer.

@sarroutbi sarroutbi requested review from sergio-correia and removed request for sarroutbi June 15, 2021 15:46
@somewhere-or-other
Copy link
Contributor Author

@sergio-correia @sarroutbi Is there anything I can do to shepherd this process along? It's not so urgent that it must happen now or anything. I just wasn't sure what kind of timeframe I could expect something to happen. It's fine if it takes a while, but it would be helpful to know, even roughly, how long it is likely to take.

@sarroutbi
Copy link
Collaborator

sarroutbi commented Jul 9, 2021

@sergio-correia @sarroutbi Is there anything I can do to shepherd this process along? It's not so urgent that it must happen now or anything. I just wasn't sure what kind of timeframe I could expect something to happen. It's fine if it takes a while, but it would be helpful to know, even roughly, how long it is likely to take.

Hello @somewhere-or-other. In my opinion, this could be merged, but I would prefer @sergio-correia to review it. By the way, thank you very much for adding a unit test associated to this new option.

@somewhere-or-other
Copy link
Contributor Author

@sergio-correia, @sarroutbi

I realize it's been a while for this PR, but I'd still love to see it get merged, if possible. We're starting to see more and more use cases for it, via the related ClusterLabs PR. I'm happy to re-work it if there's a problem you can identify.

Copy link
Collaborator

@sarroutbi sarroutbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello. Thanks for your PR. Changes LGTM. However, I miss including the option added to its appropriate manual page.

Could you please document new option in file src/luks/clevis-luks-unlock.1.adoc?

@somewhere-or-other
Copy link
Contributor Author

@sarroutbi You're absolutely right. I totally forgot to do that. Should be there now.

Copy link
Collaborator

@sarroutbi sarroutbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM

@somewhere-or-other
Copy link
Contributor Author

somewhere-or-other commented Jan 27, 2023

I'm reviewing the logs from last night's failed build tests. Given that my test seems to have passed, and another one was the one that failed, this seems like a more general problem, either with the code base, or the testing infrastructure.

If I'm wrong, please let me know, and I'll do my best to fix it.

@sarroutbi
Copy link
Collaborator

I'm reviewing the logs from last night's failed build tests. Given that my test seems to have passed, and another one was the one that failed, this seems like a more general problem, either with the code base, or the testing infrastructure.

If I'm wrong, please let me know, and I'll do my best to fix it.

Let me re-run all the jobs and let's check. I agree this seems more related to testing infrastructure.

@sarroutbi
Copy link
Collaborator

@sergio-correia : please, review when possible. Changes LGTM.

@sergio-correia sergio-correia merged commit 96726a2 into latchset:master Feb 6, 2023
@ElectricFighter ElectricFighter mentioned this pull request Jan 29, 2024
@mvollmer
Copy link
Contributor

mvollmer commented Mar 6, 2024

This is super useful, but I don't see it in any release yet. Is that right?

@mvollmer
Copy link
Contributor

mvollmer commented Mar 6, 2024

@sarroutbi, @sergio-correia, could we get a release with this, please? So that this will eventually end up in distributions.

@sarroutbi
Copy link
Collaborator

Hello @mvollmer . We have some pending PRs that need to be reviewed. Once merged, we will create the new release.

@mvollmer
Copy link
Contributor

mvollmer commented Mar 8, 2024

Hello @mvollmer . We have some pending PRs that need to be reviewed. Once merged, we will create the new release.

Thank you!

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.

4 participants