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 )

관련 정보