Issue 5356 - Catching index ownership errors
Summary: Catching index ownership errors
Status: VERIFIED WONTFIX
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.7
Hardware: All All
: --- enhancement
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-07 06:22 UTC by rra@debian.org
Modified: 2023-10-09 17:02 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description rra@debian.org 2008-02-07 06:22:11 UTC
Full_Name: Russ Allbery
Version: 2.4.7
OS: Debian GNU/Linux
URL: 
Submission from: (NULL) (171.66.157.16)


One of the most common problems we see in Debian with people new to OpenLDAP is
that they run slapindex as root when they're running their directory server as a
non-root user and hence break the file ownership and the database.

Would it be possible to add a check in slapindex where, if slapindex is running
as root and the database files are owned by a different user, it would either
refuse to run (possibly overideable by a flag) or at least print a warning
saying that ownership may have to be fixed later?

One possible problem, I know, is that the names of the database files are a
matter for the database backend and slapindex really shouldn't know what they
are.  But maybe the check could somehow be added to back-bdb and back-hdb and
exposed for slapindex to use?

Comment 1 Hallvard Furuseth 2008-02-07 12:54:50 UTC
moved from Incoming to Software Enhancements
Comment 2 Buchan Milne 2008-02-07 14:16:34 UTC
On Thursday 07 February 2008 08:22:12 rra@stanford.edu wrote:
> One of the most common problems we see in Debian with people new to
> OpenLDAP is that they run slapindex as root when they're running their
> directory server as a non-root user and hence break the file ownership and
> the database.

Maybe your init script should die if the files and directories aren't writable 
by the user you run slapd as.

There are more ways (than slapindex) to break file ownership.

Comment 3 rra@debian.org 2008-02-07 18:48:40 UTC
Buchan Milne <bgmilne@staff.telkomsa.net> writes:
> On Thursday 07 February 2008 08:22:12 rra@stanford.edu wrote:

>> One of the most common problems we see in Debian with people new to
>> OpenLDAP is that they run slapindex as root when they're running their
>> directory server as a non-root user and hence break the file ownership
>> and the database.
>
> Maybe your init script should die if the files and directories aren't
> writable by the user you run slapd as.
>
> There are more ways (than slapindex) to break file ownership.

There is, and we should probably also do that, but slapindex is far and
away the most common and it would be cool if we could catch the problem
before it happens instead of just warning afterwards.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Comment 4 Hallvard Furuseth 2008-02-07 19:19:04 UTC
rra@stanford.edu writes:
>> There are more ways (than slapindex) to break file ownership.
>
> There is, and we should probably also do that, but slapindex is far and
> away the most common and it would be cool if we could catch the problem
> before it happens instead of just warning afterwards.

slapadd has the same problem.  For that matter, starting slapd without
-u can mess up for when you restart with -u.  So we can just as well
make it general: If root opens a database for writing, fail instead if
the directory or database file is not owned by root.  Unless a
slapd.conf option says differently I guess.  Not sure if the
default should be to check that for slapd as well as the tools.

-- 
Hallvard

Comment 5 rra@debian.org 2008-02-07 20:19:54 UTC
Hallvard B Furuseth <h.b.furuseth@usit.uio.no> writes:

> slapadd has the same problem.  For that matter, starting slapd without
> -u can mess up for when you restart with -u.  So we can just as well
> make it general: If root opens a database for writing, fail instead if
> the directory or database file is not owned by root.  Unless a
> slapd.conf option says differently I guess.  Not sure if the default
> should be to check that for slapd as well as the tools.

That would be awesome.  I think checking for slapd as well makes sense.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Comment 6 Quanah Gibson-Mount 2023-10-09 17:02:05 UTC
This only really applies to a slapadd for cn=config now that back-bdb/hdb are retired. In that case just do a recursive chown -R on the config db after running slapadd.