go-ldap / ldap

Basic LDAP v3 functionality for the GO programming language.
Other
2.25k stars 355 forks source link

About implementing syncrepl (rfc-4533) consumer #422

Closed t2y closed 1 year ago

t2y commented 1 year ago

I am new to OpenLDAP. Recently, I started developing a module connected with the OpenLDAP server using go-ldap. Go-ldap really helps me. Thanks a lot.

I'm interested in syncrepl for LDAP Sync Replication. It is my understanding that syncrepl has 2 components, provider and consumer. I think the provider is an OpenLDAP server (maybe slapd). To use syncrepl in Go, I have to implement a consumer module. Does go-ldap have a plan to provide some functions related to syncrepl? I could not find resources about it.

Reference

vetinari commented 1 year ago

This requires https://github.com/go-ldap/ldap/pull/319 to be merged first.

t2y commented 1 year ago

@vetinari #440 (provides #319 feature) was merged. To implement syncrepl consumer, would you happen to have a plan or design? I am new to LDAP protocol, so any advice is welcome.

t2y commented 1 year ago

I'm investigating. To provide syncrepl feature, I have to implement Controls as below.

1.3.6.1.4.1.4203.1.9.1.1    LDAP Content Synchronization Request Control    RFC 4533
1.3.6.1.4.1.4203.1.9.1.2    LDAP Content Synchronization State Control  RFC 4533
1.3.6.1.4.1.4203.1.9.1.3    LDAP Content Synchronization Done Control   RFC 4533
1.3.6.1.4.1.4203.1.9.1.4    LDAP Content Synchronization Info Intermediate Response RFC 4533

https://ldap.com/ldap-oid-reference-guide/

To test a syncrepl consumer, the slapd server needs the below overlay configuration.

overlay syncprov
t2y commented 1 year ago

80 implemented Persistent Search, but this feature is different from syncrepl provided by OpenLDAP server (slapd).

2.16.840.1.113730.3.4.3 Persistent Search Request Control             draft-ietf-ldapext-psearch
2.16.840.1.113730.3.4.7 Entry Change Notification Response Control    draft-ietf-ldapext-psearch
t2y commented 1 year ago

I understood the rough design. To provide the syncrepl feature, I have to implement Control structs to handle the above OID packets. Control structs encode/decode the packet from OpenLDAP server.

t2y commented 1 year ago

I understood what the control is for.

I'm considering declaring another Response struct instead of reusing searchResponse because the generic search function differs from the persistent search provided by syncrepl (rfc-4533).

t2y commented 1 year ago

I implemented it. Thanks for consulting with me.