OpenLDAP configuration using posixGroup and groupOfNames - openldap

My requirement is to add the posixGroup and groupofNames object class together which add LDAP group using LDIF. Since both class are STRUCTURAL and cannot be added.
To achieve this, I used the link where they mentioned to create a customPosixGroup.
https://devopsideas.com/openldap-linux-client-ldap-integration/
Steps they mentioned in the link is
Overcoming posixGroup and groupOfNames caveat
We will be creating server group objects of type posixGroup under ou=server container. The posixgroup is required to provide the translation between group id numbers and their name. We’ll be providing access to servers based on membership of the groups. posixGroup’s member attribute is called memberUID and simply lists the uid of the member. Using this alone, there’s really no solid way to identify the specific distinguished name of the group member.
The problem we have is, memberOf attribute is part of groupOfNames objectClass. We cannot use both posixGroup and groupOfNames together since both are STRUCTURAL objectClasses ( An entry can have only one STRUCTURAL object class ).
To overcome this, we need to create a custom objectClass that will be a clone of posixGroup but of type AUXILIARY instead of STRUCTURAL. Hence we will be able to use groupOfNames along with the custom posixGroup which is almost identical to posixGroup except the class type.
The posixGroup exists in nis schema and hence we’ll make the change there.
Create a file named schema_update.ldif with the below content
dn: cn={2}nis,cn=schema,cn=config
changetype: modify
add: olcObjectClasses
olcObjectClasses: {13}( 1.3.6.1.1.1.2.13 NAME 'customposixGroup' DESC 'Abstraction of a group of accounts' AUXILIARY MUST ( cn $ gidNumber ) MAY ( userPassword $ memberUid $ description $ member ) )
{2} denotes the order. You can refer ‘/etc/ldap/slapd.d/cn\=config/cn\=schema’ to get this.
We have named the custom group as customposixGroup. This contains all the attributes that are part of posixGroup except the class type marked as ‘AUXILIARY’.
Run the below command to make the changes,
ldapmodify -W -D cn=admin,cn=config -f schema_update.ldif
I followed the steps and added the customposixGroup and after that added the group as
dn: cn=server_dev,ou=graylog,ou=rgroup,dc=rad,dc=com
objectclass: customposixGroup
objectclass: groupOfNames
cn: server_dev
gidNumber: 7000
description: Server Dev Group
member: uid=aron.francis,ou=People,dc=rad,dc=com
Then, On my Linux client side is sssd which I have configured but if I query using the id command.
Here the group name is not getting displayed.
I wanted help on why the group name is not getting displayed when I use the id
command from the LDAP client.
But if I use posixGroup instead of customPosixGroup and not groupOfName object class then the group
name is getting displayed
I am trying to configure the Openldap server setup but I am stuck at the above mentioned point. I need help on that and also wanted to know if I have been doing any wrong configuration. If you need more info kindly reply so that I can provide that.

There's an option in sssd config, that tells which group to check out (default value is posixGroup [https://linux.die.net/man/5/sssd-ldap]):
ldap_group_object_class = customposixGroup
After adding the option, restart sssd and clear cache using sss_cache -E.
Hope it helps

Instead of patching your nis.schema try using the rfc2307bis.schema. It already has an aux posixGroup.

Related

OpenLDAP Custom Attribute: "Undefined attribute type"

Attempting to add a new attribute to OpenLDAP and keep hitting brick walls.
I am trying to add an ipPhone attribute to the schema since I can't include * numbers in the default telephoneNumber attribute.
My LDIF file used to create the new attribute and like it to the objectClass is below.
dn: cn=schema,cn=config
changetype: modify
add: olcAttributeTypes
olcAttributeTypes: ( 2.25.128424792425578037463837247958458780603.1
NAME 'ipPhone'
DESC 'Extension Number'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
-
add: olcObjectClasses
olcObjectClasses: ( 2.25.128424792425578037463837247958458780603.3
NAME 'samplePerson'
DESC 'samplePerson'
SUP inetOrgPerson
STRUCTURAL
MAY (ipPhone)
)
To apply the above, I used:
ldapmodify -Y EXTERNAL -H ldapi:/// -f attrib.ldif
I can see the added config in:
/etc/ldap/slapd.d/cn=config/cn=schema.ldif
However, after restarting slapd and attempting to add a new user with this attribute, I return the error:
ldap.UNDEFINED_TYPE: {'info': u'ipPhone: attribute type undefined', 'desc': u'Undefined attribute type'}
I have been testing and googling for hours but have been unable to resolve this or figure out what I have missed!
Turns out I didn't have the objectClass assigned to the users.

How can you view what roots are available in a Unix LDAP database?

I'm trying to view all root names on a server that are available for searching thru/modifying. I've tried looking online-but I'm still unable to find the base levels.
ldapsearch -b "o=blah.com" -p 1111 "objectclass=*" returns everything in that blah.com due to the filter being all object classes.
Is there a similar function to be able to find all o=*? I need to able to search thru each of those directories and modify things at some point...and without knowing what's in there, i'm sort of at the mercy of the other developers....
If the question is "How to get valid top-level base dn(s) ?", you have multiple options :
Domain components (dc) usually match the FQDN, it makes sense to use these dc's to build up a top level base dn (e.g. 'host.example.com' would give 'dc=example,dc=com'), but it is not guaranteed it results in a valid base dn.
Search for rootDSE information :ldapsearch -H ldap://host.example.com -x -s base -b '' +
Then retrieve the namingContexts or defaultNamingContext attribute(s), any one of them can be used as a search base dn.
Use an LDAP explorer like Apache Directory Studio to display the directory tree, select a top object matching objectClass: dcObject (and optionnally o=something) : any corresponding entry can be used as a search base object by using its dn as the base dn.

OpenLDAP, how to extend system schema

how can I extend system schema in openLDAP?
I have to migrate from OID(oracle internet directory) to openLDAP and I want to keep oracle specific attributes such orclaci. To be able to do so, I need to make top class know these attributes.
Thank's a lot in advance
OpenLDAP contains a set of default schemas in it's distribution (see etc/openldap/schema), so you can edit or even replace any schema as you want.
I don't know OID specific, but guess that attributes like orclaci should be in separate schemas; in this case you should register that OID schema file(s) in your OpenLDAP to make it know specific attributes.

Searching a DICOM server for metadata

I want to search the DICOM server. if for example user enters a patient id to serach, then my app populate a table with all the metadata relating to that id , such as id, name, accession number e.tc. if tha study id exists in the dicom server, How can this be done using dcm4chee kit. –
You can use dcm4che3 tool dcm4che-tool-findscu. This code shows you how to do a C-FIND against a PACS (or whatever implementing C-FIND as SCP).
FindSCU.java is quite clear, take a while and don't get missed through Apache Commons CLI code to understand input from console. Most of CLI management code is not in this project, but you can find it in the dcm4che3 tool dcm4che-tool-common project, org.dcm4che3.tool.common.CLIUtils.java class.
Take into account following considerations:
Specify the search level of Query/Retrieve. You can use several search levels in order to match attributes into a PACS. If you look at lines 260:265 of FindSCU.java, you will see that you can manage four different levels: PATIENT|STUDY|SERIES|IMAGE.This will instruct C-FIND SCP how to search matching attributes.
Tell C-FIND SCP what attributes do you want to retrieve. If you want to search studies to be retrieved later, you must ask for 0020, 000D Study​InstanceUID tag.
Of course, add all attributes that you want to populate your table.
Use retrieved 0020, 000D Study​InstanceUID tag value to do the C-GET/C-MOVE operation.
You can see how to configure attribute keys to do C-FIND SCU into CLIUtils.java class that is part of dcm4che3 tool dcm4che-tool-common project. See CLIUtils.addAttributes(Attributes, String[]).
Hope it helps!
Edit
Due to you comment you are using dcm4che2 and that you already have a DicomObject with the search result, if you want to obtain metadata from this DicomObject you must parse it before, using DicomInputStream, and then you can use getXXXX(Tag) from BasiDicomObject, something like this:
DicomObject dcmObj;
DicomInputStream dis = null;
dis = new DicomInputStream(file);
dcmObj = dis.readDicomObject();
String someVar = dcmObj.getString(Tag.SeriesInstanceUID);
Keep in mind, some attributes are inside sequences, and thus you have to search it before.
You can also take a look into dcm4che-tool-dcm2txt, you will see Dcm2Txt.java and in lines 170 and so on, there is how to parse whole dicom object.
If you need some general description about the DICOM network protocol, you could read the "Understanding DICOM with Orthanc" guide, and more specifically the section about C-Find.

Add an alias to a schema object in OpenLdap

Is it possible to add an alias to a schema atrribute type in openldap? Could anyone provide the command line instruction to accomplish this?
For example,
Description RFC2256: Telephone Number
OID 2.5.4.20
Obsolete No
Inherits from
Equality telephoneNumberMatch
Ordering (not specified)
Substring Rule telephoneNumberSubstringsMatch
Syntax Telephone Number (1.3.6.1.4.1.1466.115.121.1.50)
Single Valued No
Collective No
User Modification Yes
Usage (not specified)
Maximum Length 32 characters
Aliases (none)
Used by objectClasses dmd documentSeries domain organization organizationalPerson organizationalRole organizationalUnit person residentialPerson RFC822localPart room
Force as MAY by config No
I want to update the Aliases from none to "Test1"
You need to locate the scheme entry in one of the files in the schemas directory and add the alias there. You'll find other examples in those files of what an alias looks like. Then just restart the server.

Resources