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 ldap2pg.yml
- role:
    name: ldap_roles
    options: NOLOGIN
- ldap:
    base: ou=people,dc=ldap,dc=ldap2pg,dc=docker
    filter: "(objectClass=organizationalPerson)"
  role:
    name: '{cn}'
    options: LOGIN
    parent: ldap_roles
$ ldap2pg --real
Starting ldap2pg 5.0.
Using .../ldap2pg.yml.
Running in real mode.
Inspecting roles in Postgres cluster...
Querying LDAP ou=people,dc=ldap,dc=lda... (objectClass...
Create domitille.
Update options of albert.
Add missing ldap_roles members.
Delete spurious ldap_roles members.
Reassign oscar objects and purge ACL on postgres.
Reassign oscar objects and purge ACL on template1.
Drop oscar.
Synchronization complete.
$

See versionned ldap2pg.yml and documentation for further options.

Installation

Install it from PyPI tarball:

pip install ldap2pg psycopg2-binary

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! French accepted. 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-5.2.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ldap2pg-5.2-py2.py3-none-any.whl (40.2 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: ldap2pg-5.2.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for ldap2pg-5.2.tar.gz
Algorithm Hash digest
SHA256 2fd76c8d43d67d0456127454ba44174210a2e58d6117211a67bae898c12871ce
MD5 f2885d485add69bcee4c14180fd91989
BLAKE2b-256 d28da037a3ae513ba1edd4c14e32a9ef07797b636e2c9e35112e7cc6f585975e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldap2pg-5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for ldap2pg-5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 80fd9895e61677f1f3d3481e7e97828fc490211213dc18146950bcd4e5b6fdc6
MD5 81c7a8fafe4dda5e95ac16df5ffdaac8
BLAKE2b-256 eec100661bce9723a0779a3936a9f16ba543d5601d2864e603142425af52e162

See more details on using hashes here.

Supported by

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