LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-15-2015, 07:35 AM   #1
lpwevers
Member
 
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 181

Rep: Reputation: 21
OpenLDAP: Cannot add posixGroup


Dear Experts,

I'm trying to setup an OpenLDAP server on OpenSuSE 13.2, which will be used for authenticating users from a whole bunch of other Linux machines.

I've managed to get OpenLDAP up and running and can add users to it. However, whenever I try to add groups things go wrong.

I've setup the initial LDAP structure using this ldif:
Code:
# digio.local
dn: dc=digio,dc=local
dc: digio
o: digio b.v.
objectClass: dcObject
objectClass: organization

# Manager, digio.local
dn: cn=Manager,dc=digio,dc=local
cn: Manager
description: LDAP administrator
objectClass: organizationalRole
objectClass: top
roleOccupant: dc=digio,dc=local

# People, digio.local
dn: ou=People,dc=digio,dc=local
ou: People
objectClass: top
objectClass: organizationalUnit

# Groups, digio.local
dn: ou=Groups,dc=digio,dc=local
ou: Groups
objectClass: top
objectClass: organizationalUnit
Then Adding a user with an ldif like this works like a charm:
Code:
dn: uid=louis,ou=People,dc=digio,dc=local
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: louis
cn: Louis Wevers
sn: Wevers
givenName: Louis
title: Yes
telephoneNumber: 1234
mobile: 1234
postalAddress: Somewhere
userPassword: {SSHA}EncryptedStuff
loginShell: /bin/bash
uidNumber: 1000
gidNumber: 1000
homeDirectory: /home/louis/
description: Louis Wevers
So for a group I try this ldif:
Code:
dn: cn=sapinst,ou=Groups,dc=digio,dc=local
objectClass: top
objectClass: posixGroup
cn: sapinst
gidNumber: 1200
And that's where things go horribly wrong:
Code:
# ldapadd -x -D "cn=Manager,dc=digio,dc=local" -f group.ldif -w <some pw>
adding new entry "cn=sapinst,ou=Groups,dc=digio,dc=local"
ldap_add: Object class violation (65)
        additional info: no structural object class provided
Google told me that I'm not the only one facing this problem, however, I've not come across an answer (at least not one that I understand). According to all these I should check in rfc2307bis.schema for the objectclass 'posixGroup' which in my case looks like this:
Code:
objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' SUP top AUXILIARY
  DESC 'Abstraction of a group of accounts'
  MUST gidNumber
  MAY ( userPassword $ memberUid $
        description ) )
I believe this to be correct, but I'm not an LDAP expert, so I'm not 100% sure.

Can anyone please help in getting this issue resolved?

Many thanks in advance,
Louis
 
Old 06-18-2015, 09:47 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I'm hardly an OpenLDAP expert, but I'm looking through my setup (which I got off a web site years ago) and my Group ou is only objectClass organizationalUnit; it does *not* have objectClass top. I'm not sure why this would mess things up for Groups but not users in your case, but it seems somewhat odd to me that you have two objects in a hierarchy both with objectClass top. You might try removing that objectClass from the parent OU and see if it helps. Then again, I might be totally barking up the wrong tree.
 
Old 12-08-2015, 12:24 PM   #3
ecp14
LQ Newbie
 
Registered: Dec 2015
Posts: 2

Rep: Reputation: Disabled
I am having the same exact problem with SUSE 10. Was this ever resolved? If so, I would love to find out how it was resolved. thanks!
 
Old 12-08-2015, 03:55 PM   #4
lpwevers
Member
 
Registered: Apr 2005
Location: The Netherlands
Distribution: SuSE, CentOS
Posts: 181

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by ecp14 View Post
I am having the same exact problem with SUSE 10. Was this ever resolved? If so, I would love to find out how it was resolved. thanks!
Well, sort of. But probably not the way you like it. I switched to SLES 11 and used the yast LDAP configuration. That solved the issue, without ever solving the original problem.

Sorry.
 
Old 12-08-2015, 04:19 PM   #5
ecp14
LQ Newbie
 
Registered: Dec 2015
Posts: 2

Rep: Reputation: Disabled
Thanks for your reply lpwevers. I was able to resolve it by removing posixGroup as the objectClass and keeping "top". Added objectClass "groupOfNames" and the member attribute for each user account that will be in the group. Also had to remove gidNumber since it does not work with groupOfNames. Will see how far this gets me. thanks again.
dn: cn=tpdstaff,ou=Group,dc=example,dc=com
#changetype: modify
objectClass: groupOfNames
#objectClass: posixGroup
objectClass: top
cn: tpdstaff
## gidNumber was not allowed
#gidNumber: 500
member: uid=tpduser0,ou=People,dc=example,dc=com
 
Old 10-15-2016, 06:57 PM   #6
udonj
LQ Newbie
 
Registered: Oct 2016
Posts: 1

Rep: Reputation: Disabled
OpenLDAP: Cannot add posixGroup (solution)

Problem :
#:/etc/openldap/schema # ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f addgroups.ldif
Enter LDAP Password:
adding new entry "cn=groupname,ou=Group,dc=example,dc=com"
ldap_add: Object class violation (65)
additional info: no structural object class provided



Short Summury of solution:
1) systemctl stop slapd.service
2) rm -rf /etc/openldap/slapd.d/*
3) change slapd.conf
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
#include /etc/openldap/schema/rfc2307bis.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
#!!! nis.schema contains correct posixGroup description with cn and gidNumber while rfc2307bis.schema does not !
#include /etc/openldap/schema/yast.schema

Look here: (from nis.schema, read MUST: )
objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup'
DESC 'Abstraction of a group of accounts'
SUP top STRUCTURAL
MUST ( cn $ gidNumber )
MAY ( userPassword $ memberUid $ description ) )

while from rfc2307bis.schema we have:

objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' SUP top AUXILIARY
DESC 'Abstraction of a group of accounts'
MUST gidNumber
MAY ( userPassword $ memberUid $
description ) )

hence one has to use nis.schema instead of rfc2307bis.schema !



4) slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/
5) systemctl restart slapd.service

6) done! use your "ldapadd -x -D …. "

P.S. very useful link:
https://wiki.archlinux.org/index.php/OpenLDAP
P.S.II i have SuSE Leap 42.2
(Linux myserver 4.4.22-1-default #1 SMP Wed Sep 28 15:13:53 UTC 2016 (32db362) x86_64 x86_64 x86_64 GNU/Linux)

Last edited by udonj; 10-15-2016 at 07:04 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a new schema to openldap 2.4.11 ? cviniciusm Linux - Server 17 10-22-2016 02:26 AM
phpldapadmin - create inetOrgPerson, posixAccount and posixGroup at the same time lqmp Linux - Newbie 1 11-06-2013 11:51 AM
[SOLVED] Centos 6.4 with OpenLDAP+TLS: OpenLDAP ok, add TLS =>not ok chrism01 Linux - Server 2 10-27-2013 03:15 PM
OpenLDAP User not add to database jitenderana Linux - Server 5 04-20-2012 10:00 AM
Add /etc/group to openldap leiw Linux - General 0 11-03-2006 03:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration