Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About implementing syncrepl (rfc-4533) consumer #422

Closed
t2y opened this issue Mar 17, 2023 · 7 comments
Closed

About implementing syncrepl (rfc-4533) consumer #422

t2y opened this issue Mar 17, 2023 · 7 comments

Comments

@t2y
Copy link
Contributor

t2y commented Mar 17, 2023

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
Copy link
Contributor

vetinari commented May 4, 2023

This requires #319 to be merged first.

@t2y
Copy link
Contributor Author

t2y commented Jul 2, 2023

@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
Copy link
Contributor Author

t2y commented Jul 4, 2023

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
Copy link
Contributor Author

t2y commented Jul 4, 2023

#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
Copy link
Contributor Author

t2y commented Jul 4, 2023

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
Copy link
Contributor Author

t2y commented Jul 19, 2023

I understood what the control is for.

  • Sync Request Control is used for client requests
  • Sync State Control is used for server responses
    • request with mode=RefreshAndPersist, then get a response with ApplicationSearchResultEntry (4)
  • Sync Done Control is used for server responses
    • request with mode=RefreshOnly, then get a response with ApplicationSearchResultDone (5)
  • Sync Info Control is used for server responses
    • request with mode=RefreshAndPersist, then get a response with ApplicationIntermediateResponse (25)

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 added a commit to t2y/ldap that referenced this issue Jul 19, 2023
t2y added a commit to t2y/ldap that referenced this issue Jul 19, 2023
t2y added a commit to t2y/ldap that referenced this issue Jul 19, 2023
t2y added a commit to t2y/ldap that referenced this issue Jul 19, 2023
t2y added a commit to t2y/ldap that referenced this issue Jul 19, 2023
t2y added a commit to t2y/ldap that referenced this issue Jul 22, 2023
cpuschma pushed a commit that referenced this issue Aug 5, 2023
* feat: add syncrepl (rfc-4533) consumer feature #422

* refactor: change Syncrepl interface to be able to pass reloadHint #447

* refactor: unify syncrepl (Syncrepl) instead of syncRepl (SyncRepl) #447

* refactor: integrate xxx_syncrepl.go into control.go/response.go for maintainability #447

* refactor: return an error if an unknown tag is received during the search process
@t2y
Copy link
Contributor Author

t2y commented Aug 5, 2023

I implemented it. Thanks for consulting with me.

@t2y t2y closed this as completed Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants