{"id":6099,"date":"2012-09-28T07:27:42","date_gmt":"2012-09-28T12:27:42","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=6099"},"modified":"2013-05-17T11:09:38","modified_gmt":"2013-05-17T16:09:38","slug":"ldap","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=6099","title":{"rendered":"LDAP Notes"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Overview\">Overview<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Four_Models_FINS\">Four Models (FINS)<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#LDAP_Advantages\">LDAP Advantages<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#LDAP_Disadvantages\">LDAP Disadvantages<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Object_or_Data_Model\">Object or Data Model<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Data_Information_Tree_DIT\">Data Information Tree (DIT)<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Schema\">Schema<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Entries\">Entries<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#ObjectClass\">ObjectClass<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Attribute\">Attribute<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#LDAP_Referrals\">LDAP Referrals<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#LDAP_Replication\">LDAP Replication<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Matching_Rules\">Matching Rules<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Operational_Attributes_and_Objects\">Operational Attributes and Objects<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#References\">References<\/a>\n\t<\/li>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Overview\"><h2>Overview<\/h2><\/span>\n<p>* LDAP defines a <strong>protocol<\/strong> for<br \/>\n&#8211; <em>accessing<\/em> directory data<br \/>\n&#8211; <em>representing<\/em> data in directory service<br \/>\n&#8211; <em>imp\/exp<\/em> data in directory service (ldif format)<br \/>\n* LDAP does <strong>not<\/strong> define<br \/>\n&#8211; how data is stored<br \/>\n&#8211; how data is manipulated<\/p>\n<span id=\"Four_Models_FINS\"><h3>Four Models (FINS)<\/h3><\/span>\n<p>* Functional model: how to access LDAP<br \/>\n* Information Model: how to represent information aka data (not how to store data)<br \/>\n* Naming model: for example, <em>dc=example,dc=com<\/em><br \/>\n* Security model:<\/p>\n<span id=\"\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_models.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_models-300x141.png\" alt=\"\" title=\"ldap_models\" width=\"300\" height=\"141\" class=\"aligncenter size-medium wp-image-6100\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_models-300x141.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_models.png 644w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"LDAP_Advantages\"><h3>LDAP Advantages<\/h3><\/span>\n<p>* <em>Write-once-read-many-times<\/em><br \/>\n* <em>Standardized<\/em> method for local as well as remote ldap access<br \/>\n&#8211; Data can be delegated to multiple locations<br \/>\n* Can be configured to replicate data (like DNS)<\/p>\n<span id=\"LDAP_Disadvantages\"><h3>LDAP Disadvantages<\/h3><\/span>\n<p>* Updates are expensive (due to indexing)<br \/>\n* Not for transaction activities (may contain data inconsistencies)<\/p>\n<span id=\"Object_or_Data_Model\"><h2>Object or Data Model<\/h2><\/span>\n<span id=\"Data_Information_Tree_DIT\"><h3>Data Information Tree (DIT)<\/h3><\/span>\n<p>* LDAP represents data as a hierarchy of objects, like a tree:<br \/>\n&#8211; has a <em>root<\/em><br \/>\n&#8211; has branches (<em>entries<\/em>)<br \/>\n&#8211; has leaves (<em>objectClasses<\/em>)<br \/>\n&#8211; each leave (i.e. objectClass) has cells (<em>attributes<\/em>)<br \/>\n&#8211; cell (i.e. attribute) is where data is stored<\/p>\n<span id=\"_1\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_dit.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_dit-300x228.png\" alt=\"\" title=\"ldap_dit\" width=\"300\" height=\"228\" class=\"aligncenter size-medium wp-image-6101\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_dit-300x228.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_dit.png 446w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Schema\"><h3>Schema<\/h3><\/span>\n<p>* Convenient packaging unit for a group of objectClasses and attributes<br \/>\n* Think of it as different type of trees such as oak tree, willow tree, fir tree, etc.<\/p>\n<span id=\"Entries\"><h3>Entries<\/h3><\/span>\n<p>* Must contain one, and only one, STRUCTURAL objectClass<br \/>\n* May contain one ABSTRACT objectClass<br \/>\n* May contain any number of AUXILIARY objectClasses<br \/>\n* May have parent, and\/or child, and\/or sibling entries<\/p>\n<span id=\"_2\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_entries.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_entries-300x152.png\" alt=\"\" title=\"ldap_entries\" width=\"300\" height=\"152\" class=\"aligncenter size-medium wp-image-6150\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_entries-300x152.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_entries.png 550w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"ObjectClass\"><h3>ObjectClass<\/h3><\/span>\n<p>* Used as a container for attributes<br \/>\n* Has a OID<br \/>\n* Has a <em>name<\/em><br \/>\n* Is searchable<br \/>\n* Defines if an attribute is <em>optional<\/em> or <em>mandatory<\/em><br \/>\n* Can be part of hierarchy:<br \/>\n&#8211; the whole hierarchy must be of the same type, i.e. STRUCTURAL or AUXILIARY<br \/>\n&#8211; inherits <em>all<\/em> characteristics of its parent ObjectClasses<\/p>\n<pre lang=\"bash\">\r\nObjectClassDescription = \"(\" whsp\r\n  numericoid whsp      ; ObjectClass identifier\r\n  [ \"NAME\" qdescrs ]\r\n  [ \"DESC\" qdstring ]\r\n  [ \"OBSOLETE\" whsp ]\r\n  [ \"SUP\" oids ]       ; Superior ObjectClasses\r\n  [ ( \"ABSTRACT\" \/ \"STRUCTURAL\" \/ \"AUXILIARY\" ) whsp ]\r\n\t\t\t\t\t   ; default structural\r\n  [ \"MUST\" oids ]      ; AttributeTypes\r\n  [ \"MAY\" oids ]       ; AttributeTypes\r\nwhsp \")\"\r\n<\/pre>\n<span id=\"Attribute\"><h3>Attribute<\/h3><\/span>\n<p>* Has a OID<br \/>\n* Has a <em>name<\/em><br \/>\n* Is searchable<br \/>\n* May be part of hierarchy<br \/>\n&#8211; inherits <strong>all<\/strong> properties of its parent<strong>s<\/strong><br \/>\n* Can have aliases or abbreviations, e.g. <em>cn<\/em> for <em>commomName<\/em><br \/>\n* Usually contains data<br \/>\n&#8211; has a data type<br \/>\n&#8211; defaults to allow multiple values<br \/>\n* Always associated with <strong>one or more<\/strong> ObjectClasses<br \/>\n* Can be either optional or mandatory for associated ObjectClass<br \/>\n* No primary key, one or more attributes are used to identity a unique entry. Like database combination keys and are called <em>naming attributes<\/em> or <em>relative distinguished name (RDN)<\/em> in LDAP.<\/p>\n<pre lang=\"bash\">\r\nAttributeTypeDescription = \"(\" whsp\r\n    numericoid whsp              ; AttributeType identifier\r\n  [ \"NAME\" qdescrs ]             ; name used in AttributeType\r\n  [ \"DESC\" qdstring ]            ; description\r\n  [ \"OBSOLETE\" whsp ]\r\n  [ \"SUP\" woid ]                 ; derived from this other\r\n\t\t\t\t ; AttributeType\r\n  [ \"EQUALITY\" woid              ; Matching Rule name\r\n  [ \"ORDERING\" woid              ; Matching Rule name\r\n  [ \"SUBSTR\" woid ]              ; Matching Rule name\r\n  [ \"SYNTAX\" whsp noidlen whsp ] ; see section 4.3\r\n  [ \"SINGLE-VALUE\" whsp ]        ; default multi-valued\r\n  [ \"COLLECTIVE\" whsp ]          ; default not collective\r\n  [ \"NO-USER-MODIFICATION\" whsp ]; default user modifiable\r\n  [ \"USAGE\" whsp AttributeUsage ]; default userApplications\r\n  whsp \")\"\r\n<\/pre>\n<span id=\"LDAP_Referrals\"><h3>LDAP Referrals<\/h3><\/span>\n<p>* Similar to DNS referrals in concept<br \/>\n* No server auto referrals defined in standards<br \/>\n&#8211; Some vendors, e.g. OpenLDAP, use <em>chaining<\/em> for auto referrals<br \/>\n* Referrals are returned to client instead<\/p>\n<span id=\"_3\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_referrals.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_referrals-300x247.png\" alt=\"\" title=\"ldap_referrals\" width=\"300\" height=\"247\" class=\"aligncenter size-medium wp-image-6106\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_referrals-300x247.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_referrals.png 454w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"LDAP_Replication\"><h3>LDAP Replication<\/h3><\/span>\n<p>* Built in replication to allow one or more copies of <strong>DIT<\/strong> (not whole LDAP) to be slaved from a single master<br \/>\n* Takes time to replicate (potential data inconsistencies)<br \/>\n* Master-Slave replication:<br \/>\n&#8211; slaves are read only copies of the master<br \/>\n&#8211; master server is single point of failure<br \/>\n* Multi-Master replication:<br \/>\n&#8211; Data contentions: value contention and delete convention<br \/>\n* Example replication configurations:<\/p>\n<span id=\"_4\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_replications.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_replications-300x212.png\" alt=\"\" title=\"ldap_replications\" width=\"300\" height=\"212\" class=\"aligncenter size-medium wp-image-6107\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_replications-300x212.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_replications.png 604w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Matching_Rules\"><h2>Matching Rules<\/h2><\/span>\n<p>* Part of LDAP operational<br \/>\n* Typicall built-in to the LDAP server and defined in subschema<br \/>\n* A matching rule is defined for <strong>each<\/strong> attribute using<br \/>\n&#8211; EQUALITY<br \/>\n&#8211; SUBST<br \/>\n&#8211; ORDERING<\/p>\n<span id=\"Operational_Attributes_and_Objects\"><h2>Operational Attributes and Objects<\/h2><\/span>\n<p>* Build in attributes and objectClasses<br \/>\n* Governs how LDAP server functions<br \/>\n* Live under rootDSE<br \/>\n* Not visible during normal operations<\/p>\n<span id=\"_5\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_opertional_attrs.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_opertional_attrs-300x196.png\" alt=\"\" title=\"ldap_opertional_attrs\" width=\"300\" height=\"196\" class=\"aligncenter size-medium wp-image-6151\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_opertional_attrs-300x196.png 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/09\/ldap_opertional_attrs.png 397w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<p>* From ldapsearch:<\/p>\n<pre lang=\"bash\">\r\n# note the + returns operational attributes\r\nldapsearch -h localhost -p 1389 -x -s base -b \"\" +\r\n<\/pre>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <a href=\"http:\/\/www.zytrax.com\/books\/ldap\/\">LDAP for Rocket Scientists<\/a><br \/>\n* <a href=\"http:\/\/www.openldap.org\/devel\/admin\/glossary.html\">OpenLDAP Glossary<\/a><br \/>\n* <a href=\"http:\/\/tools.ietf.org\/html\/rfc2252\">RFC 2252<\/a>: Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview * LDAP defines a protocol for &#8211; accessing directory data &#8211; representing data in directory service &#8211; imp\/exp data in directory service (ldif format) * LDAP does not define &#8211; how data is stored &#8211; how data is manipulated &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=6099\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[34],"tags":[566],"class_list":["post-6099","post","type-post","status-publish","format-standard","hentry","category-ldap","tag-ldap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/s8cRUO-ldap","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6099"}],"version-history":[{"count":9,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6099\/revisions"}],"predecessor-version":[{"id":6105,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6099\/revisions\/6105"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}