OpenLDAP が新しい属性を追加できない

OpenLDAP が新しい属性を追加できない

「性別」などの属性を持つユーザー アカウントをいくつか作成したいので、カスタム属性を作成する必要があります。

次の LDIF ファイルを作成しました:

dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( 1.2.3.4.5.6.7.8.9.0 NAME ( 'gender' ) DESC 'gender' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )

でそれを適用してみてくださいldapmodify -D cn=admin,cn=config -W -f ExtendedUser.ldif

しかし、常にこのエラーが発生します:

modifying entry "cn=schema"
ldap_modify: Invalid syntax (21)
        additional info: attributeTypes: value #0 invalid per syntax

いずれにしても、属性を使用するにはオブジェクト クラスも必要であることはわかっています。最初はオブジェクト クラス定義とその他の属性を含めてこれを試しましたが (以下を参照)、同じエラーが発生しました。

古くて、より複雑な LDIF:

dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( 1.2.3.4.5.6.7.8.9.0 NAME 'gender' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.1 NAME 'birthdate' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.2 NAME 'birthplace' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.3 NAME 'nationality' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.4 NAME 'street' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.5 NAME 'zipcode' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.6 NAME 'city' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.7 NAME 'phone' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
attributeTypes: ( 1.2.3.4.5.6.7.8.9.8 NAME 'matnr' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )

dn: cn=schema
changetype: modify
add: objectClasses
objectClasses: ( 4.5.6.7.8.9.2 NAME 'AdditionalAttrPerson' DESC 'adds user attributes' SUP inetOrgPerson STRUCTURAL MUST ( gender $ birthdate $ birthplace $ nationality $ street $ zipcode $ city $ phone $ matnr ) )

チュートリアルから構文をコピーしましたが、一致しているように見えるので、何が間違っているのかわかりません。助けてください。

デバッグ レベルを有効にして ldapmodify を実行しようとしましたが、出力は役に立たないようです。ただし、エラーを含む末尾は次のとおりです。

...
ldap_do_free_request: asked to free lr 0x561b24af5cb0 msgid 2 refcnt 0
ldap_parse_result
ber_scanf fmt ({iAA) ber:
ber_scanf fmt (}) ber:
ldap_msgfree
ldap_err2string
ldap_modify: Invalid syntax (21)
        additional info: attributeTypes: value #0 invalid per syntax

ldap_free_connection 1 1
ldap_send_unbind
ber_flush2: 7 bytes to sd 4
ldap_free_connection: actually freed

上にあるものは明らかに私とは関係ないようです。

答え1

最初はスキーマ内の他の LDIF ファイルを確認するだけでよかったのですが、私の解決策は次のとおりです。

最初の行はdn cn=myschema,cn=schema,cn=config

それ以降のものは、左側に olcAttributeTypes または olcObjectClasses があるはずですが、私の場合はそうではありませんでした。例:

dn: cn=myschema,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: myschema
olcAttributeTypes: ( 1.3.6.1.4.1.995.1.2.1 NAME 'gender'
 EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} SINGLE-VALUE )

関連情報