Xc@sddkZddkZddklZlZlZddklZlZl Z l Z l Z l Z ddk lZddklZeiioeiiddgjo6yddklZWnej oZenXndd klZdd klZddkZed Zed Zed ZedZedZ edZ!ddfZ"eddfddfddfZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*defdYZ+ei,e+dS( iN(tapiterrorstoutput(tCommandtPasswordtStrtFlagtStrEnumtDNParam(tto_cli(t NO_UPG_MAGICtlitetserver(tldap2(t_(tDNs Migration to IPA Migrate users and groups from an LDAP server to IPA. This performs an LDAP query against the remote server searching for users and groups in a container. In order to migrate passwords you need to bind as a user that can read the userPassword attribute on the remote server. This is generally restricted to high-level admins such as cn=Directory Manager in 389-ds (this is the default bind user). The default user container is ou=People. The default group container is ou=Groups. Users and groups that already exist on the IPA server are skipped. Two LDAP schemas define how group members are stored: RFC2307 and RFC2307bis. RFC2307bis uses member and uniquemember to specify group members, RFC2307 uses memberUid. The default schema is RFC2307bis. The schema compat feature allows IPA to reformat data for systems that do not support RFC2307bis. It is recommended that this feature is disabled during migration to reduce system overhead. It can be re-enabled after migration. To migrate with it enabled use the "--with-compat" option. Migrated users do not have Kerberos credentials, they have only their LDAP password. To complete the migration process, users need to go to http://ipa.example.com/ipa/migration and authenticate using their LDAP password in order to generate their Kerberos credentials. Migration is disabled by default. Use the command ipa config-mod to enable it: ipa config-mod --enable-migration=TRUE If a base DN is not provided with --basedn then IPA will use either the value of defaultNamingContext if it is set or the first value in namingContexts set in the root of the remote LDAP server. Users are added as members to the default user group. This can be a time-intensive task so during migration this is done in a batch mode for every 100 users. As a result there will be a window in which users will be added to IPA but will not be members of the default user group. EXAMPLES: The simplest migration, accepting all defaults: ipa migrate-ds ldap://ds.example.com:389 Specify the user and group container. This can be used to migrate user and group data from an IPA v1 server: ipa migrate-ds --user-container='cn=users,cn=accounts' \ --group-container='cn=groups,cn=accounts' \ ldap://ds.example.com:389 Since IPA v2 server already contain predefined groups that may collide with groups in migrated (IPA v1) server (for example admins, ipausers), users having colliding group as their primary group may happen to belong to an unknown group on new IPA v2 server. Use --group-overwrite-gid option to overwrite GID of already existing groups to prevent this issue: ipa migrate-ds --group-overwrite-gid \ --user-container='cn=users,cn=accounts' \ --group-container='cn=groups,cn=accounts' \ ldap://ds.example.com:389 Migrated users or groups may have object class and accompanied attributes unknown to the IPA v2 server. These object classes and attributes may be left out of the migration process: ipa migrate-ds --user-container='cn=users,cn=accounts' \ --group-container='cn=groups,cn=accounts' \ --user-ignore-objectclass=radiusprofile \ --user-ignore-attribute=radiusgroupname \ ldap://ds.example.com:389 LOGGING Migration will log warnings and errors to the Apache error log. This file should be evaluated post-migration to correct or investigate any issues that were discovered. For every 100 users migrated an info-level message will be displayed to give the current progress and duration to make it possible to track the progress of migration. If the log level is debug, either by setting debug = True in /etc/ipa/default.conf or /etc/ipa/server.conf, then an entry will be printed for each user added plus a summary when the default user group is updated. sLKerberos principal %s already exists. Use 'ipa user-mod' to set it manually.scUnable to determine if Kerberos principal %s already exists. Use 'ipa user-mod' to set it manually.sTFailed to add user to the default group. Use 'ipa group-add-member' to add manually.s4Migration of LDAP search reference is not supported.s Malformed DNu RFC2307bisuRFC2307tcnsSchema CompatibilitytpluginstconfigcKsJt|tptdddg}|i|idg|d} |d} |idd} |d} |d } d |jo)tid td t d |n`|d d| jo&t i i d|d d|fn%|d d| joyI| i d |d dddg| d\}}| i|d dWqtij o>t i i d|d d|f| i|d dqtij o1}t i i d|d d||ifqtij o%}t i i d|d dqXn|idg|ditd|dded?d4ed!ed$ee d@ddAdedBdedCd4ed!ed$ee dDddEdedFdedGd4ed!ed$ee dHddIdedJdedKd4ed!ed$eedLddMdedNdedOedPddQdedRdedSdTed!edUd$eedVdedWdedXd!eedYddZded[ded\ed]dd^ded_ded`d!efZeidadbededceidddbededeeidfdbededgeidhdbededifZedjZedkZedlZedmZ dnZ!doZ"dpZ#dqZ$drZ%dsZ&RS({s(Migrate users and groups from DS to IPA.s(&(|%s)(uid=*))tfilter_templatetuserobjectclasst oc_optiontuserignoreobjectclasstoc_blacklist_optiontuserignoreattributetattr_blacklist_optiont pre_callbackt post_callbackt exc_callbackRs(&(|%s)(cn=*))tgroupobjectclasstgroupignoreobjectclasstgroupignoreattributeR!Rtcli_nameRtlabelsLDAP URItdocs%LDAP URI of DS server to migrate fromtbindpwtpasswordRtconfirms bind passwordsbinddn?tbind_dnsBind DNtdefaultRsdirectory managertautofillt usercontainertuser_containersUser containers3DN of container for users in DS relative to base DNtoutpeopletgroupcontainertgroup_containersGroup containers4DN of container for groups in DS relative to base DNtgroupssuserobjectclass+tuser_objectclasssUser object classsKComma-separated list of objectclasses used to search for user entries in DStcsvupersonsgroupobjectclass+tgroup_objectclasssGroup object classsLComma-separated list of objectclasses used to search for group entries in DSugroupOfUniqueNamesu groupOfNamessuserignoreobjectclass*tuser_ignore_objectclasssIgnore user object classsJComma-separated list of objectclasses to be ignored for user entries in DSsuserignoreattribute*tuser_ignore_attributesIgnore user attributesGComma-separated list of attributes to be ignored for user entries in DSsgroupignoreobjectclass*tgroup_ignore_objectclasssIgnore group object classsKComma-separated list of objectclasses to be ignored for group entries in DSsgroupignoreattribute*tgroup_ignore_attributesIgnore group attributesHComma-separated list of attributes to be ignored for group entries in DSRtgroup_overwrite_gids Overwrite GIDscWhen migrating a group already existing in IPA domain overwrite the group GID and report as successsschema?Rs LDAP schemasjThe schema used on the LDAP server. Supported values are RFC2307 and RFC2307bis. The default is RFC2307bistvaluesis continue?tContinuesHContinuous operation mode. Errors are reported but the process continuessbasedn?tbase_dnsBase DNsBase DN on remote LDAP serverscompat?t with_compatsIgnore compat plugins3Allows migration despite the usage of compat pluginR~RJs/Lists of objects migrated; categorized by type.RXsALists of objects that could not be migrated; categorized by type.tenableds%False if migration mode was disabled.tcompatsFFalse if migration fails because the compatibility plug-in is enabled.s4comma-separated list of %s to exclude from migrationsssearch results for objects to be migrated have been truncated by the server; migration process might be incomplete s>Migration mode is disabled. Use 'ipa config-mod' to enable it.sPasswords have been migrated in pre-hashed format. IPA is unable to generate Kerberos keys unless provided with clear text passwords. All migrated users need to login at https://your.domain/ipa/migration/ before they can use their Kerberos accounts.ccsx"tt|iD] }|VqWxq|iD]f}|ii|}dt|}|i|i}t d|d|d|dt dt dt Vq/WdS( s} Call get_options of the baseclass and add "exclude" options for each type of object being migrated. s exclude_%sss%s*RRRRRN( tsuperRt get_optionstmigrate_objectsRRLR t exclude_doctobject_name_pluralRRttuple(tselftoptiont ldap_obj_nametldap_objRNR((s</usr/lib/python2.6/site-packages/ipalib/plugins/migration.pyRxs  cCsoxh|iD]Z}|ioJ||io(td||iD||is N(tparamsRRNR(RRtp((s</usr/lib/python2.6/site-packages/ipalib/plugins/migration.pytnormalize_optionss  %cCs{t}xk|D]c}|idt|}|o-|i|o |}qit||}n|}||||i |dg|| tidddd d t\}}Wnwtij oh|id tpBtid td h| d6|| d6di| d6qt}g}nX|o$|iid| i|ifnh}xZd)D]R}|i | |d}|d*j o|i|t||s@  .& [       $ | % U