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

Unable to open file at keyfile (mode 400) for sudo -i root #35

Closed
ZenithalHourlyRate opened this issue Jan 17, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@ZenithalHourlyRate
Copy link
Contributor

Describe the bug

For root with sudo -i, with keyfile at mode 400, khefin can not read the keyfile, also this root can not enrol a key

To Reproduce
Steps to reproduce the first behavior:

  1. sudo -i
  2. Generate a keyfile or use an old keyfile
  3. chown root:root keyfile
  4. chmod 400 keyfile
  5. khefin generate -f keyfile
  6. Type in correct passphrase
  7. See error khefin: Unable to open file at keyfile

Steps to reproduce the second behavior:

  1. sudo -i
  2. khefin enrol -d /dev/hidraw0 -f keyfile
  3. Type passphrase
  4. See error khefin: Unable to open file at keyfile

Expected behavior
Open the keyfile

Environment:

  • Operating system: Arch Linux
  • Version: 0.6.0
  • Authenticator make and model: Canokeys CanoKey

Additional context

  • For normal user, the above commands can not reproduce this bug.
  • For su - root, the above commands can not reproduce this bug.
@mjec
Copy link
Owner

mjec commented Jan 17, 2021

Thanks for the report! This is because khefin drops privileges, for reasons which are no longer relevant. I have a fix for this that will form part of version 0.6.1, landing in the next couple of hours.

@mjec mjec self-assigned this Jan 17, 2021
@mjec mjec added the bug Something isn't working label Jan 17, 2021
@mjec mjec closed this as completed in 470e38c Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants