keyrings.efile
We needed a keyrings implementation that just worked in headless environments. keyrings.efile encrypts passwords using files stored on the local filesystem (/var/tmp/).
It's not secure if an attacker can read all the files, but at least doesn't store the password as plain text.
The current implemetation has the kerying priority set to 20 to take precedence over the Chainer backend. This may change in future releaeses.
Usage
Once installed, the backend is picked up by the standard keyring API:
import keyring
keyring.set_password('mydatabase', 'alice', 'secret')
print(keyring.get_password('mydatabase', 'alice')) # secret
keyring.delete_password('mydatabase', 'alice')
The backend can also be used directly, regardless of which keyring is active:
from keyrings.efile import EncryptedFile
ef = EncryptedFile()
ef.set_password('mydatabase', 'alice', 'secret')
print(ef.get_password('mydatabase', 'alice')) # secret
print(ef.list_entries()) # [('mydatabase', 'alice')]
ef.delete_password('mydatabase', 'alice')
FallbackPasswordHandler returns the stored password, or prompts for one if none is stored. A prompted password is saved only if the with block completes without an exception, so a mistyped password is not remembered:
from keyrings.efile import FallbackPasswordHandler
handler = FallbackPasswordHandler('mydatabase', 'alice')
with handler as password:
connection = connect(user='alice', password=password) # raises on bad password
Call handler.delete_password() to remove a stored password that is no longer valid.
Debug logging is available through the keyrings.efile logger:
import logging
logging.basicConfig()
logging.getLogger('keyrings.efile').setLevel(logging.DEBUG)
Update
Version 2.0 implements delete_password.
Version 3.0 adds FallbackPasswordHandler and logging.
Version 4.0 adds list_entries.
Command line
The keyrings-efile command is provided by the separate
keyrings.efile.cli package, installed with either
pip install keyrings.efile.cli or pip install keyrings.efile[cli]:
keyrings-efile list # list stored services and users
keyrings-efile show SERVICE USER # display password
keyrings-efile delete SERVICE USER # delete entry
Release files for keyrings.efile 4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| keyrings_efile-4.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keyrings_efile-4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / keyrings_efile-4.0.tar.gz
| Download URL | keyrings_efile-4.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
978cd1437f94857d58ddbfe0e9c75644b692fc4993cc1a779a8f887f89c2d647
|
|
BLAKE2b-256 checksum How to use checksums |
23720a0649c0d83e780025ed7438328c8a25453365cecaa52da130457f186e08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / keyrings_efile-4.0-py3-none-any.whl
| Download URL | keyrings_efile-4.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1251c27f594e3b5c561be3c9d0942d27db1409c27547ce4c49a07827c43744f2
|
|
BLAKE2b-256 checksum How to use checksums |
5079a5aacb6f082a044ee652db21401688fd8701a71aa676eaf10ef5b8be4707
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|