Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:ldap_c7:data [16.07.2015 20:19. ] – [Benutzermigration mit Hilfe der migrationstools] django | centos:ldap_c7:data [22.07.2019 15:03. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
Nachdem wir die [[centos: | Nachdem wir die [[centos: | ||
- | Wir werden im ersten Schritt unseren OpenLDAP-Verzeichnisdienst mit Schemen befüllen, die wir im späteren Betrieb benötigen werden. Für die Befüllung mit Nutzdaten, die aus Distinguished Names (DN) und einem eindeutigen Objektnamen bestehen, müssen hierzu in den **Directory Information Tree** (**DIT**), einer hierarchischen Baumstruktur eingefügt werden. | + | Wir werden im ersten Schritt unseren OpenLDAP-Verzeichnisdienst mit Schemen befüllen, die wir im späteren Betrieb benötigen werden. Für die Befüllung mit Nutzdaten, die aus **Distinguished Names** (**DN**) und einem eindeutigen Objektnamen bestehen, müssen hierzu in den **Directory Information Tree** (**DIT**), einer hierarchischen Baumstruktur eingefügt werden. |
===== Schemata ===== | ===== Schemata ===== | ||
Zeile 3071: | Zeile 3071: | ||
Zur Speicherung der Daten, die aus einem **DN**((**D**istinguished **N**ame)) und einem eindeutigen Objektnamen bestehen, werden im **DIT**((**D**irectory **I**nformation **T**ree)), erfolgt bei unserem OpenLDAP_Verzeichnisdienmst in einer hierarchischen Baumstruktur. Die Wurzel (root bzw. suffix) ist das oberste Datenobjekt unter dem sich dann die höheren Datenstrukturen verzweigen. | Zur Speicherung der Daten, die aus einem **DN**((**D**istinguished **N**ame)) und einem eindeutigen Objektnamen bestehen, werden im **DIT**((**D**irectory **I**nformation **T**ree)), erfolgt bei unserem OpenLDAP_Verzeichnisdienmst in einer hierarchischen Baumstruktur. Die Wurzel (root bzw. suffix) ist das oberste Datenobjekt unter dem sich dann die höheren Datenstrukturen verzweigen. | ||
- | ==== Erstellung des DIT ==== | + | |
Zur Übernahme bereits bestehender Nutzer aus den beiden Tabellen **/ | Zur Übernahme bereits bestehender Nutzer aus den beiden Tabellen **/ | ||
# vim / | # vim / | ||
Zeile 3148: | Zeile 3148: | ||
===== Benutzermigration mit Hilfe der migrationstools ===== | ===== Benutzermigration mit Hilfe der migrationstools ===== | ||
- | In den seltensten Fällen haben wir eine Installation ohne jegliche Benutzer; in der Regel befinden sich auf unserem LINUX-System bereits angelegte Nutzer mit Ihren Konten. Diesen Nutzer wird immer eine UserID (**uid**) ab 500 zugewiesen. Somit ist eine Unterscheidung zwischen realen Nutzern und technischen Nutzeraccounts relativ leicht möglich. | + | In den seltensten Fällen haben wir eine Installation ohne jegliche Benutzer; in der Regel befinden sich auf unserem LINUX-System bereits angelegte Nutzer mit Ihren Konten. Diesen Nutzer wird immer eine UserID (**uid**) ab **1000** |
Die hierzu erforderlichen Daten bekommen wir aus den beiden Dateien // | Die hierzu erforderlichen Daten bekommen wir aus den beiden Dateien // | ||
+ | ==== Installation ==== | ||
+ | Zur leichteren Übernahme der Nutzerdaten bedienen wir uns der Hilfsprogramme aus dem RPM-Paket **migrationtools** aus dem Base-Repository, | ||
+ | # yum install migrationtools -y | ||
+ | |||
+ | Was uns dieses RPM-Paket alles an Hilfsmittel mitbringt zeigt uns ein Blick in das Paket selbst. | ||
+ | # rpm -qil migrationtools | ||
+ | |||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Thu 16 Jul 2015 10:21:55 PM CEST | ||
+ | Group : System Environment/ | ||
+ | Size : 108216 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : migrationtools-47-15.el7.src.rpm | ||
+ | Build Date : Tue 10 Jun 2014 05:32:33 AM CEST | ||
+ | Build Host : worker1.bsys.centos.org | ||
+ | Relocations : (not relocatable) | ||
+ | Packager | ||
+ | Vendor | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | The MigrationTools are a set of Perl scripts for migrating users, groups, | ||
+ | aliases, hosts, netgroups, networks, protocols, RPCs, and services from | ||
+ | existing nameservices (flat files, NIS, and NetInfo) to LDAP. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | ==== Konfiguration ==== | ||
+ | Vor der Migration unserer Daten ist es noch notwendig, das mitgelieferte Hilfsprogramm **migrate_common.ph** unserer Produktivumgebung anzupassen. Hierzu passen wir die beiden folgenden Parameter unserer Organisation an: | ||
+ | * $DEFAULT_MAIL_DOMAIN = " | ||
+ | * $DEFAULT_BASE = " | ||
+ | |||
+ | # vim / | ||
+ | <file perl vim / | ||
+ | # $Id: migrate_common.ph, | ||
+ | # | ||
+ | # Copyright (c) 1997-2003 Luke Howard. | ||
+ | # All rights reserved. | ||
+ | # | ||
+ | # Redistribution and use in source and binary forms, with or without | ||
+ | # modification, | ||
+ | # are met: | ||
+ | # 1. Redistributions of source code must retain the above copyright | ||
+ | # notice, this list of conditions and the following disclaimer. | ||
+ | # 2. Redistributions in binary form must reproduce the above copyright | ||
+ | # notice, this list of conditions and the following disclaimer in the | ||
+ | # documentation and/or other materials provided with the distribution. | ||
+ | # 3. All advertising materials mentioning features or use of this software | ||
+ | # must display the following acknowledgement: | ||
+ | # This product includes software developed by Luke Howard. | ||
+ | # 4. The name of the other may not be used to endorse or promote products | ||
+ | # derived from this software without specific prior written permission. | ||
+ | # | ||
+ | # THIS SOFTWARE IS PROVIDED BY THE LUKE HOWARD ``AS IS'' | ||
+ | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
+ | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
+ | # ARE DISCLAIMED. | ||
+ | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
+ | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
+ | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
+ | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
+ | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
+ | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
+ | # SUCH DAMAGE. | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # Common defines for MigrationTools | ||
+ | # | ||
+ | |||
+ | # Naming contexts. Key is $PROGRAM with migrate_ and .pl | ||
+ | # stripped off. | ||
+ | $NETINFOBRIDGE = (-x "/ | ||
+ | |||
+ | if ($NETINFOBRIDGE) { | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | } else { | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | $NAMINGCONTEXT{' | ||
+ | } | ||
+ | |||
+ | # Default DNS domain | ||
+ | # Django : 2015-07-16 | ||
+ | # default: $DEFAULT_MAIL_DOMAIN = " | ||
+ | $DEFAULT_MAIL_DOMAIN = " | ||
+ | |||
+ | # Default base | ||
+ | # Django : 2015-07-16 | ||
+ | # default: $DEFAULT_BASE = " | ||
+ | $DEFAULT_BASE = " | ||
+ | |||
+ | # Turn this on for inetLocalMailReceipient | ||
+ | # sendmail support; add the following to | ||
+ | # sendmail.mc (thanks to Petr@Kristof.CZ): | ||
+ | ##### CUT HERE ##### | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ##### CUT HERE ##### | ||
+ | # where / | ||
+ | # domains (similiar to MASQUERADE_DOMAIN_FILE). | ||
+ | # $DEFAULT_MAIL_HOST = " | ||
+ | |||
+ | # turn this on to support more general object clases | ||
+ | # such as person. | ||
+ | $EXTENDED_SCHEMA = 0; | ||
+ | |||
+ | # | ||
+ | # allow environment variables to override predefines | ||
+ | # | ||
+ | if (defined($ENV{' | ||
+ | $DEFAULT_BASE = $ENV{' | ||
+ | } | ||
+ | |||
+ | if (defined($ENV{' | ||
+ | $DEFAULT_MAIL_DOMAIN = $ENV{' | ||
+ | } | ||
+ | |||
+ | if (defined($ENV{' | ||
+ | $DEFAULT_MAIL_HOST = $ENV{' | ||
+ | } | ||
+ | |||
+ | # binddn used for alias owner (otherwise uid=root, | ||
+ | if (defined($ENV{' | ||
+ | $DEFAULT_OWNER = $ENV{' | ||
+ | } | ||
+ | |||
+ | if (defined($ENV{' | ||
+ | $EXTENDED_SCHEMA = $ENV{' | ||
+ | } | ||
+ | |||
+ | # If we haven' | ||
+ | if (!defined($DEFAULT_BASE)) { | ||
+ | $DEFAULT_BASE = & | ||
+ | $DEFAULT_BASE =~ s/,$//o; | ||
+ | } | ||
+ | |||
+ | # Default Kerberos realm | ||
+ | #if ($EXTENDED_SCHEMA) { | ||
+ | # | ||
+ | # | ||
+ | #} | ||
+ | |||
+ | if (-x "/ | ||
+ | $REVNETGROUP = "/ | ||
+ | } elsif (-x "/ | ||
+ | $REVNETGROUP = "/ | ||
+ | } | ||
+ | |||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | $classmap{' | ||
+ | |||
+ | sub parse_args | ||
+ | { | ||
+ | if ($#ARGV < 0) { | ||
+ | print STDERR " | ||
+ | exit 1; | ||
+ | } | ||
+ | |||
+ | $INFILE = $ARGV[0]; | ||
+ | |||
+ | if ($#ARGV > 0) { | ||
+ | $OUTFILE = $ARGV[1]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | sub open_files | ||
+ | { | ||
+ | open(INFILE); | ||
+ | if ($OUTFILE) { | ||
+ | open(OUTFILE,"> | ||
+ | $use_stdout = 0; | ||
+ | } else { | ||
+ | $use_stdout = 1; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # moved from migrate_hosts.pl | ||
+ | # lukeh 10/30/97 | ||
+ | sub domain_expand | ||
+ | { | ||
+ | local($first) = 1; | ||
+ | local($dn); | ||
+ | local(@namecomponents) = split(/\./, $_[0]); | ||
+ | foreach $_ (@namecomponents) { | ||
+ | $first = 0; | ||
+ | $dn .= " | ||
+ | } | ||
+ | $dn .= $DEFAULT_BASE; | ||
+ | return $dn; | ||
+ | } | ||
+ | |||
+ | # case insensitive unique | ||
+ | sub uniq | ||
+ | { | ||
+ | local($name) = shift(@_); | ||
+ | local(@vec) = sort {uc($a) cmp uc($b)} @_; | ||
+ | local(@ret); | ||
+ | local($next, | ||
+ | foreach $next (@vec) { | ||
+ | if ((uc($next) ne uc($last)) && | ||
+ | (uc($next) ne uc($name))) { | ||
+ | push (@ret, $next); | ||
+ | } | ||
+ | $last = $next; | ||
+ | } | ||
+ | return @ret; | ||
+ | } | ||
+ | |||
+ | # concatenate naming context and | ||
+ | # organizational base | ||
+ | sub getsuffix | ||
+ | { | ||
+ | local($program) = shift(@_); | ||
+ | local($nc); | ||
+ | $program =~ s/ | ||
+ | $nc = $NAMINGCONTEXT{$program}; | ||
+ | if ($nc eq "" | ||
+ | return $DEFAULT_BASE; | ||
+ | } else { | ||
+ | return $nc . ',' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | sub ldif_entry | ||
+ | { | ||
+ | # remove leading, trailing whitespace | ||
+ | local ($HANDLE, $lhs, $rhs) = @_; | ||
+ | local ($type, $val) = split(/\=/, $lhs); | ||
+ | local ($dn); | ||
+ | |||
+ | if ($rhs ne "" | ||
+ | $dn = $lhs . ',' | ||
+ | } else { | ||
+ | $dn = $lhs; | ||
+ | } | ||
+ | |||
+ | $type =~ s/\s*$//o; | ||
+ | $type =~ s/^\s*//o; | ||
+ | $type =~ tr/ | ||
+ | $val =~ s/\s*$//o; | ||
+ | $val =~ s/^\s*//o; | ||
+ | |||
+ | print $HANDLE "dn: $dn\n"; | ||
+ | print $HANDLE " | ||
+ | print $HANDLE " | ||
+ | print $HANDLE " | ||
+ | if ($EXTENDED_SCHEMA) { | ||
+ | if ($DEFAULT_MAIL_DOMAIN) { | ||
+ | print $HANDLE " | ||
+ | print $HANDLE " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | print $HANDLE " | ||
+ | } | ||
+ | |||
+ | # Added Thu Jun 20 16:40:28 CDT 2002 by Bob Apthorpe | ||
+ | # < | ||
+ | # protocols and mail aliases. | ||
+ | sub escape_metacharacters | ||
+ | { | ||
+ | local($name) = @_; | ||
+ | |||
+ | # From Table 3.1 " | ||
+ | # in Distinguished Names", | ||
+ | # Directory Services", | ||
+ | |||
+ | # 1) Quote backslash | ||
+ | # Note: none of these are very elegant or robust and may cause | ||
+ | # more trouble than they' | ||
+ | # 1.a) naive (escape all backslashes) | ||
+ | # $name =~ s# | ||
+ | # | ||
+ | # 1.b) mostly naive (escape all backslashes not followed by | ||
+ | # a backslash) | ||
+ | # $name =~ s# | ||
+ | # | ||
+ | # 1.c) less naive and utterly gruesome (replace solitary | ||
+ | # backslashes) | ||
+ | # $name =~ s{ # Replace | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # } | ||
+ | # | ||
+ | # | ||
+ | # }gx; | ||
+ | # Ugh. Note that s# | ||
+ | # starts or ends with a backslash. This expression won't work | ||
+ | # under perl4 because the /x flag and negative lookahead and | ||
+ | # lookbehind operations aren't supported. Sorry. Also note that | ||
+ | # s# | ||
+ | # this is all broken if $name is already escaped before we get | ||
+ | # to it. Best to throw a warning and make the user import these | ||
+ | # records by hand. | ||
+ | |||
+ | # 2) Quote leading and trailing spaces | ||
+ | local($leader, | ||
+ | if (($leader, $body, $trailer) = ($name =~ m#^( *)(.*\S)( *)$#o)) { | ||
+ | $leader =~ s# #\\ #og; | ||
+ | $trailer =~ s# #\\ #og; | ||
+ | $name = $leader . $body . $trailer; | ||
+ | } | ||
+ | |||
+ | # 3) Quote leading octothorpe (#) | ||
+ | $name =~ s/^#/\\#/o; | ||
+ | |||
+ | # 4) Quote comma, plus, double-quote, | ||
+ | # and semicolon | ||
+ | $name =~ s# | ||
+ | |||
+ | return $name; | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | |||
+ | </ | ||
+ | |||
+ | === Datenselektion === | ||
+ | Da wir nicht alle Nutzer, sondern nur die realen Benutzer in den DIT übernehmen wollen, extrahieren wir alle Nutzer aus der // | ||
+ | # grep ": | ||
+ | |||
+ | Es wird folgende Datei erstellt. | ||
+ | # cat / | ||
+ | |||
+ | django: | ||
+ | michael: | ||
+ | inge: | ||
+ | rebekka: | ||
+ | jakob: | ||
+ | ruben: | ||
+ | leah: | ||
+ | markus: | ||
+ | gertraud: | ||
+ | johann: | ||
+ | |||
+ | # grep ": | ||
+ | |||
+ | Es wird folgende Datei erstellt. | ||
+ | # cat / | ||
+ | |||
+ | django: | ||
+ | michael: | ||
+ | inge: | ||
+ | rebekka: | ||
+ | jakob: | ||
+ | ruben: | ||
+ | leah: | ||
+ | markus: | ||
+ | gertraud: | ||
+ | johann: | ||
+ | |||
+ | === Datenmigration === | ||
+ | Nun ist es an der Zeit unsere Nutzerdaten aus den zuvor angelegten temporären Dateien in entsprechende .ldif Dateien zu konvertieren. Hierzu nutzen wir die Hilfsprogramme aus dem zuvor installiertem RPM Paket **migrationtools**: | ||
+ | * **migrate_passwd.pl** | ||
+ | * **migrate_group.pl** | ||
+ | |||
+ | Wir erstellen also nun die beiden .ldif-Dateien. | ||
+ | # / | ||
+ | |||
+ | # / | ||
+ | |||
+ | Aus der Datei // | ||
+ | michael: | ||
+ | inge: | ||
+ | rebekka: | ||
+ | jakob: | ||
+ | ruben: | ||
+ | leah: | ||
+ | markus: | ||
+ | gertraud: | ||
+ | johann: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: django | ||
+ | userPassword: | ||
+ | gidNumber: 1000 | ||
+ | memberUid: 1000 | ||
+ | |||
+ | dn: cn=michael, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: michael | ||
+ | userPassword: | ||
+ | gidNumber: 1001 | ||
+ | memberUid: 1001 | ||
+ | |||
+ | dn: cn=inge, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: inge | ||
+ | userPassword: | ||
+ | gidNumber: 1002 | ||
+ | memberUid: 1002 | ||
+ | |||
+ | dn: cn=rebekka, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: rebekka | ||
+ | userPassword: | ||
+ | gidNumber: 1003 | ||
+ | memberUid: 1003 | ||
+ | |||
+ | dn: cn=jakob, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: jakob | ||
+ | userPassword: | ||
+ | gidNumber: 1004 | ||
+ | memberUid: 1004 | ||
+ | |||
+ | dn: cn=ruben, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: ruben | ||
+ | userPassword: | ||
+ | gidNumber: 1005 | ||
+ | memberUid: 1005 | ||
+ | |||
+ | dn: cn=leah, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: leah | ||
+ | userPassword: | ||
+ | gidNumber: 1006 | ||
+ | memberUid: 1006 | ||
+ | |||
+ | dn: cn=markus, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: markus | ||
+ | userPassword: | ||
+ | gidNumber: 1007 | ||
+ | memberUid: 1007 | ||
+ | |||
+ | dn: cn=gertraud, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: gertraud | ||
+ | userPassword: | ||
+ | gidNumber: 1008 | ||
+ | memberUid: 1008 | ||
+ | |||
+ | dn: cn=johann, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: johann | ||
+ | userPassword: | ||
+ | gidNumber: 1009 | ||
+ | memberUid: 1009</ | ||
+ | |||
+ | Aus der Datei // | ||
+ | michael: | ||
+ | inge: | ||
+ | rebekka: | ||
+ | jakob: | ||
+ | ruben: | ||
+ | leah: | ||
+ | markus: | ||
+ | gertraud: | ||
+ | johann: | ||
+ | uid: django | ||
+ | cn: django | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | shadowLastChange: | ||
+ | shadowMin: 0 | ||
+ | shadowMax: 99999 | ||
+ | shadowWarning: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1000 | ||
+ | gidNumber: 1000 | ||
+ | homeDirectory: | ||
+ | gecos: django | ||
+ | |||
+ | dn: uid=michael, | ||
+ | uid: michael | ||
+ | cn: michael | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1001 | ||
+ | gidNumber: 1001 | ||
+ | homeDirectory: | ||
+ | gecos: michael | ||
+ | |||
+ | dn: uid=inge, | ||
+ | uid: inge | ||
+ | cn: inge | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1002 | ||
+ | gidNumber: 1002 | ||
+ | homeDirectory: | ||
+ | gecos: inge | ||
+ | |||
+ | dn: uid=rebekka, | ||
+ | uid: rebekka | ||
+ | cn: rebekka | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1003 | ||
+ | gidNumber: 1003 | ||
+ | homeDirectory: | ||
+ | gecos: rebekka | ||
+ | |||
+ | dn: uid=jakob, | ||
+ | uid: jakob | ||
+ | cn: jakob | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1004 | ||
+ | gidNumber: 1004 | ||
+ | homeDirectory: | ||
+ | gecos: jakob | ||
+ | |||
+ | dn: uid=ruben, | ||
+ | uid: ruben | ||
+ | cn: ruben | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1005 | ||
+ | gidNumber: 1005 | ||
+ | homeDirectory: | ||
+ | gecos: ruben | ||
+ | |||
+ | dn: uid=leah, | ||
+ | uid: leah | ||
+ | cn: leah | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1006 | ||
+ | gidNumber: 1006 | ||
+ | homeDirectory: | ||
+ | gecos: leah | ||
+ | |||
+ | dn: uid=markus, | ||
+ | uid: markus | ||
+ | cn: markus | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1007 | ||
+ | gidNumber: 1007 | ||
+ | homeDirectory: | ||
+ | gecos: markus | ||
+ | |||
+ | dn: uid=gertraud, | ||
+ | uid: gertraud | ||
+ | cn: gertraud | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1008 | ||
+ | gidNumber: 1008 | ||
+ | homeDirectory: | ||
+ | gecos: gertraud | ||
+ | |||
+ | dn: uid=johann, | ||
+ | uid: johann | ||
+ | cn: johann | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1009 | ||
+ | gidNumber: 1009 | ||
+ | homeDirectory: | ||
+ | gecos: johann | ||
+ | </ | ||
+ | |||
+ | === Datenübernahme in den DIT === | ||
+ | Nachdem wir die Nutzerdaten aus dem/einem System migriert haben, werden wir nun mit dem Befehl **ldapadd** die gerade generierten LDIF-Dateien in den DIT importieren. | ||
+ | |||
+ | Als erstes importieren wir den **DN**((**D**istinguished **N**ame)) Group. | ||
+ | # ldapadd -W -x -D cn=Manager, | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | < | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | </ | ||
+ | |||
+ | Anschließend importieren wir den **DN** People. | ||
+ | # ldapadd -W -x -D cn=Manager, | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | < | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | adding new entry " | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== abschließender Test ==== | ||
+ | Für den abschliessenden Test, ob die Datenmigration aus den filebasierenden Dateien in den DIT unseres OpenLADP-Servers geklappt hat, befragen wir unseren LDAP-Server nach den Daten zum **User** // | ||
+ | # ldapsearch -W -x -D cn=config -b " | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | < | ||
+ | uid: django | ||
+ | cn: django | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword:: | ||
+ | | ||
+ | | ||
+ | shadowLastChange: | ||
+ | shadowMin: 0 | ||
+ | shadowMax: 99999 | ||
+ | shadowWarning: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 1000 | ||
+ | gidNumber: 1000 | ||
+ | homeDirectory: | ||
+ | gecos: django</ | ||
+ | |||
+ | Unsere erfolgreiche Abfrage erzeugt einen entsprechendnen Eintrag im Logfile des slapd-Daemon. | ||
+ | # less / | ||
+ | |||
+ | < | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | Jul 16 23:26:21 vml000037 slapd[14264]: | ||
+ | </ | ||
+ | |||
+ | Zu guter letzt befragen wir nun noch unseren LDAP-Server nach den Daten der **Gruppe** // | ||
+ | # ldapsearch -x -b " | ||
+ | |||
+ | < | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=*) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # django, Group, nausch.org | ||
+ | dn: cn=django, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | cn: django | ||
+ | userPassword:: | ||
+ | gidNumber: 1000 | ||
+ | memberUid: 1000 | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1</ | ||
+ | |||
+ | Natürlich wurde auch hier unsere Abfrage im LDAP-Log dokumentiert. | ||
+ | # less / | ||
+ | |||
+ | < | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | Jul 16 23:40:26 vml000037 slapd[14264]: | ||
+ | |||
+ | ===== DIT Indizes ===== | ||
+ | ==== Abfrage der Indizes ==== | ||
+ | Wollen wir später einzelne Index Felder im **DIT** anpassen, müssen wir natürlich wissen wie die derzeitigen Felder indiziert wurden. Hierzu lassen wir uns die existierende Indizierung der Felder anzeigen. | ||
+ | |||
+ | Hierzu nutzen wir nun folgenden Befehlsaufruf. | ||
+ | # | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | < | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=*) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # {2}hdb, config | ||
+ | dn: olcDatabase={2}hdb, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | olcDatabase: | ||
+ | olcDbDirectory: | ||
+ | olcSuffix: dc=nausch, | ||
+ | olcRootDN: cn=Manager, | ||
+ | olcRootPW: {SSHA}lfeku/ | ||
+ | olcDbIndex: objectClass eq,pres | ||
+ | olcDbIndex: ou, | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1</ | ||
+ | |||
+ | Für die Felder **objectClass** und **ou, | ||
+ | |||
+ | * **olcDbIndex: | ||
+ | * **olcDbIndex: | ||
+ | |||
+ | Dies entspricht nachfolgender Tabelle. | ||
+ | ^ **Felder** | ||
+ | | ::: ^ // | ||
+ | | **objectClass** | ||
+ | | **ou** | ||
+ | | **cn** | ||
+ | | **mail** | ||
+ | | **surname** | ||
+ | | **givenname** | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Erfolgt ein Zugriff auf ein Fled im OpenLDAP-Verzeichnisbaum bei dem kein Index definiert wurde, wird dazu im LDAP-Log // | ||
+ | Jul 17 12:32:53 vml000037 slapd[14264]: | ||
+ | |||
+ | ==== Setzen der Indizes (LDIF) ==== | ||
+ | Für die Felder in der folgenden Tabelle wollen wir nun noch Indizes erstellen. | ||
+ | |||
+ | ^ **Felder** | ||
+ | | ::: | ||
+ | | **uidNumber** | ||
+ | | **gidNumber** | ||
+ | | **loginShell** | ||
+ | | **uid** | ||
+ | | **memberUid** | ||
+ | | **nisMapName** | ||
+ | | **nisMapEntry** | ||
+ | | **uniqueMember** | ||
+ | |||
+ | Zu dieser Tabelle erstellen wir uns nun eine passende LDIF-Datei. | ||
+ | # vim / | ||
+ | |||
+ | <file ldif / | ||
+ | # Erstellen von zusätzlichen Indizes für Felder im DIT | ||
+ | # https:// | ||
+ | |||
+ | dn: olcDatabase={2}hdb, | ||
+ | changetype: modify | ||
+ | add: olcDbIndex | ||
+ | olcDbIndex: uidNumber, | ||
+ | olcDbIndex: uid, | ||
+ | olcDbIndex: nisMapName, | ||
+ | olcDbIndex: uniqueMember eq,pres | ||
+ | </ | ||
+ | |||
+ | Anschließend importieren wir diese Daten in unseren **DIT**. | ||
+ | # ldapmodify -Y EXTERNAL -H ldapi:/// -f / | ||
+ | |||
+ | SASL/ | ||
+ | SASL username: gidNumber=0+uidNumber=0, | ||
+ | SASL SSF: 0 | ||
+ | modifying entry " | ||
+ | |||
+ | |||
+ | ==== Überprüfen der gesetzten Indizes ==== | ||
+ | Zu guter letzt lassen wir uns erneut anzeigen für welche Felder im **DIT** Indizies gesetzt sind. Dazu verwenden wir folgenden Befehl. | ||
+ | # | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | < | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=*) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # {2}hdb, config | ||
+ | dn: olcDatabase={2}hdb, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | olcDatabase: | ||
+ | olcDbDirectory: | ||
+ | olcSuffix: dc=nausch, | ||
+ | olcRootDN: cn=Manager, | ||
+ | olcRootPW: {SSHA}lfeku/ | ||
+ | olcDbIndex: objectClass eq,pres | ||
+ | olcDbIndex: ou, | ||
+ | olcDbIndex: uidNumber, | ||
+ | olcDbIndex: uid, | ||
+ | olcDbIndex: nisMapName, | ||
+ | olcDbIndex: uniqueMember eq,pres | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1</ | ||
+ | |||
+ | ====== Links ====== | ||
+ | * **⇐ [[centos: | ||
+ | * **⇒ [[centos: | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
- | FIXME | ||