Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongogrant-0.1.7.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

mongogrant-0.1.7-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file mongogrant-0.1.7.tar.gz.

File metadata

  • Download URL: mongogrant-0.1.7.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mongogrant-0.1.7.tar.gz
Algorithm Hash digest
SHA256 06a9bbd61a20c4265a8a4cb67043a7dc05670d86d6c977f43e164ae1399715b9
MD5 cec67ff02fd8ad26fb524a010c6bdfc2
BLAKE2b-256 f64a6ff64135d0eefeb2016ccdd4452a50f4f9ba69f33b44f948048579a7414e

See more details on using hashes here.

Provenance

File details

Details for the file mongogrant-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for mongogrant-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b42f5dfe6eec7057e90bc00e5e58ace0fcb044de640f901b3a49ad24146c7ddd
MD5 7cd5b6302bb6e849db1eea134e5e81e5
BLAKE2b-256 54de00f291165f85a23663ff80270ad9fe084bd36dcbd5c9f1f3c546b13aa7e1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page