{"id":32962945,"url":"https://github.com/canonical/postgresql-ldap-sync","last_synced_at":"2026-01-14T09:32:59.350Z","repository":{"id":276273128,"uuid":"917055934","full_name":"canonical/postgresql-ldap-sync","owner":"canonical","description":"Package to sync LDAP users with PG","archived":false,"fork":false,"pushed_at":"2025-11-12T13:47:21.000Z","size":55,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-11-12T14:30:40.759Z","etag":null,"topics":["data-platform","postgresql"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/postgresql-ldap-sync","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canonical.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-15T09:15:38.000Z","updated_at":"2025-11-12T13:46:33.000Z","dependencies_parsed_at":"2025-02-07T09:22:13.606Z","dependency_job_id":"53e079e7-9b19-4fea-9d06-43359ad9b1a2","html_url":"https://github.com/canonical/postgresql-ldap-sync","commit_stats":null,"previous_names":["canonical/postgresql-ldap-sync"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/canonical/postgresql-ldap-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fpostgresql-ldap-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fpostgresql-ldap-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fpostgresql-ldap-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fpostgresql-ldap-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canonical","download_url":"https://codeload.github.com/canonical/postgresql-ldap-sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fpostgresql-ldap-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-platform","postgresql"],"created_at":"2025-11-13T01:00:33.387Z","updated_at":"2026-01-14T09:32:59.345Z","avatar_url":"https://github.com/canonical.png","language":"Python","readme":"# PostgreSQL-LDAP Sync\n\n[![CI/CD Status][ci-status-badge]][ci-status-link]\n[![Coverage Status][cov-status-badge]][cov-status-link]\n[![Apache license][apache-license-badge]][apache-license-link]\n\nLDAP is often used for a centralized user and role management in an enterprise environment.\nPostgreSQL offers LDAP as one of its authentication methods, but the users must already exist in the database,\nbefore the authentication can be used. There is currently no direct authorization of database users on LDAP,\nso roles and memberships have to be administered twice.\n\nThis program helps to solve the issue by synchronizing users, groups and their memberships from LDAP to PostgreSQL,\nwhere access to LDAP is read-only.\n\nIt is meant to run as a cron job.\n\n\n## 🧑‍💻 Usage\n\n1. Install the package from PyPi:\n   ```shell\n   pip install postgresql-ldap-sync\n   ```\n\n2. Import and build the Synchronizer object:\n   ```python\n   from postgresql_ldap_sync.clients import DefaultPostgresClient\n   from postgresql_ldap_sync.clients import GLAuthClient\n   from postgresql_ldap_sync.matcher import DefaultMatcher\n   from postgresql_ldap_sync.syncher import Synchronizer\n\n   ldap_client = GLAuthClient(...)\n   psql_client = DefaultPostgresClient(...)\n   matcher = DefaultMatcher(...)\n\n   syncher = Synchronizer(\n       ldap_client=ldap_client,\n       psql_client=psql_client,\n       entity_matcher=matcher,\n   )\n   ```\n\n3. Define the actions the synchronizer is allowed to take:\n   ```python\n   user_actions = [\"CREATE\", \"KEEP\"]\n   group_actions = [\"CREATE\", \"KEEP\"]\n   member_actions = [\"GRANT\", \"REVOKE\", \"KEEP\"]\n   ```\n\n4. Run the synchronizer, as a cron-job:\n   ```python\n   import time\n\n   while True:\n       syncher.sync_users(user_actions)\n       syncher.sync_groups(group_actions)\n       syncher.sync_group_memberships(member_actions)\n       time.sleep(30)\n   ```\n\n\n## 🔧 Development\n\n### Dependencies\nIn order to install all the development packages:\n\n```shell\npoetry install --all-extras\n```\n\n### Linting\nAll Python files are linted using [Ruff][docs-ruff], to run it:\n\n```shell\ntox -e lint\n```\n\n### Testing\nProject testing is performed using [Pytest][docs-pytest], to run them:\n\n```shell\ntox -e unit\n```\n\n```shell\nexport GLAUTH_USERNAME=\"...\"\nexport GLAUTH_PASSWORD=\"...\"\nexport POSTGRES_DATABASE=\"...\"\nexport POSTGRES_USERNAME=\"...\"\nexport POSTGRES_PASSWORD=\"...\"\n\npodman-compose -f compose.yaml up --detach \u0026\u0026 tox -e integration\npodman-compose -f compose.yaml down\n```\n\n### Release\nCommits can be tagged to create releases of the package, in order to do so:\n\n1. Bump up the version within the `pyproject.toml` file.\n2. Add a new section to the `CHANGELOG.md`.\n3. Commit + push the changes.\n4. Trigger the [release workflow][github-workflows].\n\n\n## 🧡 Acknowledges\n\nThis project is a Python port of the popular [pg-ldap-sync][github-pg-ldap-sync] Ruby project.\n\n\n[apache-license-badge]: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n[apache-license-link]: https://github.com/canonical/postgresql-ldap-sync/blob/main/LICENSE\n[ci-status-badge]: https://github.com/canonical/postgresql-ldap-sync/actions/workflows/ci.yaml/badge.svg?branch=main\n[ci-status-link]: https://github.com/canonical/postgresql-ldap-sync/actions/workflows/ci.yaml?query=branch%3Amain\n[cov-status-badge]: https://codecov.io/gh/canonical/postgresql-ldap-sync/branch/main/graph/badge.svg\n[cov-status-link]: https://codecov.io/gh/canonical/postgresql-ldap-sync\n\n[docs-pytest]: https://docs.pytest.org/en/latest/#\n[docs-ruff]: https://docs.astral.sh/ruff/\n[github-pg-ldap-sync]: https://github.com/larskanis/pg-ldap-sync\n[github-workflows]: https://github.com/canonical/postgresql-ldap-sync/actions/workflows/release.yaml\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanonical%2Fpostgresql-ldap-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanonical%2Fpostgresql-ldap-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanonical%2Fpostgresql-ldap-sync/lists"}