Re: Issue with synchronizing group membership from Syncope to LDAP

2022-01-19 Thread Francesco Chicchiriccò

On 19/01/22 16:07, fab...@fabln.ovh wrote:

Hi Francesco,
Yes, doing those 2 steps separately works. Which also works is to run a USER 
Reconciliation, after this, any change to the group memberships (in the Syncope 
Interface) is populated to LDAP.
I have a last question: I am now testing the SCIM from Azure AD (ultimately I 
need to populate users/groups to LDAP grom AAD (via SCIM to Syncope)).
Users and groups are created fine, but no memberships. I saw in the Syncope 
logs that AAD seems to create users and groups, and then to try to PATCH the 
group to add the members, and I see a 501 error:

"PATCH /syncope/scim/v2/Groups/c4a04619-1b3e-41b9-a046-191b3e11b97f HTTP/1.1" 
501 -


When I try to reproduce this and PATCH with curl, I also get a similar error.

For example, trying to remove a member fails:
{
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
    "Operations": [{
    "op": "Remove",
    "path": "members",
    "value": [{
    "$ref": null,
    "value": "1519e2f5-eadb-4216-99e2-f5eadb52163d"
    }]
    }]
}


Is there any parameter to set up in Syncope ? Sorry I could not find any 
documentation going through this process.


Honestly, I don't remember many real-case usages of the SCIM 2.0 extension, 
hence it is likely that the operation above is actually hitting some part of 
the code which was not thoroughly tested.

Could you please report as well the stacktrace you see in Syncope Core logs 
when performing the operation above?

Regards.


On 2022-01-18 13:59, Francesco Chicchiriccò wrote:

On 14/01/22 13:54, fab...@fabln.ovh wrote:

Thanks Francesco.
Please find more  explanations:


Let me recap the flow:
1. users are created in Syncope  (how? via SCIM?), with the LDAP resource 
assigned


 I created the users here manually in Syncope (REALMs / Users)
For example:
local_user1
Auxiliary Classes: BaseGroup
Groups: none at this stage
surname: local_user5
external resources: my_resource_LDAP

I also tested created the users via SCIM, and then doing a "reconciliation" in 
the LDAP resource, that also works (users are added in LDAP).

after this step, the user local_user1 is synchronized and created in LDAP


2. group is created in Syncope via SCIM, with 2 members
first question: can you see the group membership in Syncope, for the 2 users 
created at step 1?


Yes, going to Realms / Group / local_user20, clicking on "members" /User, I can 
see the 2 members.




3. the Push Task is run

second question: is the Push Task configured for both users and groups?

yes



4. you can see both users and group on LDAP, but no members for the group

correct, at least initially (when users and groups are created)


5. you edit the 2 users in Syncope by adding group membership

yes


6. the Push Task is run again, with expected result

yes



I just realized something actually:
- I create users
- synchronize those users in LDAP
- I create a group with members
- synchronize this group in LDAP, the group is created in LDAP but no members 
are in it
- in Syncope, I then run a USER "reconciliation" in the LDAP resource, then the 
members are synchronized in the GROUP in LDAP.


Is this actually the way to do ?


The simplest way to accomplish what I think is your goal is:

1. create group and assign the LDAP resource to it
2. create user(s) with membership of such group

If you perform such two steps from Syncope Console (or via REST
through standard endpoints), and the LDAP resource is configured
correctly, you get the expected result: users in LDAP, group in LDAP,
with members set.

This works because by default Syncope works with what we call
"implicit provisioning": when you assign a Resource to a Group, the
Group itself and all members will be propagated to the Resource.

One important thing to remember about implicit provisioning is that it
works by type: when you create / update / delete a User, you will get
a User propagated to the Resource; e.g. you cannot create or update a
Group and have Users propagated to LDAP, at least without adding some
customizations around.

I thin that, since you are updating a Group via SCIM endpoint by
assigning members, then propagation is not happening as expected in
the default flow.

HTH
Regards.


On 2022-01-14 07:22, Francesco Chicchiriccò wrote:

On 14/01/22 00:35, fab...@fabln.ovh wrote:

Hi,

I am running Syncope version 2.1.10. I am trying to synchronize groups 
membership via SCIM to SYNCOPE and then from SYNCOPE to LDAP (openldap).

The problem I have is that when I create users and then groups with members in 
Syncope, the users and groups are created properly in LDAP but the group don't 
have the members.

If I edit the users in Syncope and add them to the group, then the group in 
LDAP is synchronized properly and contains the correct members.

Is it possible to synchronize from Syncope to LDAP group members from the group 
in Syncope, or do the users in Syncope need to contain the group list ?


My 

Re: Issue with synchronizing group membership from Syncope to LDAP

2022-01-19 Thread fabien

Hi Francesco,
Yes, doing those 2 steps separately works. Which also works is to run a 
USER Reconciliation, after this, any change to the group memberships (in 
the Syncope Interface) is populated to LDAP.
I have a last question: I am now testing the SCIM from Azure AD 
(ultimately I need to populate users/groups to LDAP grom AAD (via SCIM 
to Syncope)).
Users and groups are created fine, but no memberships. I saw in the 
Syncope logs that AAD seems to create users and groups, and then to try 
to PATCH the group to add the members, and I see a 501 error:


"PATCH /syncope/scim/v2/Groups/c4a04619-1b3e-41b9-a046-191b3e11b97f 
HTTP/1.1" 501 -



When I try to reproduce this and PATCH with curl, I also get a similar 
error.


For example, trying to remove a member fails:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [{
"op": "Remove",
"path": "members",
"value": [{
"$ref": null,
"value": "1519e2f5-eadb-4216-99e2-f5eadb52163d"
}]
}]
}


Is there any parameter to set up in Syncope ? Sorry I could not find any 
documentation going through this process.



Regards,
Fabien


On 2022-01-18 13:59, Francesco Chicchiriccò wrote:

On 14/01/22 13:54, fab...@fabln.ovh wrote:

Thanks Francesco.
Please find more  explanations:


Let me recap the flow:
1. users are created in Syncope  (how? via SCIM?), with the LDAP 
resource assigned


 I created the users here manually in Syncope (REALMs / Users)
For example:
local_user1
Auxiliary Classes: BaseGroup
Groups: none at this stage
surname: local_user5
external resources: my_resource_LDAP

I also tested created the users via SCIM, and then doing a 
"reconciliation" in the LDAP resource, that also works (users are 
added in LDAP).


after this step, the user local_user1 is synchronized and  created in 
LDAP



2. group is created in Syncope via SCIM, with 2 members
first question: can you see the group membership in Syncope, for the 
2 users created at step 1?


Yes, going to Realms / Group / local_user20, clicking on "members" 
/User, I can see the 2 members.





3. the Push Task is run

second question: is the Push Task configured for both users and 
groups?

yes


4. you can see both users and group on LDAP, but no members for the 
group

correct, at least initially (when users and groups are created)


5. you edit the 2 users in Syncope by adding group membership

yes


6. the Push Task is run again, with expected result

yes



I just realized something actually:
- I create users
- synchronize those users in LDAP
- I create a group with members
- synchronize this group in LDAP, the group is created in LDAP but no 
members are in it
- in Syncope, I then run a USER "reconciliation" in the LDAP resource, 
then the members are synchronized in the GROUP in LDAP.



Is this actually the way to do ?


The simplest way to accomplish what I think is your goal is:

1. create group and assign the LDAP resource to it
2. create user(s) with membership of such group

If you perform such two steps from Syncope Console (or via REST
through standard endpoints), and the LDAP resource is configured
correctly, you get the expected result: users in LDAP, group in LDAP,
with members set.

This works because by default Syncope works with what we call
"implicit provisioning": when you assign a Resource to a Group, the
Group itself and all members will be propagated to the Resource.

One important thing to remember about implicit provisioning is that it
works by type: when you create / update / delete a User, you will get
a User propagated to the Resource; e.g. you cannot create or update a
Group and have Users propagated to LDAP, at least without adding some
customizations around.

I thin that, since you are updating a Group via SCIM endpoint by
assigning members, then propagation is not happening as expected in
the default flow.

HTH
Regards.


On 2022-01-14 07:22, Francesco Chicchiriccò wrote:

On 14/01/22 00:35, fab...@fabln.ovh wrote:

Hi,

I am running Syncope version 2.1.10. I am trying to synchronize 
groups membership via SCIM to SYNCOPE and then from SYNCOPE to LDAP 
(openldap).


The problem I have is that when I create users and then groups with 
members in Syncope, the users and groups are created properly in 
LDAP but the group don't have the members.


If I edit the users in Syncope and add them to the group, then the 
group in LDAP is synchronized properly and contains the correct 
members.


Is it possible to synchronize from Syncope to LDAP group members 
from the group in Syncope, or do the users in Syncope need to 
contain the group list ?



My configuration:

I created the users local_user1 and local_user2 in Syncope.

I have the file local_group20.json to create the group 
"local_group20" with the 2 members "local_user1" and "local_user2" 
via SCIM:


{
"schemas":["urn:ietf:params:scim:schemas:core:2.0:Group"],
    "displayName":"local_group20",
    "externalId":