{"id":16421814,"url":"https://github.com/peppelinux/django-slapd-sql","last_synced_at":"2025-02-24T17:43:40.751Z","repository":{"id":143289807,"uuid":"112962682","full_name":"peppelinux/django-slapd-sql","owner":"peppelinux","description":"Django slapd-sql management interface","archived":false,"fork":false,"pushed_at":"2020-10-17T00:34:56.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-07T07:44:46.706Z","etag":null,"topics":["django","ldap","openldap","slapd","slapd-sql","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peppelinux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-03T20:50:30.000Z","updated_at":"2024-09-30T12:09:57.000Z","dependencies_parsed_at":"2023-05-11T04:15:27.208Z","dependency_job_id":null,"html_url":"https://github.com/peppelinux/django-slapd-sql","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.16216216216216217","last_synced_commit":"10594e9246579c99f6f79462c2c542ff944f2327"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2Fdjango-slapd-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2Fdjango-slapd-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2Fdjango-slapd-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peppelinux%2Fdjango-slapd-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peppelinux","download_url":"https://codeload.github.com/peppelinux/django-slapd-sql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240526462,"owners_count":19815673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["django","ldap","openldap","slapd","slapd-sql","sql"],"created_at":"2024-10-11T07:34:53.029Z","updated_at":"2025-02-24T17:43:40.743Z","avatar_url":"https://github.com/peppelinux.png","language":"Python","readme":"Django-slapd-sql\n----------------\nDjango-slapd-sql aim to provide a management interface to [OpenLDAP with SQL storage backend](https://www.openldap.org/faq/data/cache/978.html).\nslapd-sql will present informations stored in a RDBMS as a LDAP subtree, according to the mapped attributes configured via Django Admin. \n\nIt aim to:\n\n- Get a working OpenLDAP server with:\n    - adeguate security by default (SASL/TLS and ACL);\n    - memberof and ppolicy overlays configured for identity management case of use;\n    - SQL storage backend configured for MariaDB (adaptable for PostgreSQL) instead of MDB, HDB or BDB;\n- Get a Django Admin backend to map LDAP and SQL schemas and attributes using also Django Generic Relations;\n- Manage the same data using http://, https://, ldaps:// without any replica or scheduled syncronization;\n- Permit us to query data stored in a legacy RDBMS through LDAP (slapd-sql) and viceversa (Django views);\n\nOpenLDAP will read and NOT write on SQL (in this implementation).\n\n\nSlapd-sql\n---------\nSlapd-sql is not a \"standard\" OpenLDAP backend like MDB, BDB or HDB, it can be used when you have account informations in a RDBMS, all the informations or just some of them, and you want to get these through LDAP protocol. In a OpenLDAP server many data sources can be configured to work together at the same time, SQL is one of these. SQL backend is designed to be tunable to virtually any relational schemas without having to change source (through meta-information). It also uses ODBC to connect to RDBMSes and is highly configurable for the SQL dialects that RDBMSes may use, indeed it may be used for integration and distribution of data on different RDBMSes, OSes, hosts etc., in other words, in a high heterogeneous environment.\n\nOther tools related to OpenLDAP \n-------------------------------\nOpenLDAP setup can also be provided by another ansible-application:\n- https://github.com/peppelinux/ansible-slapd-eduperson2016\n\nThis is a Django Admin manager for a OpenLDAP previously configured with the previous ansible-playbook:\n- https://github.com/peppelinux/django-ldap-academia-ou-manager\n\nDjango database Setup\n---------------------\n\nInstall the server\n````\napt install mariadb-server\n````\n\nCreate the Database\n````\nexport DJANGO_SETTINGS_MODULE='example.settings'\nexport USER=$(python -c \"from django.conf import settings; print(settings.DATABASES['default']['USER'])\")\nexport PASS=$(python -c \"from django.conf import settings; print(settings.DATABASES['default']['PASSWORD'])\")\nexport DB=$(python -c \"from django.conf import settings; print(settings.DATABASES['default']['NAME'])\")\n\n# create your MariaDB\nexport HOST='%'\n\n# tested on Debian 10\nsudo mysql -u root -e \"\\\nCREATE USER IF NOT EXISTS '${USER}'@'${HOST}' IDENTIFIED BY '${PASS}';\\\nCREATE DATABASE IF NOT EXISTS ${DB} CHARACTER SET = 'utf8' COLLATE = 'utf8_general_ci';\\\nGRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'${HOST}';\"\n````\n\nDjango stuffs\n````\n./manage.py migrate\n./manage.py createsuperuser\n./manage.py runserver\n\n````\n\nConfigure ODBC\n--------------\nThanks to [sleeplessbeastie](https://blog.sleeplessbeastie.eu/2018/01/08/how-to-install-and-configure-mariadb-unixodbc-driver/)\n\nInstall it\n````\napt install unixodbc unixodbc-dev odbcinst\n````\n\nCompile MariaDB ODBC Connector\n````\napt install git cmake build-essential libssl-dev\ncd mariadb-connector-c\n\n# create a makefile, compile and install\ncmake -G \"Unix Makefiles\" -DCMAKE_INSTALL_PREFIX=/usr/local -LH\nmake -j 2\nmake install\n\n# install ODBC\ncd ..\ngit clone https://github.com/MariaDB/mariadb-connector-odbc.git\ncd mariadb-connector-odbc\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DWITH_OPENSSL=true -DCMAKE_INSTALL_PREFIX=/usr/local -LH\nmake -j 2\nmake install\n\ncat \u003c\u003c EOF | sudo /etc/odbcinst.ini\n[MariaDB]\nDriver      = libmaodbc.so\nDescription = MariaDB ODBC Connector\nEOF\n\ncat \u003c\u003c EOF | tee /etc/odbc.ini\n[slapd]\nDescription         = MariaDB slapd\nDriver              = MariaDB\nDatabase            = slapd\nServer              = 127.0.0.1\nUid                 = slapd\nPassword            = slapdsecret\nPort                = 3306\nEOF\n````\n\nODBC tests\n----------\n\n````\nisql -v slapd\necho \"show tables\" | iusql slapd -b\n````\n\nSQL as Database backend\n-----------------------\nslapd-config sql attributes:\nhttps://github.com/openldap/openldap/blob/master/servers/slapd/back-sql/config.c#L74\n\n\n- enable slapd-sql module\n````\n\n````\n\n- create an ldif to ldapadd, eg:\n````\nldapadd -Y EXTERNAL -H ldapi:/// \u003c\u003c EOF\ndn: cn=module,cn=config\ncn: module\nobjectClass: olcModuleList\nolcModuleLoad: back_sql\nolcModulePath: /usr/lib/ldap\n\nEOF\n````\n````\n\nldapadd -Y EXTERNAL -H ldapi:/// \u003c\u003c EOF\ndn: olcDatabase=sql,cn=config\nobjectClass: olcDatabaseConfig\nobjectClass: olcSqlConfig\nolcSuffix: dc=mariadb\nolcDbName: slapd\nolcDbUser: slapd\nolcDbPass: slapdsecret\nolcDbHost: \"127.0.0.1\"\nolcSqlSubtreeCond: \"ldap_entries.dn LIKE CONCAT('%',?)\"\nolcSqlInsEntryStmt: \"INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) VALUES (?,?,?,?)\"\nEOF\n\nolcSqlHasLDAPinfoDnRu: no\nEOF\n````\n[TODO]\n- create some conditionals in slapd role to manage this feature\n\nOther good features, integrations and improvements\n--------------------------------------------------\n\n- syncrepl: https://github.com/akkornel/syncrepl\n- MariaDB example schemas: https://www.openldap.org/devel/cvsweb.cgi/servers/slapd/back-sql/rdbms_depend/mysql/\n\nResources\n---------\n- https://linux.die.net/man/5/slapd-sql\n- http://www.openldap.org/faq/data/cache/378.html\n- https://tylersguides.com/guides/openldap-online-configuration-reference/\n- https://www.easysoft.com/applications/openldap/back-sql-odbc.html\n- https://github.com/openldap/openldap/tree/master/servers/slapd/back-sql/rdbms_depend/mysql\n- https://github.com/openldap/openldap/blob/b06f5b0493937fc28f2cc86df1d7f464aa4504d8/servers/slapd/back-sql/config.c#L225\n- https://www.darold.net/projects/ldap_pg/HOWTO/x178.html\n- http://www.flatmtn.com/article/setting-ldap-back-sql.html\n- https://www.openldap.org/lists/openldap-technical/201704/msg00016.html\n- https://serverfault.com/questions/614955/openldap-with-mysql-works-but-need-schema-advice\n- http://blog.mikotek.com.tw/2014/05/31/openldap-with-microsoft-sql-server-backend-database-on-centos/\n\n- https://gist.github.com/mahirrudin/9b7754e54f1e8e532049484864beba42\n\nOther interesting and related stuffs:\n- https://github.com/openstack/ldappool (LDAP pools for foreign connections)\n\nNBD Resources\n-------------\n\n- https://www.yumpu.com/en/document/read/35014167/openldap-and-mysql-bridging-the-data-model-divide-ukuug\n- https://linux.die.net/man/5/slapd-ndb\n- https://mysqlhighavailability.com/accessing-the-same-data-through-ldap-and-sql/\n\n\nOthers\n------\n- https://lsc-project.org\n\nStatus\n------\nStill in huge development, see you soon :)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeppelinux%2Fdjango-slapd-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeppelinux%2Fdjango-slapd-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeppelinux%2Fdjango-slapd-sql/lists"}