Django IAM database backends
Usage
pip install django-iam-dbauth
In your settings use the following
DATABASES = {
"default": {
"HOST": "<hostname>",
"USER": "<user>",
"NAME": "<db name>",
"ENGINE": 'django_iam_dbauth.aws.postgresql',
"OPTIONS": {
"use_iam_auth": True,
"sslmode": "require", # See discussion on SSL below
"resolve_cname_enabled": True,
}
}
}
SSL and PostgreSQL
When using IAM authentication with RDS, SSL is required. If it's not used, such as when using a CNAME (see below), login will be denied with the below error:
django.db.utils.OperationalError: FATAL: pg_hba.conf rejects connection for host "1.2.3.4", user "some_user", database "some_database", SSL off
SSL and MySQL
Acquired Token won't work with MySQL if use RDS instance name, which is a CNAME record, as a HOST, because by default it will be resolved to a cannonical name by django-iam-dbauth. As a result the hostname of the token will bi different. To prevent the module from resolving CNAME, set "resolve_cname_enabled" to False.
CNAME considerations
Currently, IAM authentication is not supported with CNAMEs. However, this package does CNAME resolution so that the
signed request for a password will work. The issue with this approach is that from the DB library's point of view, the
connection is initiated to the hostname as defined in the settings. If using SSL, certificate verification will fail.
In this case, for PostgreSQL you may want to set sslmode to require or verify-ca.
Further documentation:
Metadata
Release files for django-iam-dbauth 0.2.1
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 | |
|---|---|---|---|---|
| django_iam_dbauth-0.2.1.tar.gz | 7.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_iam_dbauth-0.2.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / django_iam_dbauth-0.2.1.tar.gz
| Download URL | django_iam_dbauth-0.2.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a33885c81ecdfc8eef22842a56b6a8f545c3c1a1595945ce8e87453697481a62
|
|
BLAKE2b-256 checksum How to use checksums |
f5b5c728057692226236617e53740b7b7660c8bb168e1582eb7ad9a9af387d11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / django_iam_dbauth-0.2.1-py2.py3-none-any.whl
| Download URL | django_iam_dbauth-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c3ea606ce62bf872930af948a59c792c26c6372db61911ad93b0e536009f033d
|
|
BLAKE2b-256 checksum How to use checksums |
70f2ec8f768046939fdd762a92f0efdda79446f7319930e486eed01fff6f6f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for django-iam-dbauth 0.2.1
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.