Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/utils/keys/hardwarekey/cliprompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (c *cliPrompt) Touch(_ context.Context, keyInfo ContextualKeyInfo) error {
// If an invalid PIN or PUK is provided, the user will be re-prompted until a
// valid value is provided.
func (c *cliPrompt) ChangePIN(ctx context.Context, _ ContextualKeyInfo) (*PINAndPUK, error) {
fmt.Fprintf(os.Stderr, "The default PIN %q is not supported.\n", DefaultPIN)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're already showing the same message on line 116. Maybe it’s enough to display it only when the user actually enters the default PIN?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It sort of works as a warning against picking the default PIN, doesn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think the following flow would be bad UX:

Enter your YubiKey PIV PIN [blank to use default]:
// 123456
Please set a new 6-8 character PIN.
// 123456
The default PIN 123456 is not supported.


var pinAndPUK = &PINAndPUK{}
for {
fmt.Fprintf(c.writer, "Please set a new 6-8 character PIN.\n")
Expand Down
6 changes: 1 addition & 5 deletions api/utils/keys/piv/yubikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"fmt"
"io"
"math/big"
"os"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -474,10 +473,7 @@ func (y *YubiKey) checkOrSetPIN(ctx context.Context, prompt hardwarekey.Prompt,
}

switch pin {
case piv.DefaultPIN:
fmt.Fprintf(os.Stderr, "The default PIN %q is not supported.\n", piv.DefaultPIN)
fallthrough
case "":
case piv.DefaultPIN, "":
pin, err = y.setPINAndPUKFromDefault(ctx, prompt, keyInfo)
if err != nil {
return trace.Wrap(err)
Expand Down
Loading