Difference between revisions of "Cool Solution - Sync Users and Groups into a second Domain"

From Univention Wiki

Jump to: navigation, search
(Move to KB)
Tag: Replaced
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Version|UCS=4.3}}
+
This page has been moved to the Knowledge Base Cool Solutions in the Forum.
{{Cool Solutions Disclaimer|Repository=yes}}
 
{{#seo:
 
|title={{#replace:{{#replace:{{#replace:{{#replace:{{FULLPAGENAME}}|'|'}}|&|&}}|"|"}}|Cool Solution - |}} - {{SITENAME}}
 
<!--|description=-->
 
}}
 
{{Review-Status}}
 
  
 +
[https://help.univention.com/t/cool-solution-sync-users-and-groups-into-a-second-domain/ Cool Solution - Sync Users and Groups into a second Domain]
  
This article describes, how to import Users and Groups from one domain into a second through a synchronization system. The implementation keeps the target system in sync with the source system (One-Way Synchronization).<br />
+
[[Category:EN]]
For this setup to work, the external target system can be unable to reach the internal source system. However, the internal source system must be able to gain SSH access to the target. This solution is especially helpful to keep a server in the DMZ up-to-date with changes to users and groups in an internal, inaccessible UCS environment. Both systems are allowed to have different LDAP bases.
+
[[Category:Howtos]]
 
 
{{TOC}}
 
 
 
== Installation ==
 
 
 
First, you have to install two packets. There is one package each for the source and target systems.
 
 
 
Install the source package on the leading UCS system:
 
<pre>
 
univention-install univention-user-group-sync-source
 
</pre>
 
further, install the sink package on the target UCS system:
 
<pre>
 
univention-install univention-user-group-sync-sink
 
</pre>
 
 
 
== Configuration ==
 
 
 
You can now configure the connection. All configurations can be done through UCR attributes on the UCS source system.<br>
 
We have a few attributes, that have to be set:
 
{| class=wikitable
 
! UCR variable || Description
 
|-
 
|<code>ldap/sync/filter</code>  || LDAP Filter, that will filter all wanted users and groups out of the source system.<br>'''Note:''' If this variable is empty, a default will be used. The standard filter guarantees ensures that all users and groups are syncronized by nothing else:<br>
 
<code>(|(&(objectClass=posixGroup)(objectClass=univentionGroup))(objectClass=posixAccount))</code>
 
|-
 
|<code>ldap/sync/address</code> || Hostname or IP address of the target UCS system
 
|-
 
|<code>ldap/sync/user</code>    || User name for data transfer, with which the software can connect to the target UCS system through SSH
 
|-
 
|<code>ldap/sync/pwdfile</code> || Path to password file for data transfer to the target UCS system, which contains the password of the transfer user
 
|}
 
 
 
The variable <code>ldap/sync/filter</code> is needed to guarantee, that only Users and Groups are synchronized. It is at the moment not possible to keep anything else synchronized with this Solution. We will use the default filter, which selects all Users and Groups as noted above. We don't have to restrict the selected Objects further in our example.
 
 
 
The source system needs SSH access to transfer data and execute the script delivered by the sink package to the target system. We will use the ''root'' user of the target system in our example and store it's password in the ''/etc'' folder of the source system:
 
<pre>
 
ucr set ldap/sync/filter="" \
 
ldap/sync/address="192.168.0.20" \
 
ldap/sync/user="root" \
 
ldap/sync/pwdfile="/etc/dmz-root.secret"
 
</pre>
 
 
 
 
 
At last, a cron job has to be created to trigger the synchronization of the two UCS systems. The following two UCR variables can be used to define it:
 
{| class=wikitable
 
! UCR variable || Description
 
|-
 
|<code>cron/ldap-synchronization/time</code>    || The cron job time, which specifies the execution time in Cron syntax (default every 5 minutes: ''*/5 * * * *'')
 
|-
 
|<code>cron/ldap-synchronization/command</code> || The cron job command, which synchronizes the UCS systems (default: see below)
 
|}
 
 
 
The following code creates a cron job, which is run every 5 minutes and then synchronizes and imports all LDAP changes to Users and Groups into the target system:
 
<pre>
 
ucr set cron/ldap-synchronization/time="*/5 * * * *" \
 
cron/ldap-synchronization/command="univention-ssh-rsync \
 
$(ucr get ldap/sync/pwdfile) --remove-source-files --ignore-missing-args \
 
/var/lib/univention-user-group-sync-source/* \
 
$(ucr get ldap/sync/user)@$(ucr get ldap/sync/address):/var/lib/univention-user-group-sync-sink/ \
 
&& univention-ssh $(ucr get ldap/sync/pwdfile) \
 
$(ucr get ldap/sync/user)@$(ucr get ldap/sync/address) univention_user_group_sync_sink.py"
 
</pre>
 
 
 
Now, the configuration is done. The source package will write all LDAP changes into files below the ''/var/lib/univention-user-group-sync-source/'' folder, which will be synchronized by the cron job and again be imported by the sink package.
 

Latest revision as of 14:43, 29 May 2019

This page has been moved to the Knowledge Base Cool Solutions in the Forum.

Cool Solution - Sync Users and Groups into a second Domain

Personal tools