cn=schema 項目具有多值屬性 attributeTypes,此屬性含有目錄模式中各種屬性類型的定義。您可以使用 ldapmodify(1) 指令增加至這些定義。
新的屬性類型定義,以及您對使用者定義的屬性類型所做的變更,都會儲存在 99user.ldif 檔案中。
對於每個屬性類型定義,您必須至少提供一個 OID 以定義您新的屬性類型。請考慮對新的屬性類型至少使用下列元素:
屬性 OID。對應至您屬性的物件識別碼。OID 是一個可唯一識別模式物件的字串,通常為小數點十進位數字。
如需嚴格的 LDAP v3 規範遵循,則必須提供有效數值 OID。若想進一步瞭解 OID,或要為您的企業申請前綴,請將電子郵件寄至 IANA (網際網路位址指派機構) iana@iana.org,或造訪 IANA 網站。
屬性名稱。對應至屬性的唯一名稱。也稱為其屬性類型。屬性名稱必須以字母開頭,且只能包含 ASCII 字母、數字與連字符。
屬性名稱可包含大寫字母,但 LDAP 用戶端不會以大小寫分辨屬性。以區分大小寫的方式處理屬性名稱時,應遵循 RFC 4512 第 2.5 款的規定。
您可以選擇性地為屬性類型加入替代屬性名稱,亦即別名。
屬性說明。以簡短的說明性文字說明屬性的用途。
語法。供 OID 參照,用以說明屬性將包含的資料。
屬性語法及其 OID 均列載於 RFC 4517 中。
允許的值數目。屬性預設為多值屬性,但您也可以將屬性限定為單一值。
您可以使用 DSCC 執行此作業。如需相關資訊,請參閱目錄服務控制中心介面與 DSCC 線上說明。
根據 RFC 4517 中所指定的語法,備妥您的屬性類型定義。
使用 ldapmodify(1) 指令,增加您的屬性類型定義。
請注意,目錄伺服器會將 X-ORIGIN 'user defined' 增加到您所提供的定義中。
下列範例使用 ldapmodify 指令,增加使用「目錄字串」語法的新屬性類型。
$ cat blogURL.ldif dn: cn=schema changetype: modify add: attributeTypes attributeTypes: ( 1.2.3.4.5.6.7 NAME ( 'blog' 'blogURL' ) DESC 'URL to a personal weblog' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) $ ldapmodify -D cn=admin,cn=Administrators,cn=config -w - -f blogURL.ldif Enter bind password: modifying entry cn=schema $ |
在生產環境中,您必須提供有效且唯一的 OID,而非 1.2.3.4.5.6.7。