Skip to content

Commit

Permalink
Merge pull request #90 from str4d/21-mgmkey-advice
Browse files Browse the repository at this point in the history
Give guidance on reconfiguring YubiKeys with unprotected management keys
  • Loading branch information
str4d authored Dec 30, 2022
2 parents 492612f + e4ef700 commit 0eee944
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion i18n/en-US/age_plugin_yubikey.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,14 @@ plugin-err-pin-required = A PIN is required for {-yubikey} with serial {$yub
## Errors

err-custom-mgmt-key = Custom unprotected management keys are not supported.
err-custom-mgmt-key = Custom unprotected management keys are not supported.
rec-custom-mgmt-key =
You can use the {-yubikey} Manager CLI to change to a protected management key:
{" "}{$cmd}
See here for more information about {-yubikey} Manager:
{" "}{$url}
err-invalid-flag-command = Flag '{$flag}' cannot be used with '{$command}'.
err-invalid-flag-tui = Flag '{$flag}' cannot be used with the interactive interface.
err-invalid-pin-length = The PIN needs to be 1-8 characters.
Expand Down
16 changes: 15 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,21 @@ impl From<yubikey::Error> for Error {
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::CustomManagementKey => wlnfl!(f, "err-custom-mgmt-key")?,
Error::CustomManagementKey => {
wlnfl!(f, "err-custom-mgmt-key")?;
let cmd = "ykman piv access change-management-key --protect";
let url = "https://developers.yubico.com/yubikey-manager/";
writeln!(
f,
"{}",
fl!(
crate::LANGUAGE_LOADER,
"rec-custom-mgmt-key",
cmd = cmd,
url = url,
),
)?;
}
Error::InvalidFlagCommand(flag, command) => writeln!(
f,
"{}",
Expand Down

0 comments on commit 0eee944

Please sign in to comment.