-
Notifications
You must be signed in to change notification settings - Fork 17
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
Have a single ActivateVolumeOptions struct for the ActivateVolumeWith* family #116
Conversation
…* funcs Also rename PIN in its definition to UserPassprase to move toward better and also more abstract naming. Same in the corresponding RecoveryKeyUsageReason code. Se also issue #113
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some comment tweaks for further consideration.
r := pinReader | ||
pinReader = nil | ||
r := passphraseReader | ||
passphraseReader = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to renames, is this a precaution that the reader wouldn't be used again by accident?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure what was the original intention here. It's meant to fall back to use systemd-ask-password after consuming one passphrase. But it's very specific behavior that's another reason to have some more control later via the Prompter if needed.
// If the TPM sealed key object has a PIN defined, then this function will use systemd-ask-password to request it. If pinReader is not | ||
// nil, then an attempt to read the PIN from this will be made instead by reading all characters until the first newline. The PINTries | ||
// field of options defines how many attempts should be made to obtain the correct PIN before failing. | ||
// If the TPM sealed key object has a user passphrase/PIN defined, then this function will use systemd-ask-password to request it. If passphraseReader is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a long comment, but I see it's consistent with the rest of the comments in the package. Nevertheless, it does not fit into a file view in a github review page, making it a bit hard to follow. Could we unify the comments style with snapd at some point?
crypt.go
Outdated
// set. With a TPM attempts to unseal with a user passphrase | ||
// will stop if the TPM enters dictionary attack lockout mode | ||
// before this limit is reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// set. With a TPM attempts to unseal with a user passphrase | |
// will stop if the TPM enters dictionary attack lockout mode | |
// before this limit is reached. | |
// set. With a TPM, subsequent attempts to unseal with a user passphrase | |
// will be ceased if the TPM enters dictionary attack lockout mode | |
// before the tries limit is reached. |
crypt.go
Outdated
// will stop if the TPM enters dictionary attack lockout mode | ||
// before this limit is reached. | ||
// It is unused by ActivateWithRecoveryKey. | ||
UserPassphraseTries int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UserPassphraseMaxTries?
// ActivateWithRecoveryKey and when falling in the other | ||
// cases, for example failed TPM unsealing. Setting this to | ||
// zero will disable attempts to activate with the fallback | ||
// recovery key. | ||
RecoveryKeyTries int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RecoveryKeyMaxTries?
crypt.go
Outdated
// with the recovery key if RecoveryKeyTries is greater than | ||
// zero. Setting this to zero disables unsealing with a user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// with the recovery key if RecoveryKeyTries is greater than | |
// zero. Setting this to zero disables unsealing with a user | |
// with the recovery key (see RecoveryKeyTries). | |
// Setting this to zero disables unsealing with a user |
crypt.go
Outdated
// LockSealedKeyAccess controls whether LockAccessToSealedKeys should be called after unsealing the TPM sealed key. It is called if | ||
// this is set to true, and not called if this is set to false. | ||
LockSealedKeyAccess bool | ||
// LockSealedKeys controls whether access to the keys locked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// LockSealedKeys controls whether access to the keys locked | |
// LockSealedKeys controls whether access to the keys is locked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some suggestions/wonderings that are pretty nitpicky /o, but otherwise lgtm
crypt.go
Outdated
// set. With a TPM attempts to unseal with a user passphrase | ||
// will stop if the TPM enters dictionary attack lockout mode | ||
// before this limit is reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// set. With a TPM attempts to unseal with a user passphrase | |
// will stop if the TPM enters dictionary attack lockout mode | |
// before this limit is reached. | |
// set. With a TPM, attempts to unseal will stop if the TPM enters | |
// dictionary attack lockout mode before this limit is reached. |
crypt.go
Outdated
// attempted. It is considered directly by | ||
// ActivateWithRecoveryKey and when falling in the other | ||
// cases, for example failed TPM unsealing. Setting this to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// attempted. It is considered directly by | |
// ActivateWithRecoveryKey and when falling in the other | |
// cases, for example failed TPM unsealing. Setting this to | |
// attempted. It is used to directly with | |
// ActivateWithRecoveryKey and indirectly with other | |
// methods upon failure, for example failed TPM | |
// unsealing. Setting this to |
RecoveryKeyTries int | ||
|
||
// ActivateOptions provides a mechanism to pass additional options to systemd-cryptsetup. | ||
// ActivateOptions provides a mechanism to pass additional | ||
// options to systemd-cryptsetup. | ||
ActivateOptions []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActivateOptions []string | |
AdditionalActivateOptions []string |
or maybe
ActivateOptions []string | |
AdditionalActivationOptions []string |
or maybe even
ActivateOptions []string | |
AdditionalSystemdCryptSetupActivationOptions []string |
(I'm not familiar enough with the pkg to know how specific we ought to be about using systemd-cryptsetup references)
crypt.go
Outdated
// after unsealing. That means calling LockAccessToSealedKeys | ||
// in TPM case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// after unsealing. That means calling LockAccessToSealedKeys | |
// in TPM case. | |
// after unsealing by calling LockAccessToSealedKeys in the TPM case | |
// for example |
UserPassphrase is fairly long and it's unclear whether it always be strictly from a user thanks @bboozzoo, @anonymouse64
3fe87bd
to
8995bba
Compare
Also rename PIN in its definition to Passphrase to move toward
better and also more abstract naming.
Same in the corresponding RecoveryKeyUsageReason code.
See also issue #113