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

How to use this to read/write passwords? #23

Closed
rayluo opened this issue Mar 29, 2020 · 1 comment
Closed

How to use this to read/write passwords? #23

rayluo opened this issue Mar 29, 2020 · 1 comment

Comments

@rayluo
Copy link

rayluo commented Mar 29, 2020

This is a high level question and hope to hear wisdom from Dmitry or community.

Background: My use case is to read/write password on Linux. And I have been able to successfully read/write password, using libsecret, with the help of PyGObject, following this set of examples there. It works but the installation of PyGObject has dependency on graphic library pycairo which I would like to avoid, if at all possible.

SecretStorage has cleaner dependency, however my first attempt failed because DBUS_SESSION_BUS_ADDRESS was not defined. After my tentatively defining it to match a dbus socket in my Debian desktop, DBUS_SESSION_BUS_ADDRESS=unix:abstract=/var/run/dbus/system_bus_socket (but I omit the guid suffix because I don't know where to find it), it raises another exception:

Traceback (most recent call last):
  File "/home/demo/Live-usb-storage/env37/lib/python3.7/site-packages/secretstorage/__init__.py", line 69, in dbus_init
    connection = connect_and_authenticate()
  File "/home/demo/Live-usb-storage/env37/lib/python3.7/site-packages/jeepney/integrate/blocking.py", line 115, in connect_and_authenticate
    sock.connect(bus_addr)
ConnectionRefusedError: [Errno 111] Connection refused

Before I dig deeper, I would appreciate some high level guidance here.

In other words, what solution would give a reasonably-well password encryption on Linux, and with minimal dependency?

@mitya57
Copy link
Owner

mitya57 commented Apr 9, 2020

Hi! Let me try to summarize the situation:

  • SecretStorage is quite a low-level library. It allows you to communicate with the daemon (e.g. gnome-keyring) which actually stores the passwords for you. It requires D-Bus, and it requires a daemon that implements the Secret Service protocol.
  • Python-Keyring is a higher level library. It supports multiple backends. For example, it can use SecretStorage on GNOME, KWallet on KDE, native backends on Windows and macOS, and an encrypted file on other systems. If you want your application to support many platforms, I recommend using Python-Keyring.
  • You can use both SecretStorage and Python-Keyring on headless systems, see this instruction.
  • libsecret was originally like SecretStorage — a wrapper around the Secret Service protocol. However, if I understand correctly, now it can store passwords itself, without relying on a daemon. Maybe we should add a libsecret backend to python-keyring.

Also, the latest versions of SecretStorage do not use PyGObject. The only dependencies are cryptography and jeepney.

@mitya57 mitya57 closed this as completed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants