Skip to content

Allows to fully disable using the system keychain. #898

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

Merged
merged 12 commits into from
Mar 1, 2021

Conversation

m3nu
Copy link
Contributor

@m3nu m3nu commented Feb 27, 2021

This PR tries to avoid common issues with system keychains that were reported:

  • Add option to avoid using system keychain.
  • Prioritize keychains first. Then try to start them.
  • Maintenance: Possible fixes for hung tests and segfault on exit on some setups.

To test:

$ pip install --force-reinstall git+https://github.com/m3nu/vorta.git@issue/make-keyring-optional

In Misc tab disable the setting "Store repository passwords in system keychain...". After that all repo passwords will be stored with Vorta only, independent of the system keychain.

Screen Shot 2021-02-27 at 10 58 39

@m3nu
Copy link
Contributor Author

m3nu commented Feb 27, 2021

@samuel-w . This allows disabling keychains due to the many issues we have with them and some users don't want to use them at all.

@samuel-w
Copy link
Contributor

This feels like a workaround to the buggy code, and not an actual fix. I'll just remove kwallet.

@m3nu
Copy link
Contributor Author

m3nu commented Feb 27, 2021

Not really. People have actually asked to provide this option. Even myself, I don't really use the macOS keychain and back it up. And on Linux often a keychain is installed, but people don't use it.

@m3nu m3nu force-pushed the issue/make-keyring-optional branch from 703174a to 0d95296 Compare February 27, 2021 13:30
@m3nu m3nu force-pushed the issue/make-keyring-optional branch 2 times, most recently from 5866438 to 3ff85aa Compare February 27, 2021 14:34
@m3nu m3nu force-pushed the issue/make-keyring-optional branch from 3ff85aa to 8efa560 Compare February 27, 2021 14:56
@m3nu m3nu mentioned this pull request Feb 27, 2021
@@ -344,7 +344,7 @@ def display_password_backend(encryption):
# flake8: noqa E501
if encryption != 'none':
keyring = VortaKeyring.get_keyring()
return trans_late('utils', "Storing the password in your password manager.") if keyring.is_primary else trans_late(
return trans_late('utils', "Storing the password in your password manager.") if keyring.is_system else trans_late(
Copy link
Contributor

@samuel-w samuel-w Feb 27, 2021

Choose a reason for hiding this comment

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

    keyring = VortaKeyring.get_keyring()
    if not (encryption == 'none' or keyring.is_system):
        return trans_late('utils', "Storing the password in your password manager.") if keyring.is_primary else trans_late(
            'utils', 'Saving the password to disk. To store password more securely install a supported secret store such as KeepassXC')
    else:
        return ""

Otherwise it always shows as using password manager when system keychain disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. Will change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks convoluted. Moved this to the view where it's actually used. We have too many circular imports already.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't move the backend, I'm reusing it in key management. Utils prevents circular imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but I didn't see any other uses of display_password_backend(). Which file do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a pull request.

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 see. Which one? Duplicating a few lines isn't an issue.

Next task I want to do is to make imports more hierachical. Many imports are only possible within functions because everything imports from everywhere. So e.g. I don't want models or utils to import too much. They should be at the bottom.

I may have fixed the "hanger" during macOS testing as well. According to the debugger it was stuck waiting for the BorgThread mutex. So I tried a few things there, like using the native Python mutex, which has a nicer API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never mind. Found display_password_backend() in your PR. Will try to put that function into the keyring class instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to VortaKeyring().get_backend_warning()

@samuel-w
Copy link
Contributor

We should break up the settings into subcategories, its getting long.

@m3nu m3nu force-pushed the issue/make-keyring-optional branch 6 times, most recently from e19ea28 to 60417fe Compare February 28, 2021 08:55
@m3nu
Copy link
Contributor Author

m3nu commented Feb 28, 2021

You notice any other issues? Else I merge it tomorrow to encourage some testing in the master branch.

Also one more request to select the keychain. So giving the option to turn it off is probably just a first step.

@m3nu
Copy link
Contributor Author

m3nu commented Feb 28, 2021

I also put back Coverage for macOS, since it didn't make a difference after all. 😅

@m3nu
Copy link
Contributor Author

m3nu commented Feb 28, 2021

@samuel-w , we now use KWallet only if it's KDE. There were too many reports where people had it installed, but didn't use it. python-keyring has roughly the same rule.

Would appreciate your feedback.

@borgbase borgbase deleted a comment from codecov-io Feb 28, 2021
@borgbase borgbase deleted a comment from codecov-io Mar 1, 2021
@m3nu
Copy link
Contributor Author

m3nu commented Mar 1, 2021

Did a larger rewrite on how keyrings are selected. This avoids the chaotic if-else and just assigns a priority within each keyring. @samuel-w

@m3nu m3nu merged commit 6d8ad90 into borgbase:master Mar 1, 2021
@m3nu m3nu deleted the issue/make-keyring-optional branch March 1, 2021 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants