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.
Version 4.1 adds uses system firmware information when encrypting passwords as root.
Version 4.2 makes writes atomic and adds logging.
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
Metadata
Release files for keyrings.efile 4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keyrings_efile-4.2.tar.gz | 8.5 kB | Without provenance | Details for keyrings_efile-4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keyrings_efile-4.2-py3-none-any.whl | Python 3 | none | any | Details for keyrings_efile-4.2-py3-none-any.whl |
Total release size: 16.7 kB
Release files / keyrings_efile-4.2.tar.gz
| Download URL | keyrings_efile-4.2.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
432753e32dd736e17cc7ad395d594016e71e8049ac38c7f63d5ff05c529d25c5
|
|
BLAKE2b-256 checksum How to use checksums |
b059ad850566d579a9af1f7b8707158a791f65cb7aa0d10dc60b4a0cabaa5c75
|
| 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.2-py3-none-any.whl
| Download URL | keyrings_efile-4.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08797c38b2ec2fcb8442710f069f06c158c6736490de8e539a85bff55ff65487
|
|
BLAKE2b-256 checksum How to use checksums |
fac56bbfcf820e146eaf53f57668e8179fb4d9d3557bd62063510ecc482a1add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for keyrings.efile 4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.