<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Valentin's Lab &#187; openldap</title>
	<atom:link href="https://vaab.blog.kal.fr/tag/openldap/feed/" rel="self" type="application/rss+xml" />
	<link>https://vaab.blog.kal.fr</link>
	<description>Ratiocination of an opensource techie</description>
	<lastBuildDate>Thu, 15 Nov 2018 08:04:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=vaab&amp;popout=1&amp;url=https%3A%2F%2Fvaab.blog.kal.fr%2F&amp;language=en_US&amp;category=text&amp;title=Valentin%27s+Lab&amp;description=Ratiocination+of+an+opensource+techie&amp;tags=blog" type="text/html" />
	<item>
		<title>inconsistent duplicate attribute mailhost</title>
		<link>https://vaab.blog.kal.fr/2011/04/10/inconsistent-duplicate-attribute-mailhost/</link>
		<comments>https://vaab.blog.kal.fr/2011/04/10/inconsistent-duplicate-attribute-mailhost/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 22:08:04 +0000</pubDate>
		<dc:creator><![CDATA[vaab]]></dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[schema]]></category>

		<guid isPermaLink="false">http://vaab.blog.kal.fr/?p=102</guid>
		<description><![CDATA[Adding a new schema in LDAP can give you headache. I've the cure for this one: Inconsistent duplicate attributeType: "mailHost" This is due to a new misc.schema that is now default in Ubuntu Lucid at least (and maybe other distribution) &#8230;<p class="read-more"><a href="https://vaab.blog.kal.fr/2011/04/10/inconsistent-duplicate-attribute-mailhost/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>Adding a new schema in LDAP can give you headache. I've the cure for this one:</p>
<pre>
Inconsistent duplicate attributeType: "mailHost"
</pre>
<p>This is due to a new <em>misc.schema</em> that is now default in Ubuntu Lucid at least (and maybe other distribution) and defines a <em>mailhost</em> attribute.</p>
<p>You'll encounter this error when trying to add another schema defining this same attribute. I have a <a href="http://mds.mandriva.org/svn/mmc-projects/mmc-core/trunk/agent/contrib/ldap/mail.schema">mail.schema</a> comming from <a href="http://mds.mandriva.org/">Mandriva Directory Server</a>, which tries to do so. And a small google reveals that <a href="http://www.openldap.org/lists/openldap-software/200608/msg00175.html">qmail.schema</a> has similar problem.</p>
<p>2 solutions:</p>
<ul>
<li>Either remove the attribute from your new schema by deleting the attribute entry in the schema file and remove any reference to mailhost anywhere it appears in the file. I wouldn't recommend this.</li>
<li>Either remove the <em>misc.schema</em> from your ldap server. Cross fingers that it isn't used too much ;)</li>
</ul>
<p>Et voilà !</p>
 <p><a href="https://vaab.blog.kal.fr/?flattrss_redirect&amp;id=102&amp;md5=31b66c287e90d6d49ad1768a6f05f9e3" title="Flattr" target="_blank"><img src="https://vaab.blog.kal.fr/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>https://vaab.blog.kal.fr/2011/04/10/inconsistent-duplicate-attribute-mailhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=vaab&amp;popout=1&amp;url=https%3A%2F%2Fvaab.blog.kal.fr%2F2011%2F04%2F10%2Finconsistent-duplicate-attribute-mailhost%2F&amp;language=en_GB&amp;category=text&amp;title=inconsistent+duplicate+attribute+mailhost&amp;description=Adding+a+new+schema+in+LDAP+can+give+you+headache.+I%27ve+the+cure+for+this+one%3A+Inconsistent+duplicate+attributeType%3A+%22mailHost%22+This+is+due+to+a+new+misc.schema+that+is+now...&amp;tags=openldap%2Cschema%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Import / Export ldap database</title>
		<link>https://vaab.blog.kal.fr/2010/03/10/import-export-ldap-database/</link>
		<comments>https://vaab.blog.kal.fr/2010/03/10/import-export-ldap-database/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 08:22:52 +0000</pubDate>
		<dc:creator><![CDATA[vaab]]></dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[openldap]]></category>

		<guid isPermaLink="false">http://vaab.blog.kal.fr/?p=38</guid>
		<description><![CDATA[Importing data to LDAP server didn't sound obvious for me, so here's how to import / export ldap database. This is usefull if you want to migrate your LDAP database from one server to another. Export Export seems quite easy &#8230;<p class="read-more"><a href="https://vaab.blog.kal.fr/2010/03/10/import-export-ldap-database/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[
<div class="document">


<!-- -*- mode: rst -*- -->
<p>Importing data to LDAP server didn't sound obvious for me, so here's how to import / export ldap database. This is usefull if you want to migrate your LDAP database from one server to another.</p>
<div class="section" id="export">
<h3>Export</h3>
<p>Export seems quite easy and well-known:</p>
<pre class="literal-block">
# slapcat
</pre>
<p>This will dump (if run as <tt class="docutils literal">root</tt> user) the complete ldap database information on <tt class="docutils literal">stdout</tt>.</p>
<p>You can use this command to make backups of your <tt class="docutils literal">OpenLDAP</tt> database, for example:</p>
<pre class="literal-block">
# slapcat | bzip2 &gt; mybase.ldif.bz2
</pre>
<p>This solution is not optimum because of the existence of structural attributes in the slapcat dump.</p>
<div class="section" id="structural-attributes">
<h4>Structural Attributes</h4>
<p><tt class="docutils literal">slapcat</tt> output contains all the LDAP database including some structural information as values associated to attribute <tt class="docutils literal">modifyTimestamp</tt>, <tt class="docutils literal">createTimestamp</tt>, <tt class="docutils literal">creatorsName</tt> (and so on ...). These are set automatically by the ldap subsystem when you add/modify info in the ldap database, and thus cannot be set directly. These are similar to meta information stored by filesystems for each files (user, group, permissions, date of creation ...).</p>
</div>
<div class="section" id="stripping-structural-attributes">
<h4>Stripping structural attributes</h4>
<p>Applying output of a <tt class="docutils literal">slapcat</tt> output directly to <tt class="docutils literal">ldapadd</tt> will issue this error message (as of openldap 2.4.15):</p>
<pre class="literal-block">
# cat mybase.ldif | ldapadd -D cn=admin,dc=example,dc=org -W
Enter LDAP Password:
adding new entry &quot;dc=example,dc=org&quot;
ldap_add: Constraint violation (19)
additional info: structuralObjectClass: no user modification allowed
</pre>
<p>This error message simply states that the attribute <tt class="docutils literal">structuralObjectClass</tt> is not to be modified by any user (even administrator).</p>
<p>These structural information do not carry any information you've stored in the LDAP, so they can be stripped away without any second thought.</p>
<p>Here's how to create a dump stripped out from its structural information:</p>
<pre class="literal-block">
slapcat |
    egrep -v  &quot;^(structuralObjectClass|entryUUID|creatorsName|modifiersName|createTimestamp|modifyTimestamp|entryCSN):&quot; |
    bzip2 &gt; mybase.ldif.bz2
</pre>
<p>Note: this <tt class="docutils literal">egrep</tt> filter works because all stripped entries are one-liners.</p>
</div>
</div>
<div class="section" id="import">
<h3>Import</h3>
<p>Once stripped, the import is quite simple:</p>
<pre class="literal-block">
# cat mybase.ldif | \
    ldapadd -D cn=admin,dc=example,dc=org -W
</pre>
</div>
<div class="section" id="deleting-duplicates">
<h3>Deleting duplicates</h3>
<p>If you have already some entries, you might end up with this error message when trying to import data with the previous command:</p>
<pre class="literal-block">
adding new entry &quot;dc=example,dc=org&quot;
ldap_add: Already exists (68)
</pre>
<p>You might want to overwrite all existing data with the imported values. You should probably think about removing all previous data with:</p>
<pre class="literal-block">
# ldapdelete -r -D cn=admin,dc=example,dc=org dc=example,dc=org -W
</pre>
<p>This should recursively (thanks to the <tt class="docutils literal"><span class="pre">-r</span></tt> option) delete all entries in <tt class="docutils literal">dc=example,dc=org</tt>.</p>
<p>That's all you should need to know to import your ldap database.</p>
</div>
</div>
 <p><a href="https://vaab.blog.kal.fr/?flattrss_redirect&amp;id=38&amp;md5=a88086809840a2a8e5a0b5702d6e35ea" title="Flattr" target="_blank"><img src="https://vaab.blog.kal.fr/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>https://vaab.blog.kal.fr/2010/03/10/import-export-ldap-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=vaab&amp;popout=1&amp;url=https%3A%2F%2Fvaab.blog.kal.fr%2F2010%2F03%2F10%2Fimport-export-ldap-database%2F&amp;language=en_GB&amp;category=text&amp;title=Import+%2F+Export+ldap+database&amp;description=Importing+data+to+LDAP+server+didn%27t+sound+obvious+for+me%2C+so+here%27s+how+to+import+%2F+export+ldap+database.+This+is+usefull+if+you+want+to+migrate+your+LDAP+database...&amp;tags=openldap%2Cblog" type="text/html" />
	</item>
		<item>
		<title>How to add a schema in OpenLDAP 2.4</title>
		<link>https://vaab.blog.kal.fr/2010/03/06/how-to-add-a-schema-in-openldap-24/</link>
		<comments>https://vaab.blog.kal.fr/2010/03/06/how-to-add-a-schema-in-openldap-24/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 17:23:49 +0000</pubDate>
		<dc:creator><![CDATA[vaab]]></dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://vaab.blog.kal.fr/?p=34</guid>
		<description><![CDATA[In version prior to 2.4, administrators were used to configure slapd through its /etc/ldap/slapd.conf. That was good ol' time. Since version 2.4, slapd configuration is stored right in itself !. This may sound as a good idea, but is really &#8230;<p class="read-more"><a href="https://vaab.blog.kal.fr/2010/03/06/how-to-add-a-schema-in-openldap-24/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[
<div class="document">


<!-- -*- mode: rst -*- -->
<p>In version prior to 2.4, administrators were used to configure
<tt class="docutils literal">slapd</tt> through its <tt class="docutils literal">/etc/ldap/slapd.conf</tt>. That was good ol'
time.</p>
<p>Since version 2.4, <tt class="docutils literal">slapd</tt> configuration is stored right in
itself !. This may sound as a good idea, but is really
unpractical: administrators needs to really master LDAP now to
configure <tt class="docutils literal">slapd</tt>: use
<tt class="docutils literal">ldapmodify</tt>/<tt class="docutils literal">ldapsearch</tt>/<tt class="docutils literal">ldapadd</tt>, or delve into some
<a class="reference external" href="http://en.wikipedia.org/wiki/LDAP_Data_Interchange_Format">LDIF</a> files. Also, simple tasks (as adding a schema definition
to the server) are now quite tedious. Although the complete
configuration is accessible as <tt class="docutils literal">ldif</tt> files, I concider
<tt class="docutils literal">ldif</tt> file format as <tt class="docutils literal">XML</tt>: it's way too verbose and tedious
to read and be maintained by a human being. And above all, it's
yet another language to master.</p>
<p>In last Ubuntu as of 2010-03-06, this change was not correctly reported in LDAP
servers documentation. These are 2 bug reports on this issue:
<a class="reference external" href="https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/463684">Bug #463684</a>, <a class="reference external" href="https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/442498">Bug #442498</a>. A quick glance to these bug
reports will show you that this changement is a great source of
distress for a lot of casual administrators (as I am).</p>
<p>The <a class="reference external" href="http://doc.ubuntu.com/ubuntu/serverguide/C/openldap-server.html">last documentation from Ubuntu</a> has not explained the changes and is not that clear.</p>
<p><em>EDIT</em> (2012-01-05): the last link have now some valuable information despite the fact that it seems not anymore maintained. I would rather hint towards the <a class="reference external" href="https://help.ubuntu.com/community/OpenLDAPServer">community help site page on OpenLDAP</a> of ubuntu, which seems a natural and well documented point to get information.</p>
<div class="section" id="what-is-the-reason-behind-this-change">
<h3>What is the reason behind this change ?</h3>
<p>First, openldap changed it's default way to store configuration
files. The idea is simple: The configuration is stored in a
SEPARATE ldap database identified by the prefix &quot;cn=config&quot;. And
you'll be able to declare separate databases with different
credentials, or backend (<tt class="docutils literal">bdb</tt> or <tt class="docutils literal">hdb</tt> for instance).</p>
<p>With this new way of using the configuration, you can make
changes to configuration without restarting <tt class="docutils literal">slapd</tt>.</p>
<p><a class="reference external" href="https://lists.ubuntu.com/archives/ubuntu-server/2009-August/003182.html">This thread post</a> is quite clear on what is going at Ubuntu around OpenLDAP.</p>
</div>
<div class="section" id="how-to-use-the-config-database">
<h3>How to use the config database ?</h3>
<p>The configuration database does not need any password for root
system user on local connection. You can see its content with
<tt class="docutils literal">ldapsearch</tt> this way:</p>
<pre class="literal-block">
sudo ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config
</pre>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">if you are on ubuntu, ldapsearch is available in
<tt class="docutils literal"><span class="pre">ldap-utils</span></tt> package.</p>
</div>
<dl class="docutils">
<dt>This database contains roughly:</dt>
<dd><ul class="first last simple">
<li>some basic slapd daemon configuration parameters (pid file, loglevel ...)</li>
<li>loaded schemas</li>
<li>and databases configuration</li>
</ul>
</dd>
</dl>
<p>To make addition to this database you'll need to inject <tt class="docutils literal">ldif</tt>
files for example through <tt class="docutils literal">ldapadd</tt>:</p>
<pre class="literal-block">
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f file.ldif
</pre>
<p>Or, better, use tool like <a class="reference external" href="http://www.lichteblau.com/ldapvi/">ldapvi</a></p>
<pre class="literal-block">
sudo ldapvi -h ldapi:/// -D cn=config -Y EXTERNAL -b cn=config
</pre>
<dl class="docutils">
<dt>You'll need to make additions/modifications to this database to:</dt>
<dd><ul class="first last simple">
<li>add new schemas</li>
<li>add new databases (and you'll require to create at least one database)</li>
<li>add indexes to databases</li>
<li>modify LogLevel</li>
<li>...</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="how-to-add-a-new-schema">
<h3>How to add a new schema ?</h3>
<p>This is the common way to add a schema:</p>
<pre class="literal-block">
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
</pre>
</div>
<div class="section" id="how-to-add-a-new-database">
<h3>How to add a new database ?</h3>
<p>The following method will require that <tt class="docutils literal">nis</tt> schema was loaded as it defines rule
on the <tt class="docutils literal">shadowLastChange</tt> attribute that is defined in this schema.</p>
<p>Then copy-paste this code into a ldif file <tt class="docutils literal">/tmp/database.ldif</tt>:</p>
<pre class="literal-block">
# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb

# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=example,dc=com
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=example,dc=com
olcRootPW: secret
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn=&quot;cn=admin,dc=example,dc=com&quot; write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base=&quot;&quot; by * read
olcAccess: to * by dn=&quot;cn=admin,dc=example,dc=com&quot; write by * read
</pre>
<dl class="docutils">
<dt>You should change:</dt>
<dd><ul class="first last simple">
<li><tt class="docutils literal">dc=example,dc=com</tt> with your own prefix</li>
<li>'secret' value of <tt class="docutils literal">olcRootPW</tt> should be updated by your password.</li>
</ul>
</dd>
</dl>
<p><em>EDIT (2012-01-05):</em> You will have to remove the first part about loading the <tt class="docutils literal">hdb</tt> module if you are in recent ubuntu installation, as it is already loaded, and will trigger a fatal error preventing the following <tt class="docutils literal">ldapadd</tt> command to work as expected.</p>
<p><em>EDIT (2013-12-30):</em> An existing database was created by ubuntu before installation and can spew very annoying error message and block <tt class="docutils literal">slapcat</tt>. Unfortunately, you can't delete it with <tt class="docutils literal">ldapvi</tt>. The best way I found was to stop <tt class="docutils literal">slapd</tt>, then <tt class="docutils literal">cd /etc/ldap/slapd.d/cn=config</tt>, remove <tt class="docutils literal"><span class="pre">olcDatabase={1}hdb.ldif</span></tt> file, and relaunch <tt class="docutils literal">slapd</tt>. Please check that content of the file removed is the one mentionning <tt class="docutils literal">nodomain</tt>.</p>
<p>Once you've created this file, you can add your new database with:</p>
<pre class="literal-block">
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /tmp/database.ldif
</pre>
<p>You can then remove <tt class="docutils literal">/tmp/database.ldif</tt>.</p>
<p>Notice that <tt class="docutils literal">slapcat</tt> should work only after having configured
a database. Without any database you'll get this error:</p>
<pre class="literal-block">
$ slapcat
Available database(s) do not allow slapcat
</pre>
<p>Because <tt class="docutils literal">cn=config</tt> database doesn't allow <tt class="docutils literal">slapcat</tt> and no
other database has been configured.</p>
</div>
</div>
 <p><a href="https://vaab.blog.kal.fr/?flattrss_redirect&amp;id=34&amp;md5=82e433160894aa833db9a0e550502ed0" title="Flattr" target="_blank"><img src="https://vaab.blog.kal.fr/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>https://vaab.blog.kal.fr/2010/03/06/how-to-add-a-schema-in-openldap-24/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=vaab&amp;popout=1&amp;url=https%3A%2F%2Fvaab.blog.kal.fr%2F2010%2F03%2F06%2Fhow-to-add-a-schema-in-openldap-24%2F&amp;language=en_GB&amp;category=text&amp;title=How+to+add+a+schema+in+OpenLDAP+2.4&amp;description=In+version+prior+to+2.4%2C+administrators+were+used+to+configure+slapd+through+its+%2Fetc%2Fldap%2Fslapd.conf.+That+was+good+ol%27+time.+Since+version+2.4%2C+slapd+configuration+is+stored+right+in+itself+%21....&amp;tags=openldap%2Cubuntu%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>
