overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml https://raw.github.com/arrrght/openldap-outlook/master/overlay.xml
# layman -S # layman -a openldap-outlook
net-nds/openldap experimental icu slp perl overlays ms-sssvlv
emerge openldap
--- ./openldap-2.4.33/servers/slapd/schema_prep.c.orig 2012-12-07 09:54:56.000000000 +0700 +++ ./openldap-2.4.33/servers/slapd/schema_prep.c 2012-12-07 09:58:10.000000000 +0700 @@ -908,6 +908,7 @@ "DESC 'RFC4519: common supertype of name attributes' " "EQUALITY caseIgnoreMatch " "SUBSTR caseIgnoreSubstringsMatch " + "ORDERING caseIgnoreOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )", NULL, SLAP_AT_ABSTRACT, NULL, NULL,
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/java.schema include /etc/openldap/schema/openldap.schema include /etc/openldap/schema/nis.schema include /etc/openldap/schema/corba.schema include /etc/openldap/schema/dyngroup.schema include /etc/openldap/schema/misc.schema include /etc/openldap/schema/pmi.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args modulepath /usr/lib64/openldap/openldap moduleload back_passwd.so moduleload back_ldap.so moduleload sssvlv.so database hdb overlay sssvlv suffix "dc=org,dc=com" checkpoint 32 30 rootdn "cn=Manager,dc=org,dc=com" rootpw secret directory /var/lib/openldap-data index objectClass eq , , LDAP entry.ldif: dn: dc=org,dc=com objectClass: dcObject objectClass: organization o: org.com</code> ldif : <code>slapadd < entry.ldif</code> LdapAdmin ou=ab,dc=org,dc=com. , , . <h4>XLS</h4> smbget, samba, xls2csv. getfile.sh: <source lang="bash"> #!/bin/sh SMBGET=/usr/bin/smbget LDAPSEARCH=/usr/bin/ldapsearch LDAPDELETE=/usr/bin/ldapdelete rm "temp.xls" ${SMBGET} "smb://domain;user:password@192.168.1.1/Share/Telephones.xls" -o temp.xls xls2csv -c~ -b\' temp.xls > temp.csv # delete all from ou=ab,dc=org,dc=com ${LDAPSEARCH} -b "ou=ab,dc=org,dc=com" "(uid=*)" | grep dn: | awk '{print $2}' | ${LDAPDELETE} -Dcn=Manager,dc=org,dc=com -wsecret
#!/usr/bin/perl use strict; use encoding 'utf8'; open my $fh, "<temp.csv" or die 'Can\'t open file'; open my $fout, ">temp.ldif" or die 'Can\'t write to file'; my $org = ''; my $orgNum = 0; my $div = ''; my $userNum = 1000; my $ouDcDc = 'ou=ab,dc=org,dc=com'; while (my $line = <$fh>) { my $isNowOrg = 0; my $email = ''; chomp $line; my @f = split /~/, $line; if (!$org || $f[0]=~/\'/){ $org = clean($f[0]); $org =~s/^(.+)\"(.+)\"$/$2/; $org = firstUp($org); $isNowOrg = 1; $orgNum++; } $email = clean($f[5]) if $f[5]=~/@/; $div = firstUp(clean($f[0])) unless $f[1] || $email; my $name = clean($f[1]); my $post = clean($f[0]); my $telNum = clean($f[4]); $telNum =clean($f[2]) if $orgNum==3; $telNum =~s/\D/ /g; $telNum =~s/^\D*//g; #print "#$telNum#\n"; #$telNum = ~s/\W//g; my %names = givenName($name); if ($name && $post && $names{'firstName'}){ ++$userNum; print $fout "dn: uid=user${userNum},${ouDcDc}\n"; print $fout "uid: user${userNum}\n"; print $fout "objectClass: posixAccount\nobjectClass: top\nobjectClass: inetOrgPerson\ngidNumber: 1000\n"; print $fout "uidNumber: ${userNum}\n"; print $fout "givenName: ", $names{'firstName'}, "\n"; print $fout "initials: ", $names{'middleName'}, "\n"; print $fout "sn: ", $names{'lastName'}, "\n"; #print $fout "username: user${userNum}\n"; print $fout "homeDirectory: home_dir\ngecos: gecos\nloginShell: log_shell\n"; print $fout "telephoneNumber: ${telNum}\n" if $telNum; print $fout "physicalDeliveryOfficeName: ${div}\n"; print $fout "ou: ${div}\n"; print $fout "o: $org\n"; #print $fout "organizationName: ACME\n"; print $fout "title: $post\n"; print $fout "mail: $email\n"; print $fout "cn: ", $names{'shortName'},"\n"; print $fout "\n"; # print "ORG: $org, DIV: $div, POST: $post, NAME: $name, EMAIL: $email\n"; } } close $fout; close $fh; sub givenName(){ my $name = shift; my @s=[]; my %names = {}; @s = split ' ', $name; $names{'firstName'} = $s[1]; $names{'lastName'} = $s[0]; $names{'middleName'} = $s[2]; $names{'shortName'} = $s[0] .' '. substr($s[1],0,1) .'.'. substr($s[2],0,1) .'.'; return %names; } sub clean(){ my $name = shift; $name =~s/^\'//; $name =~s/\"\"/\"/g; $name =~s/^\"//; $name =~s/\"$//; $name =~s/\ *$//g; $name =~s/\ +/\ /g; return $name; } sub firstUp(){ my $name = shift; $name = lc($name); return ucfirst($name); }
ldapadd -v -Dcn=Manager,dc=org,dc=com -wsecret < ./temp.ldif
--> --> --> LDAP--> IP: IP --> --> : ou=ab,dc=org,dc=com : ( )
attributetype ( 2.5.4.10 NAME ( 'company' 'o' 'organizationName' ) DESC 'RFC2256: organization this object belongs to' SUP name )
Source: https://habr.com/ru/post/183996/
All Articles