Skip to main content

Manage PostgreSQL roles and privileges from YAML or LDAP

Project description

ldap2pg: PostgreSQL role and privileges management

Continuous Integration report Code coverage report Documentation Version on PyPI Docker Image Available

Swiss-army knife to synchronize Postgres roles and privileges from YAML or LDAP.

Features

  • Creates, alters and drops PostgreSQL roles from LDAP queries.

  • Creates static roles from YAML to complete LDAP entries.

  • Manages role members (alias groups).

  • Grants or revokes privileges statically or from LDAP entries.

  • Dry run.

  • Logs LDAP queries as ldapsearch commands.

  • Logs every SQL query.

  • Reads settings from an expressive YAML config file.

Here is a sample configuration and execution:

$ cat docs/ldap2pg.minimal.yml
- role:
    name: ldap_roles
    options: NOLOGIN
- ldap:
    base: ou=people,dc=ldap,dc=ldap2pg,dc=docker
    filter: "(objectClass=organizationalRole)"
  role:
    name: '{cn}'
    options: LOGIN
    parent: ldap_roles
$ ldap2pg --config docs/ldap2pg.minimal.yml --real
Starting ldap2pg 4.9.
Using .../docs/ldap2pg.minimal.yml.
Running in real mode.
Inspecting roles in Postgres cluster...
Querying LDAP ou=people,dc=ldap,dc=lda... (objectClass...
Create albert.
Create alter.
Create didier.
Create dorothée.
Create ldap_roles.
Update options of alan.
Update options of alice.
Add missing ldap_roles members.
Delete spurious ldap_roles members.
Reassign oscar objects and purge ACL on appdb.
Reassign oscar objects and purge ACL on olddb.
Drop oscar.
Synchronization complete.
$

See versionned ldap2pg.yml and documentation for further options.

Installation

Install it from PyPI tarball:

pip install ldap2pg

More details can be found in documentation.

ldap2pg is licensed under PostgreSQL license. ldap2pg is available with the help of wonderful people, jump to contributors list to see them.

Support

If you need support and you didn’t found it in documentation, just drop a question in a GitHub issue! Don’t miss the cookbook. You’re welcome!

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

ldap2pg-4.18.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

ldap2pg-4.18-py2.py3-none-any.whl (35.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ldap2pg-4.18.tar.gz.

File metadata

  • Download URL: ldap2pg-4.18.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for ldap2pg-4.18.tar.gz
Algorithm Hash digest
SHA256 8d9304540881ce8577710d33341e30e4a36d466f5168f7d74f2caf4d0353256b
MD5 8d237a538378816c81dc108b5e1e1ef4
BLAKE2b-256 5382f469612959d9b220b6f183fff32bfbaa3a336ca4b0f13ec282d1b3222527

See more details on using hashes here.

Provenance

File details

Details for the file ldap2pg-4.18-py2.py3-none-any.whl.

File metadata

  • Download URL: ldap2pg-4.18-py2.py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for ldap2pg-4.18-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7a792969bb276407e2105c8224cca88d18edb4f335be2a2caa3871716a13c7b6
MD5 b2dfb2c4a10f66a94fc36b930431f889
BLAKE2b-256 f82be234038b58f870d9ac659213bd2e1762fe642f65c4eac8f5b6699269adbb

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