Generate and grant credentials for MongoDB databases
Project description
Mongogrant is a utility to grant username and password credentials for read and readWrite roles on various databases on various hosts to owners of email addresses.
A server administrator has fine-grained control via allow/deny rules for granting tokens and credentials. People request an email that contains a one-time link. That link gives a user a fetch token. All tokens expire and expiration time is customizable. People then use the mongogrant client to make requests like
from mongogrant.client import Client
# config file on disk has tokens and host/db aliases
# `Client()` with no args looks to
# ~/.mongogrant.json for config
client = Client()
# pymongo.database.Database with read role
source_db = client.db("ro:dev/core")
# readWrite role. config stores "staging" host alias
# and "core" db alias
target_db = client.db("rw:staging/core")
# ...Do database stuff!
You can run a "server" on your laptop in a Jupyer notebook and manage allow/deny rules, grant / revoke grants of credentials, etc. A small Flask app (untested so far) is included as an example for deploying a server to which clients can connect to obtain tokens and credentials.
Set up a server
from mongogrant.config import Config
from mongogrant.server import Server, check, path, seed, Mailgun
server = Server(Config(check=check, path=path, seed=seed()))
server.set_mgdb("mongodb://mgserver:mgserverpass@my.host.com/mongogrant")
server.set_mailer(Mailgun, dict(
api_key="YOUR_KEY",
base_url="https://api.mailgun.net/v3/YOUR_DOMAIN",
from_addr="mongogrant@YOUR_DOMAIN"))
server.set_admin_client(
host="other1.host.com",
username="mongoadmin",
password="mongoadminpass")
server.set_admin_client(
host="other2.host.com",
username="mongoadmin",
password="mongoadminpass")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mongogrant-0.1.9.tar.gz
.
File metadata
- Download URL: mongogrant-0.1.9.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ff22a0a51d041e039c54256d58c5145e5aca49f418ad8b22015b7a30f13fa41 |
|
MD5 | 779773a7e49856916e4af31ddd271edd |
|
BLAKE2b-256 | 66d9180b19c46aca7239e791948445045772d7bc8ff8136df027a37368258e2a |
Provenance
File details
Details for the file mongogrant-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: mongogrant-0.1.9-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57681eb356d8c06578c863346a4a695c7a1eee4d039d1959bf099fb091ecd1e9 |
|
MD5 | 3e13bc22665dd579532687d865060e8a |
|
BLAKE2b-256 | 6067cf776e3d23bdbd12e318954c8dfb4f568a2111135613679ce6aae1931690 |